How can I set JVM-Memory in Solr-5.0

2020-06-01 03:50发布

问题:

How can I increase heap space memory in Solr-5.0? I just want to set minimum and maximum Heap space memory of Solr.

回答1:

This info is in the WIKI: https://cwiki.apache.org/confluence/display/solr/Taking+Solr+to+Production#TakingSolrtoProduction-MemoryandGCSettings

SOLR_JAVA_MEM="-Xms10g -Xmx10g"



回答2:

How about using -m option

./solr restart -m 1g

From ./solr --help -

-m Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g results in: -Xms4g -Xmx4g; by default, this script sets the heap size to 512m



回答3:

Follow the below steps to increase the JVM memory in Solr:

  1. Open solr.in.cmd in any text editor (path: bin/solr.in.cmd)

  2. Add the set SOLR_JAVA_MEM=-Xms1g -Xmx1g ( it will set the minimum and maximum Java heap memory by 1 GB. however you will only able the see 981.38 MB in solr dashboard)

  3. save the solr.in.cmd file and restart the solr


回答4:

For Centos 7 the modification is in the file bin/solr, e.g. to increase it to 5G :

vim /opt/solr/bin/solr

Edit the block of code:

JAVA_MEM_OPTS=()
if [ -z "$SOLR_HEAP" ] && [ -n "$SOLR_JAVA_MEM" ]; then
  JAVA_MEM_OPTS=($SOLR_JAVA_MEM)
else
  SOLR_HEAP="${SOLR_HEAP:-512m}"
  JAVA_MEM_OPTS=("-Xms5g" "-Xmx5g")
fi


标签: solr