How to increase Java heap size for SOLR in a Linux environment
Original Question or Issue:
I was able to complete the Solr configuration. However, the indexed file count is -1
Environment:
- Product - FileCloud Server
- Version - Any
- Platform - Any
Steps to Reproduce:
Error or Log Message:
Fatal error: OutOfMemory encountered: Java heap space
Defect or Enhancement Number:
Cause:
SOLR crashes with an out-of-memory error. In some installations with large numbers of files (especially text-based documents), the heap memory is insufficient.
Resolution or Workaround:
- Edit the file " /etc/default/solr.in.sh ".
- Look for the line below.
#SOLR_JAVA_MEM="-Xms512m -Xmx512m"
- Uncomment it, and increase the value depending on the resource available on your machine. If possible, change it to
SOLR_JAVA_MEM="-Xms6144m -Xmx6144m".
- After making changes, save the file and restart the Solr service by running the command below:
# service solr restart
Notes: