Monday, June 23, 2014

Switching Solr from port 8983

The canonical port for Solr is 8983, but there are circumstances where you may want to change this. For example, if you wish to experiment with a new release, or you want your various Sitecore development instances to hit separate instances of Solr.  Here are three options for changing the port number.
  1. Change the value of the following line in etc\jetty.xml:
    <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
    When this value has been changed, the java -jar start.jar command will launch Solr on the new port.
  2. Change the port as a command line option:
    C:\solr-4.8.1\example>java -jar start.jar -Djetty.port=9999
    
  3. Set up as a service using https://github.com/serbrech/SolrWindowsService, which allows defining the port in configuration. See http://alsagile.com/post/25153448145/running-solr-as-a-windows-service, which shows the configuration options.
Note that if you change the port, and you want to work through the Solr tutorial, you will need to change all the example links, which are all written with port 8983, and you will need to specify the new port when uploading documents using post.jar:
C:\solr-4.8.1\example>java  -Durl=http://localhost:9999/solr/update -jar post.jar solr.xml monitor.xml

The -Durl bit needs to come before the "-jar post.jar" portion in order to get the post.jar utility to work with the new port number.





1 comment: