@@ -41,23 +41,46 @@ chmod 775 /var/log/redis
4141# chown -R redis:redis /var/lib/redis
4242# chown -R redis:redis /var/log/redis
4343
44+ # Copy Redis Config File
4445cp -rf /usr/local/bin/enginescript/etc/redis/redis.conf /etc/redis/redis.conf
46+
47+ # Redis Tuning
4548sed -i " s|SEDREDISMAXMEM|${SERVER_MEMORY_TOTAL_06} |g" /etc/redis/redis.conf
49+
50+ if [[ " ${CPU_COUNT} " -ge ' 16' ]]; then
51+ sed -i " s|^# io-threads 4|io-threads 8|" /etc/redis/redis.conf
52+ sed -i " s|^# io-threads-do-reads no|io-threads-do-reads yes|" /etc/redis/redis.conf
53+ elif [[ " ${CPU_COUNT} " -ge ' 12' && " ${CPU_COUNT} " -le ' 15' ]]; then
54+ sed -i " s|^# io-threads 4|io-threads 6|" /etc/redis/redis.conf
55+ sed -i " s|^# io-threads-do-reads no|io-threads-do-reads yes|" /etc/redis/redis.conf
56+ elif [[ " ${CPU_COUNT} " -ge ' 7' && " ${CPU_COUNT} " -le ' 11' ]]; then
57+ sed -i " s|^# io-threads 4|io-threads 4|" /etc/redis/redis.conf
58+ sed -i " s|^# io-threads-do-reads no|io-threads-do-reads yes|" /etc/redis/redis.conf
59+ elif [[ " ${CPU_COUNT} " -ge ' 4' && " ${CPU_COUNT} " -le ' 6' ]]; then
60+ sed -i " s|^# io-threads 4|io-threads 2|" /etc/redis/redis.conf
61+ sed -i " s|^# io-threads-do-reads no|io-threads-do-reads yes|" /etc/redis/redis.conf
62+ fi
63+
64+ # Redis Service
4665# sed -i "s|Type=notify|Type=forking|g" /lib/systemd/system/redis-server.service
4766sed -i " s|--daemonize no|--daemonize yes|g" /lib/systemd/system/redis-server.service
4867sed -i " s|ReadWritePaths=-/var/run|ReadWritePaths=-/run|g" /lib/systemd/system/redis-server.service
68+
69+ # Permissions
4970chown -R redis:redis /etc/redis/redis.conf
5071chmod 775 /etc/redis/redis.conf
72+
73+ # Finalize Redis Install
5174systemctl daemon-reload
5275service redis-server restart
5376sudo systemctl enable redis-server
5477
5578# Redis Service Check
5679STATUS=" $( systemctl is-active redis) "
5780if [ " ${STATUS} " = " active" ]; then
58- echo " PASSED: Redis is running."
59- echo " REDIS=1" >> /home/EngineScript/install-log.txt
81+ echo " PASSED: Redis is running."
82+ echo " REDIS=1" >> /home/EngineScript/install-log.txt
6083else
61- echo " FAILED: Redis not running. Please diagnose this issue before proceeding."
62- exit 1
84+ echo " FAILED: Redis not running. Please diagnose this issue before proceeding."
85+ exit 1
6386fi
0 commit comments