SOLR Config Tips
Increasing Solr Heap Size:
If you manage a large number of files (especially text-based documents) and are seeing Solr crash with an out of memory error in its logs, try the following tip to solve the issue.
By default, Solr ships with 512MB for heap size. In some installations with large numbers of files (especially text-based documents), this heap memory is not enough. Solr might crash in these cases and show an out of memory error in its logs.
- Follow these steps to increase the heap size.
- In this example, the heap size is increased to 2G.
- Administrators can increase it more depending on their site needs.
To increase the Solr heap size:
- If Solr server does not stop when stopped from services, open the control panel and kill the java process. Make sure no process is listening at port 8983.
Solr may require more memory depending on the amount of data being indexed (JAVA OOM errors). In that case, the only option is to bump of the system memory and increase the JAVA heap limit.
Update Java heap limit for SOLR To 2GBIn the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\solrservice\ Look for the APP Parameters and add -m 2G Restart the service.
Start the Solr service from FileCloud control panel or Windows services panel.
Changing Solr Temporary folder:
1- in Linux Add the following line to /etc/default/solr.in.sh: SOLR_OPTS="$SOLR_OPTS -Djava.io.tmpdir=/your/tmp/dir" 2- in Windows Add the following line to C:\xampp\solr\bin\solr.in.cmd SOLR_OPTS="$SOLR_OPTS -Djava.io.tmpdir=/your/tmp/dir"
Make sure to restart Solr for the changes to take effect.
Enabling Authentication for Solr:
- Create a new file with name security.json at /opt/solr76data/var/solr/data/security.json for Linux or C:\xampp\solr\server\solr\security.json for Windows
- Add the following lines to security.json file. This enables login with username solr and password SolrRocks
{ "authentication": { "blockUnknown": true, "class":"solr.BasicAuthPlugin", "credentials": { "solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c=" } }, "authorization": { "class":"solr.RuleBasedAuthorizationPlugin", "permissions": [ { "name":"security-edit", "role":"admin" } ], "user-role": { "solr":"admin" } } }
3. Restart Solr and check http://localhost:8983/solr for authentication
4. Add the following entries to the cloudconfig:
define("TONIDOCLOUD_SOLR_USERNAME", "solr"); define("TONIDOCLOUD_SOLR_PASSWORD", "SolrRocks");
5. To change the password please use the following command:
curl –user solr:SolrRocks http://localhost:8983/solr/admin/authentication -H 'Content-type:application/json' -d '{"set-user":{"solr":"NewPassword"}}'
6. To change the password for SSL protected Solr server please use the following command:
curl -u solr:SolrRocks https://your_domain_name:8983/solr/admin/authentication -H 'Content-type:application/json' -d '{"set-user":{"solr": "codelathe"}}'
NOTE: the username solr can be changed to anything but it has to be replaced for all the steps (including the initial config).
7. To make solr daemon detect Solr status you need to update the following config files:
1- in Linux Add the following line to /etc/default/solr.in.sh: SOLR_AUTH_TYPE="basic" SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:codelathe" 2- in Windows Add the following line to C:\xampp\solr\bin\solr.in.cmd SOLR_AUTH_TYPE="basic" SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:codelathe"
This is necessary only if authentication is enabled on Solr.