[Solr] Refuse to start with RAM lt 2 GB
[Config/Update] Set limits and change descriptions for Solrmaster
parent
d008b67111
commit
ae4e1358a2
|
@ -6,6 +6,16 @@ if [[ "${SKIP_SOLR}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
MEM_TOTAL=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
|
||||||
|
|
||||||
|
if [[ "${1}" != "--bootstrap" ]]; then
|
||||||
|
if [ ${MEM_TOTAL} -lt "2097152" ]; then
|
||||||
|
echo "System memory less than 2 GB, skipping Solr..."
|
||||||
|
sleep 365d
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# allow easier debugging with `docker run -e VERBOSE=yes`
|
# allow easier debugging with `docker run -e VERBOSE=yes`
|
||||||
|
@ -158,7 +168,11 @@ function solr_config() {
|
||||||
|
|
||||||
# fixing volume permission
|
# fixing volume permission
|
||||||
[[ -d /opt/solr/server/solr/dovecot/data ]] && chown -R solr:solr /opt/solr/server/solr/dovecot/data
|
[[ -d /opt/solr/server/solr/dovecot/data ]] && chown -R solr:solr /opt/solr/server/solr/dovecot/data
|
||||||
sed -i 's/#SOLR_HEAP="512m"/SOLR_HEAP="'${SOLR_HEAP:-1024}'m"/g' /opt/solr/bin/solr.in.sh
|
if [[ "${1}" != "--bootstrap" ]]; then
|
||||||
|
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="'${SOLR_HEAP:-1024}'m"' /opt/solr/bin/solr.in.sh
|
||||||
|
else
|
||||||
|
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="256m"' /opt/solr/bin/solr.in.sh
|
||||||
|
fi
|
||||||
|
|
||||||
# start a Solr so we can use the Schema API, but only on localhost,
|
# start a Solr so we can use the Schema API, but only on localhost,
|
||||||
# so that clients don't see Solr until we have configured it.
|
# so that clients don't see Solr until we have configured it.
|
||||||
|
|
|
@ -50,9 +50,10 @@ done
|
||||||
|
|
||||||
MEM_TOTAL=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
|
MEM_TOTAL=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
|
||||||
|
|
||||||
if [ ${MEM_TOTAL} -le "1572864" ]; then
|
if [ ${MEM_TOTAL} -le "2621440" ]; then
|
||||||
echo "Installed memory is less than 1.5 GiB. It is recommended to disable ClamAV to prevent out-of-memory situations."
|
echo "Installed memory is <= 2.5 GiB. It is recommended to disable ClamAV to prevent out-of-memory situations."
|
||||||
read -r -p "Do you want to disable ClamAV now? ClamAV can be re-enabled by setting SKIP_CLAMD=n in mailcow.conf. [Y/n] " response
|
echo "ClamAV can be re-enabled by setting SKIP_CLAMD=n in mailcow.conf."
|
||||||
|
read -r -p "Do you want to disable ClamAV now? [Y/n] " response
|
||||||
case $response in
|
case $response in
|
||||||
[nN][oO]|[nN])
|
[nN][oO]|[nN])
|
||||||
SKIP_CLAMD=n
|
SKIP_CLAMD=n
|
||||||
|
@ -65,10 +66,14 @@ else
|
||||||
SKIP_CLAMD=n
|
SKIP_CLAMD=n
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${MEM_TOTAL} -le "3670016" ]; then
|
if [ ${MEM_TOTAL} -le "2097152" ]; then
|
||||||
echo "Installed memory is less than 3.5 GiB. It is highly recommended to disable Solr to prevent out-of-memory situations."
|
echo "Disabling Solr on low-memory system."
|
||||||
echo "Solr is a prone to run OOM and should be monitored. The default Solr heap size is 1024 MiB and should be set according to your expected load in mailcow.conf."
|
SKIP_SOLR=y
|
||||||
read -r -p "Do you want to disable Solr now (recommended)? Solr can be re-enabled by setting SKIP_SOLR=n in mailcow.conf. [Y/n] " response
|
elif [ ${MEM_TOTAL} -le "3670016" ]; then
|
||||||
|
echo "Installed memory is <= 3.5 GiB. It is recommended to disable Solr to prevent out-of-memory situations."
|
||||||
|
echo "Solr is a prone to run OOM and should be monitored. The default Solr heap size is 1024 MiB and should be set in mailcow.conf according to your expected load."
|
||||||
|
echo "Solr can be re-enabled by setting SKIP_SOLR=n in mailcow.conf but will refuse to start with less than 2 GB total memory."
|
||||||
|
read -r -p "Do you want to disable Solr now? [Y/n] " response
|
||||||
case $response in
|
case $response in
|
||||||
[nN][oO]|[nN])
|
[nN][oO]|[nN])
|
||||||
SKIP_SOLR=n
|
SKIP_SOLR=n
|
||||||
|
|
|
@ -219,6 +219,7 @@ for option in ${CONFIG_ARRAY[@]}; do
|
||||||
echo "Adding new option \"${option}\" to mailcow.conf"
|
echo "Adding new option \"${option}\" to mailcow.conf"
|
||||||
echo '# Solr heap size, there is no recommendation, please see Solr docs.' >> mailcow.conf
|
echo '# Solr heap size, there is no recommendation, please see Solr docs.' >> mailcow.conf
|
||||||
echo '# Solr is a prone to run OOM on large systems and should be monitored. Unmonitored Solr setups are not recommended.' >> mailcow.conf
|
echo '# Solr is a prone to run OOM on large systems and should be monitored. Unmonitored Solr setups are not recommended.' >> mailcow.conf
|
||||||
|
echo '# Solr will refuse to start with total system memory below or equal to 2 GB.' >> mailcow.conf
|
||||||
echo "SOLR_HEAP=1024" >> mailcow.conf
|
echo "SOLR_HEAP=1024" >> mailcow.conf
|
||||||
fi
|
fi
|
||||||
elif ! grep -q ${option} mailcow.conf; then
|
elif ! grep -q ${option} mailcow.conf; then
|
||||||
|
|
Loading…
Reference in New Issue