Browse Source

Merge pull request #684 from zorrobyte/zorrobyte-patch-1

Fix Redis config volatile-lru -> allkeys-lru
master
Harshad Yeola 9 years ago
parent
commit
bfc310e892
  1. 10
      ee/cli/plugins/stack.py

10
ee/cli/plugins/stack.py

@ -2401,15 +2401,15 @@ class EEStackController(CementBaseController):
if 'redis-server' in apt_packages: if 'redis-server' in apt_packages:
# set redis.conf parameter # set redis.conf parameter
# set maxmemory 10% for ram below 512MB and 20% for others # set maxmemory 10% for ram below 512MB and 20% for others
# set maxmemory-policy volatile-lru # set maxmemory-policy allkeys-lru
if os.path.isfile("/etc/redis/redis.conf"): if os.path.isfile("/etc/redis/redis.conf"):
if EEVariables.ee_ram < 512: if EEVariables.ee_ram < 512:
Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" Log.debug(self, "Setting maxmemory variable to {0} in redis.conf"
.format(int(EEVariables.ee_ram*1024*1024*0.1))) .format(int(EEVariables.ee_ram*1024*1024*0.1)))
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf" EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf"
.format(int(EEVariables.ee_ram*1024*1024*0.1))) .format(int(EEVariables.ee_ram*1024*1024*0.1)))
Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf") Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf")
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy volatile-lru/' " EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' "
"/etc/redis/redis.conf") "/etc/redis/redis.conf")
EEService.restart_service(self, 'redis-server') EEService.restart_service(self, 'redis-server')
else: else:
@ -2417,8 +2417,8 @@ class EEStackController(CementBaseController):
.format(int(EEVariables.ee_ram*1024*1024*0.2))) .format(int(EEVariables.ee_ram*1024*1024*0.2)))
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf" EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf"
.format(int(EEVariables.ee_ram*1024*1024*0.2))) .format(int(EEVariables.ee_ram*1024*1024*0.2)))
Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf") Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf")
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy volatile-lru/' " EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' "
"/etc/redis/redis.conf") "/etc/redis/redis.conf")
EEService.restart_service(self, 'redis-server') EEService.restart_service(self, 'redis-server')
if disp_msg: if disp_msg:

Loading…
Cancel
Save