Fix kernel tweaks

This commit is contained in:
VirtuBox
2019-07-25 17:13:27 +02:00
parent 5cf62061e7
commit 11de72b4e8
5 changed files with 35 additions and 16 deletions

View File

@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- MySQL configuration tuning
- Cronjob to optimize MySQL databases weekly
- wo-kernel systemd service to apply kernel tweaks on server startup
#### Changed
@@ -19,6 +20,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Improved debug log
- Updated Nginx configuration process to not overwrite files with custom data (htpasswd-wo, acl.conf etc..)
#### Fixed
- Kernel tweaks were not applied without server reboot
### v3.9.6.2 - 2019-07-24
#### Changed

13
install
View File

@@ -453,11 +453,12 @@ wo_upgrade_nginx() {
fi
else
if [ "$wo_distro_version" == "jessie" ]; then
# import the respository key for updates
curl -sL https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_8.0/Release.key | apt-key add -
else
curl -sL https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_9.0/Release.key | apt-key add -
fi
# import the respository key for updates
fi
# stop nginx
@@ -649,6 +650,16 @@ wo_tweak_kernel() {
modprobe tcp_htcp && echo 'tcp_htcp' >> /etc/modules-load.d/htcp.conf
echo 'net.ipv4.tcp_congestion_control = htcp' >> /etc/sysctl.d/60-wo-tweaks.conf
fi
# apply sysctl tweaks
sysctl -e -p /etc/sysctl.d/60-wo-tweaks.conf
if [ ! -x /opt/wo-kernel.sh ]; then
# download and setup wo-kernel systemd service to apply kernel tweaks for netdata and redis on server startup
wget -qO /opt/wo-kernel.sh https://raw.githubusercontent.com/WordOps/WordOps/updating-configuration/wo/cli/templates/wo-kernel-script.mustache
chmod +x /opt/wo-kernel.sh
wget -qO /lib/systemd/system/wo-kernel.service https://raw.githubusercontent.com/WordOps/WordOps/updating-configuration/wo/cli/templates/wo-kernel-service.mustache
systemctl enable wo-kernel.service
systemctl start wo-kernel.service
fi
fi
LIMIT_CHECK=$(grep "500000" /etc/security/limits.conf)

View File

@@ -1,13 +0,0 @@
[Unit]
Description=Linux kernel tweaks
# append here other services you want netdata to wait for them to start
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/kerneltweaks.sh
[Install]
WantedBy=multi-user.target

View File

@@ -1,7 +1,9 @@
#!/usr/bin/env bash
# Kernel tweak script launched by kerneltweak systemd service
# script path after installation /opt/kerneltweaks.sh
# WordOps Kernel tweaks script
# script path after installation /opt/wo-kernel.sh
# Netdata Memory tweak
echo 1 >/sys/kernel/mm/ksm/run
echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs
# Redis disable transparent_hugepage
echo never > /sys/kernel/mm/transparent_hugepage/enabled

View File

@@ -0,0 +1,14 @@
[Unit]
Description=WordOps kernel tweaks
# append here other services you want netdata to wait for them to start
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
User=root
ExecStart=/opt/wo-kernel.sh
StandardOutput=null
[Install]
WantedBy=multi-user.target
Alias=wo-kernel.service