solr: Automatically determine java memory limits
This commit is contained in:
parent
298aee2225
commit
e6be930f22
2 changed files with 18 additions and 7 deletions
|
@ -118,12 +118,12 @@ class solr {
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/etc/init.d/solr":
|
file { "/etc/init.d/solr":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
mode => "0755",
|
mode => "0755",
|
||||||
owner => "root",
|
owner => "root",
|
||||||
group => "root",
|
group => "root",
|
||||||
source => "puppet:///modules/solr/solr.init",
|
content => template("solr/solr.init.erb"),
|
||||||
notify => Exec["add-service-solr"],
|
notify => Exec["add-service-solr"],
|
||||||
}
|
}
|
||||||
exec { "add-service-solr":
|
exec { "add-service-solr":
|
||||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
|
|
|
@ -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
|
#!/bin/sh
|
||||||
|
|
||||||
# chkconfig: 2345 95 05
|
# chkconfig: 2345 95 05
|
||||||
|
@ -19,7 +30,7 @@ SOLRUSER="solr"
|
||||||
RUNDIR="/srv/solr/run"
|
RUNDIR="/srv/solr/run"
|
||||||
HOMEDIR="/srv/solr/cores"
|
HOMEDIR="/srv/solr/cores"
|
||||||
LOG4JCONFIG="file:///${RUNDIR}/resources/log4j.properties"
|
LOG4JCONFIG="file:///${RUNDIR}/resources/log4j.properties"
|
||||||
MEMORYLIMIT="-Xms1024M -Xmx4096M"
|
MEMORYLIMIT="-Xms<%= heapmin %>M -Xmx<%= heapmax %>M"
|
||||||
|
|
||||||
if [ `id -u` != "0" ]; then
|
if [ `id -u` != "0" ]; then
|
||||||
echo "This script must be run with root privileges." && exit 1
|
echo "This script must be run with root privileges." && exit 1
|
Loading…
Add table
Reference in a new issue