Skip to main content

Updating apache Solr Cloud after Java update

Apache Solr

I have been running Apache Solr Cloud and Zookeeper to help improve the search performance and UX around Drupal based sites for a year or so now. Here I look at updating Java run time and how to restart your solr.

  1. Java requires updating e.g. OpenJDK 8 Runtime Environment - Go ahead and update Java runtime.
  2. Once Java has been updated, it will be necessary to restart your Solr Cloud and then restart any nodes. First of all lets log on to the server and switch to the authorised solr user e.g. su solr
  3. Lets have a look at what is running before we stop and restart the server. we can use solr status e.g. /opt/solr/bin/solr status command. This should give us a bit more info e.g.
    - Found 5 Solr nodes:
    - Solr process 1954 from /var/solr/solr-7354.pid not found.
    - Solr process 2664 from /var/solr/solr-75744.pid not found.
    - Solr process 7231 running on port 7575
    - Solr process 6724 running on port 8983
    - Solr process 7019 running on port 7574
     
  4. We can also use process command ps -ef | grep solr. This will return data on just the running processes. The -ef flag is used to see every process on the system using standard syntax. e.g.
    solr      6724     1  0 Apr05 ?        14:10:59 java -server -Xms512m -Xmx512m -XX:+UseG1GC -XX:+PerfDisableSharedMem -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=250 -XX:+UseLargePages -XX:+AlwaysPreTouch -XX:+ExplicitGCInvokesConcurrent -verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:/opt/solr/example/cloud/node1/solr/../logs/solr_gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=20M -Dsolr.jetty.inetaccess.includes= -Dsolr.jetty.inetaccess.excludes= -DzkClientTimeout=30000 -DzkRun -Dsolr.log.dir=/opt/solr/example/cloud/node1/solr/../logs -Djetty.port=8983 -DSTOP.PORT=7983 -DSTOP.KEY=solrrocks -Duser.timezone=UTC -XX:-OmitStackTraceInFastThrow -XX:OnOutOfMemoryError=/opt/solr/bin/oom_solr.sh 8983 /opt/solr/example/cloud/node1/solr/../logs -Djetty.home=/opt/solr/server -Dsolr.solr.home=/opt/solr/example/cloud/node1/solr -Dsolr.data.home= -Dsolr.install.dir=/opt/solr -Dsolr.default.confdir=/opt/solr/server/solr/configsets/_default/conf -Dlog4j.configurationFile=/opt/solr/server/resources/log4j2.xml -Xss256k -Dsolr.log.muteconsole -jar start.jar --module=http --module=gzip
    There's some useful info here. e.g. Dsolr.solr.home=/opt/solr/example/cloud/node1/solr gives us the location of the master solr node. This will be useful in the next step. It also shows us the port that each nod is running on e.g. -Djetty.port=8983
  5. Lets go ahead and stop solr e.g. /opt/solr/bin/solr stop -all - Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 6724 to stop gracefully.
  6. Now we can try starting again. e.g. /opt/solr/bin/solr start -cloud -p 8983 -s /opt/solr/example/cloud/node1/solr.  Note the use of -cloud tag. This indicates that we want to use a cloud set up rand can be shortened to -c  e.g.  bin/solr start -c
  7. Hopefully this all goes smoothly. We can now check that our nodes are still running as expected using either ps or solrcommands.
     

Other

If  running as root user you can use the following command to create a a new collection without having to manually switch to solr user .e.g.

su - solr -c "/opt/solr/bin/solr create -c newcollection -n data_driven_schema_configs"

Note the -n flag refers allows you to define the name of the configuration to use. 

When you create a collection in SolrCloud, you can specify a named configset — possibly shared. If you don’t, then the _default will be copied and given a unique name for use by this collection.

https://solr.apache.org/guide/8_4/config-sets.html

Also the -c flag tells Solr to run in distributed mode aka SolrCloud as opposed to standalone mode.

Solr can be run in either standalone or distributed (SolrCloud mode).

https://github.com/apache/solr/tree/releases/lucene-solr/8.8.1?tab=readme-ov-file#running-solr

 

Add new comment

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.