Commit 26b30661 authored by Rafael Monnerat's avatar Rafael Monnerat

[Tweak] Include slapos-tweak script from slapprepare

Compatible with debian/ubuntu/opensuse, it is used to tweak few variables
needed for run KVM or optimize network transference or load some important
modules.

This script is not enabled by default, because it should be used with care.
parent 335f7970
......@@ -13,6 +13,7 @@ install: all
cp slapos-start $(DESTDIR)/usr/sbin/
cp slapos-test $(DESTDIR)/usr/sbin/
cp slapos-re6st-setup $(DESTDIR)/usr/sbin/
cp slapos-tweak $(DESTDIR)/usr/sbin/
cp $(DESTDIR)/opt/slapos/bin/slapos $(DESTDIR)/usr/bin/
# Open VPN configuration
mkdir -p $(DESTDIR)/etc/opt/slapos/
......
#!/bin/sh -e
mkdir -v -p -m 0755 `grep ^certificate_repository_path /etc/opt/slapos/slapos.cfg | sed 's/^certificate_repository_path.*= *//'`
grep ^computer_id /etc/opt/slapos/slapos.cfg | sed 's/^computer_id.*= *//' > /etc/hostname
hostname -F /etc/hostname
echo """ [SERVER TWEAK] Set sysctl, load kvm_intel and other modules."""
# Setup more server like network parameters in order to avoid
# "Neighbour table overflow."
# Those machines are itself has a lot of interfaces and are in
# heavily networked environment, so limit of ARP cache for IPv4
# and IPv6 is 4x higher then default
# More tuning can be applied from: http://www.enigma.id.au/linux_tuning.txt
sysctl -w \
net.ipv4.neigh.default.gc_thresh1=512 \
net.ipv4.neigh.default.gc_thresh2=1024 \
net.ipv4.neigh.default.gc_thresh3=2048 \
net.ipv6.neigh.default.gc_thresh1=512 \
net.ipv6.neigh.default.gc_thresh2=1024 \
net.ipv6.neigh.default.gc_thresh3=2048
# Increase default aio-max-nr for sql servers
sysctl -w fs.aio-max-nr=16777216
# Increase semaphore limits
sysctl -w kernel.sem="1250 256000 100 1024"
# Force reboot after kernel panic
sysctl -w kernel.panic=120
# Yes we hardcode this here for debian
e2label /dev/sda1 SLAPOS
# Enable noop scheduler for disk which have SLAPOS labeled partition
disk=\`blkid -L SLAPOS | sed -r -e 's/(\/dev\/|[0-9]*$)//g'\`
echo noop > /sys/block/\$disk/queue/scheduler
# Set kvm up
modprobe kvm_intel
sleep 1
chmod 666 /dev/kvm
# By pass if some of the followed modules are not available.
# This is usually needed or preferred for a specific hardware/distribution.
set +e
# Set power saving
modprobe acpi_cpufreq > /dev/null 2>&1
# Set hardware monitoring tools (for Shuttle xh61 machines)
modprobe coretemp > /dev/null 2>&1
modprobe f71882fg > /dev/null 2>&1
set -e
# Activate KSM (shared memory for KVM)
echo 1 > /sys/kernel/mm/ksm/run
slapos node format -v --now
echo "[SlapOS Tweak] Finished at: `date`"
echo "######################################################################"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment