Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Solr post-provision script only works for 5.x and later #1518

Closed
danepowell opened this issue Aug 16, 2017 · 6 comments
Closed

Solr post-provision script only works for 5.x and later #1518

danepowell opened this issue Aug 16, 2017 · 6 comments

Comments

@danepowell
Copy link
Contributor

The example solr post-provision script includes this command:

/opt/solr/bin/solr

This only works on Solr 5.x. On Solr 4.x, that binary doesn't exist and the command fails. I haven't been able to figure out what the equivalent command is on 4.x, or whether it even exists.

@geerlingguy
Copy link
Owner

@danepowell - So, welcome to my Solr hell. I'm currently supporting Solr 1.4 (!!), 3.5, 4.10.4, 5.x and 6.x across various projects :D

Please check out https://hub.docker.com/r/geerlingguy/solr/ for some more docs concerning core creation and placement in 4.x and 3.x. Note that in 4.x, there's no convenient helper functionality built into solr to generate cores. Instead, you have to either copy the default core that's installed with solr to the directory where you want your cores (usually $SOLR_HOME, I like /var/solr), then make sure your solr.xml file (e.g. /var/solr/solr.xml) describes each core individually, or is structured to allow automatic loading of any cores with an appropriate core.properties file included.

@geerlingguy
Copy link
Owner

geerlingguy commented Aug 18, 2017

I'm debating whether to close this as a won't fix though... I'd consider 4.x releases to be legacy/un-officially-supported now, as they have not had bugfix or even critical security support for months (years maybe?), and I've already spent an ungodly number of my own hours trying to fix things for Solr < 4...

See: http://lucene.apache.org/solr/community.html#about-versions

< 5.5 | All older versions are End Of Life (EOL)

@danepowell
Copy link
Contributor Author

I totally get it, even if the script can't be easily updated to support multiple versions, maybe we could just add a note that it only works for 5.x+ and link to this issue?

@geerlingguy
Copy link
Owner

add a note that it only works for 5.x+ and link to this issue?

Sounds good!

@danepowell
Copy link
Contributor Author

For posterity, here's the setup script I used for a 4.x core:

SOLR_CORE_NAME="collection1"
SOLR_SETUP_COMPLETE_FILE="/etc/drupal_vm_solr_config_complete_$SOLR_CORE_NAME"
SOLR_CORE_PATH="/var/solr/$SOLR_CORE_NAME"

# Check to see if we've already performed this setup.
if [ ! -e "$SOLR_SETUP_COMPLETE_FILE" ]; then
  # Copy new Solr collection core with the Solr configuration provided by module.
  sudo cp -r /var/www/foo/box/config-dir/* $SOLR_CORE_PATH/conf/

  # Adjust the autoCommit time so index changes are committed in 1s.
  sudo sed -i 's/\(<maxTime>\)\([^<]*\)\(<[^>]*\)/\11000\3/g' $SOLR_CORE_PATH/conf/solrconfig.xml

  # Restart Apache Solr.
  sudo service solr restart

  # Create a file to indicate this script has already run.
  sudo touch $SOLR_SETUP_COMPLETE_FILE
else
  exit 0
fi

@danepowell
Copy link
Contributor Author

danepowell commented May 31, 2018

Note that for later version of Ubuntu, you have to update the script I posted above as in acquia/blt#2841

Otherwise Solr won't start, because 4.5.1 is incompatible with systemd

@geerlingguy geerlingguy changed the title Solr post-provision script only works for 5.x Solr post-provision script only works for 5.x and later Jun 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants