[英]How to set JVM heap size for Solr 4.5 on Windows Bitnami stack?
I have Apache Solr installed on Windows Server R2 64-bit machine with 8 GB of RAM. 我在具有8 GB RAM的Windows Server R2 64位计算机上安装了Apache Solr 。 By default, JVM seems to be using ~256 MB of memory.
默认情况下,JVM似乎正在使用约256 MB的内存。 Since I have some pretty big files for indexing with it, sometimes I get Java heap space OutOfMemoryError.
由于我有一些很大的文件可用于建立索引,因此有时会得到Java堆空间OutOfMemoryError。
How should I increase the memory size available to Solr? 我应该如何增加Solr可用的内存大小?
Most of the documentation / posts I found over the web are pointing to something like java -Xms1024m -Xmx2048m -jar start.jar
, but I'm not running the Solr through the command line. 我在网上找到的大多数文档 / 帖子都指向
java -Xms1024m -Xmx2048m -jar start.jar
东西,但我没有通过命令行运行Solr。 It's run as a Windows service. 它作为Windows服务运行。 I guess there's a config option to set this somewhere in Solr installation folder, but I'm not able to find it (and besides, not very familiar with Java stack, since I'm a .NET developer).
我猜有一个配置选项可以在Solr安装文件夹中的某个位置进行设置,但是我找不到它(此外,因为我是.NET开发人员,所以对Java堆栈不是很熟悉)。
Few things I tried: 我尝试过的几件事:
/Bitnami/solr-4.5.0-0/scripts/setenv.bat
: set JAVA_OPTS="%JAVA_OPTS% -XX:MaxPermSize=1024m -Xms1024 -Xmx1024m"
/Bitnami/solr-4.5.0-0/scripts/setenv.bat
设置环境变量: set JAVA_OPTS="%JAVA_OPTS% -XX:MaxPermSize=1024m -Xms1024 -Xmx1024m"
/Bitnami/solr-4.5.0-0/scripts/serviceinstall.bat
and trying to add JvmOptions
arguments to a command line for installing Jetty service (again, not familiar with syntax here). /Bitnami/solr-4.5.0-0/scripts/serviceinstall.bat
并尝试将JvmOptions
参数添加到命令行以安装Jetty服务(同样,此处不熟悉语法)。 There's a similar answer for Ubuntu based installation, but script files are different. /Bitnami/solr-4.5.0-0/serviceinstall.bat REMOVE
and serviceinstall.bat INSTALL
after the changes above /Bitnami/solr-4.5.0-0/serviceinstall.bat REMOVE
和serviceinstall.bat INSTALL
Below is Solr's Dashboard screenshot. 下面是Solr的信息中心屏幕截图。
Any idea? 任何想法?
There's a serviceinstall.bat
file in /Bitnami/solr-4.5.0-0/apache-solr/scripts/
which contains Jvm options which I tried modifying but failed to get the expected result. /Bitnami/solr-4.5.0-0/apache-solr/scripts/
有一个serviceinstall.bat
文件,其中包含我尝试修改的/Bitnami/solr-4.5.0-0/apache-solr/scripts/
选项,但未能获得预期的结果。 Here's that line from the file (added line breaks for better display): 这是文件中的那一行(添加了换行符以便更好地显示):
"D:\BitNami\solr-4.5.0-0/apache-solr\scripts\prunsrv.exe" //IS//solrJetty
--DisplayName="solrJetty"
--Install="D:\BitNami\solr-4.5.0-0/apache-solr\scripts\prunsrv.exe"
--LogPath="D:\BitNami\solr-4.5.0-0/apache-solr\logs"
--LogLevel=Debug
--StdOutput=auto
--StdError=auto
--StartMode=Java
--StopMode=Java
--Jvm=auto
++JvmOptions=-DSTOP.PORT=8079
++JvmOptions=-DSTOP.KEY=s3crEt
++JvmOptions=-Djetty.home="D:\BitNami\solr-4.5.0-0/apache-solr"
++JvmOptions=-Dsolr.solr.home="D:\BitNami\solr-4.5.0-0/apache-solr/solr"
--Jvm=auto
++JvmOptions=-Djetty.logs="D:\BitNami\solr-4.5.0-0/apache-solr\logs"
--JavaHome="D:\BitNami\solr-4.5.0-0\java"
++JvmOptions=-XX:MaxPermSize=128M
--Classpath="D:\BitNami\solr-4.5.0-0/apache-solr\lib\*";"D:\BitNami\solr-4.5.0-0/apache-solr\start.jar"
--StartClass=org.eclipse.jetty.start.Main
++StartParams="D:\BitNami\solr-4.5.0-0/apache-solr\etc\jetty.xml"
--StopClass=org.eclipse.jetty.start.Main
++StopParams=--stop
++StopParams=-DSTOP.PORT=8079
++StopParams=-DSTOP.KEY=s3crEt
Does anyone know where to put additional JvmOptions (Xmx, Xms...) and what the syntax should be? 有谁知道在哪里放置其他JvmOptions(Xmx,Xms ...),语法应该是什么?
After some more research, I've managed to increase the heap size, by modifying /Bitnami/solr-4.5.0-0/apache-solr/scripts/serviceinstall.bat
script according to @rchukh's comment. 经过更多研究后,我根据@rchukh的评论修改了
/Bitnami/solr-4.5.0-0/apache-solr/scripts/serviceinstall.bat
脚本,设法增加了堆大小。
I've tried modifying that file before, but the Solr service needs to be reinstalled after any change there. 我曾经尝试过修改该文件,但是在那里进行任何更改后都需要重新安装Solr服务。 The problem was that I tried to reinstall it using the
/Bitnami/solr-4.5.0-0/serviceinstall.bat
. 问题是我试图使用
/Bitnami/solr-4.5.0-0/serviceinstall.bat
重新安装它。 That batch script should be running all other serviceinstall.bat
scripts in all subfolders, however it doesn't run the one that I needed. 该批处理脚本应在所有子文件夹中运行所有其他
serviceinstall.bat
脚本,但是不会运行我需要的脚本。
So, here's how my /Bitnami/solr-4.5.0-0/apache-solr/scripts/serviceinstall.bat
script looks now (longer lines broken for readability): 因此,这就是我的
/Bitnami/solr-4.5.0-0/apache-solr/scripts/serviceinstall.bat
脚本现在的外观(较长的行为便于阅读而中断):
@echo off
rem -- Check if argument is INSTALL or REMOVE
if not ""%1"" == ""INSTALL"" goto remove
"D:\BitNami\solr-4.5.0-0/apache-solr\scripts\prunsrv.exe" //IS//solrJetty
--DisplayName="solrJetty"
--Install="D:\BitNami\solr-4.5.0-0/apache-solr\scripts\prunsrv.exe"
--LogPath="D:\BitNami\solr-4.5.0-0/apache-solr\logs"
--LogLevel=Debug
--StdOutput=auto
--StdError=auto
--StartMode=Java
--StopMode=Java
--Jvm=auto
++JvmOptions=-DSTOP.PORT=8079
++JvmOptions=-DSTOP.KEY=s3crEt
++JvmOptions=-Djetty.home="D:\BitNami\solr-4.5.0-0/apache-solr"
++JvmOptions=-Dsolr.solr.home="D:\BitNami\solr-4.5.0-0/apache-solr/solr"
--Jvm=auto
++JvmOptions=-Djetty.logs="D:\BitNami\solr-4.5.0-0/apache-solr\logs"
--JavaHome="D:\BitNami\solr-4.5.0-0\java"
++JvmOptions=-XX:MaxPermSize=256M
++JvmOptions=-Xms1024M
++JvmOptions=-Xmx1024M
--Classpath="D:\BitNami\solr-4.5.0-0/apache-solr\lib\*";
"D:\BitNami\solr-4.5.0-0/apache-solr\start.jar"
--StartClass=org.eclipse.jetty.start.Main
++StartParams="D:\BitNami\solr-4.5.0-0/apache-solr\etc\jetty.xml"
--StopClass=org.eclipse.jetty.start.Main
++StopParams=--stop
++StopParams=-DSTOP.PORT=8079
++StopParams=-DSTOP.KEY=s3crEt
net start solrJetty >NUL
goto end
:remove
rem -- STOP SERVICE BEFORE REMOVING
net stop solrJetty >NUL
sc delete solrJetty
:end
exit
After that script is modified, you need to reinstall the service by running it twice (to remove and install): 修改该脚本后,您需要通过运行两次来重新安装该服务(以删除并安装):
D:/Bitnami/solr-4.5.0-0/apache-solr/scripts/serviceinstall.bat REMOVE
D:/Bitnami/solr-4.5.0-0/apache-solr/scripts/serviceinstall.bat INSTALL
You can change Bitnami\\solr-5.2.1-1\\apache-solr\\bin\\solr.in.cmd
. 您可以更改
Bitnami\\solr-5.2.1-1\\apache-solr\\bin\\solr.in.cmd
。 There is a line that says : 有一行显示:
set SOLR_JAVA_MEM=-Xms512m -Xmx512m
Change that to 更改为
set SOLR_JAVA_MEM=-Xms2g -Xmx2g
Then you need to restart the service : 然后,您需要重新启动服务:
net stop solrJetty
net start solrJetty
go to : http://localhost:8983/solr/#/ You will see new values in effect. 转到: http:// localhost:8983 / solr /#/您将看到生效的新值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.