solr: Automatically determine java memory limits
This commit is contained in:
parent
298aee2225
commit
e6be930f22
2 changed files with 18 additions and 7 deletions
|
@ -122,7 +122,7 @@ class solr {
|
|||
mode => "0755",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
source => "puppet:///modules/solr/solr.init",
|
||||
content => template("solr/solr.init.erb"),
|
||||
notify => Exec["add-service-solr"],
|
||||
}
|
||||
exec { "add-service-solr":
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
<%
|
||||
mem, unit = @memorysize.split
|
||||
case unit
|
||||
when "GB"
|
||||
mem = mem.to_i * 1024
|
||||
else
|
||||
mem = mem.to_i
|
||||
end
|
||||
heapmin = (mem * 0.15).to_i
|
||||
heapmax = (mem * 0.85).to_i
|
||||
-%>
|
||||
#!/bin/sh
|
||||
|
||||
# chkconfig: 2345 95 05
|
||||
|
@ -19,7 +30,7 @@ SOLRUSER="solr"
|
|||
RUNDIR="/srv/solr/run"
|
||||
HOMEDIR="/srv/solr/cores"
|
||||
LOG4JCONFIG="file:///${RUNDIR}/resources/log4j.properties"
|
||||
MEMORYLIMIT="-Xms1024M -Xmx4096M"
|
||||
MEMORYLIMIT="-Xms<%= heapmin %>M -Xmx<%= heapmax %>M"
|
||||
|
||||
if [ `id -u` != "0" ]; then
|
||||
echo "This script must be run with root privileges." && exit 1
|
Loading…
Add table
Reference in a new issue