Fix redis.conf permissions
This commit is contained in:
@@ -1000,7 +1000,7 @@ class WOStackController(CementBaseController):
|
|||||||
comment='MySQL optimization cronjob '
|
comment='MySQL optimization cronjob '
|
||||||
'added by WordOps')
|
'added by WordOps')
|
||||||
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
|
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
|
||||||
WOService.reload_service(self, 'mysql')
|
WOService.restart_service(self, 'mysql')
|
||||||
|
|
||||||
# create fail2ban configuration files
|
# create fail2ban configuration files
|
||||||
if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)):
|
if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)):
|
||||||
@@ -1721,7 +1721,7 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Calling pre_pref")
|
Log.debug(self, "Calling pre_pref")
|
||||||
self.pre_pref(apt_packages)
|
self.pre_pref(apt_packages)
|
||||||
if (apt_packages):
|
if (apt_packages):
|
||||||
meminfo = (os.popen('cat /proc/meminfo '
|
meminfo = (os.popen('/bin/cat /proc/meminfo '
|
||||||
'| grep MemTotal').read()).split(":")
|
'| grep MemTotal').read()).split(":")
|
||||||
memsplit = re.split(" kB", meminfo[1])
|
memsplit = re.split(" kB", meminfo[1])
|
||||||
wo_mem = int(memsplit[0])
|
wo_mem = int(memsplit[0])
|
||||||
@@ -1755,24 +1755,6 @@ class WOStackController(CementBaseController):
|
|||||||
"maxmemory {0}"
|
"maxmemory {0}"
|
||||||
.format
|
.format
|
||||||
(int(wo_ram*1024*1024*0.1)))
|
(int(wo_ram*1024*1024*0.1)))
|
||||||
Log.debug(
|
|
||||||
self, "Setting maxmemory-policy variable to "
|
|
||||||
"allkeys-lru in redis.conf")
|
|
||||||
WOFileUtils.searchreplace(self,
|
|
||||||
"/etc/redis/redis.conf",
|
|
||||||
"# maxmemory-policy "
|
|
||||||
"noeviction",
|
|
||||||
"maxmemory-policy "
|
|
||||||
"allkeys-lru")
|
|
||||||
Log.debug(
|
|
||||||
self, "Setting tcp-backlog variable to "
|
|
||||||
"in redis.conf")
|
|
||||||
WOFileUtils.searchreplace(self,
|
|
||||||
"/etc/redis/redis.conf",
|
|
||||||
"tcp-backlog 511",
|
|
||||||
"tcp-backlog 32768")
|
|
||||||
|
|
||||||
WOService.restart_service(self, 'redis-server')
|
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Setting maxmemory variable to {0} "
|
Log.debug(self, "Setting maxmemory variable to {0} "
|
||||||
"in redis.conf"
|
"in redis.conf"
|
||||||
@@ -1782,21 +1764,28 @@ class WOStackController(CementBaseController):
|
|||||||
"# maxmemory <bytes>",
|
"# maxmemory <bytes>",
|
||||||
"maxmemory {0}"
|
"maxmemory {0}"
|
||||||
.format
|
.format
|
||||||
(int(wo_ram*1024*1024*0.1)))
|
(int(wo_ram*1024*1024*0.2)))
|
||||||
Log.debug(
|
Log.debug(
|
||||||
self, "Setting maxmemory-policy variable "
|
self, "Setting maxmemory-policy variable to "
|
||||||
"to allkeys-lru in redis.conf")
|
"allkeys-lru in redis.conf")
|
||||||
WOFileUtils.searchreplace(self,
|
WOFileUtils.searchreplace(self,
|
||||||
"/etc/redis/redis.conf",
|
"/etc/redis/redis.conf",
|
||||||
"# maxmemory-policy "
|
"# maxmemory-policy "
|
||||||
"noeviction",
|
"noeviction",
|
||||||
"maxmemory-policy "
|
"maxmemory-policy "
|
||||||
"allkeys-lru")
|
"allkeys-lru")
|
||||||
WOFileUtils.chown(self, '/etc/redis/redis.conf',
|
Log.debug(
|
||||||
'redis',
|
self, "Setting tcp-backlog variable to "
|
||||||
'redis',
|
"in redis.conf")
|
||||||
recursive=False)
|
WOFileUtils.searchreplace(self,
|
||||||
WOService.restart_service(self, 'redis-server')
|
"/etc/redis/redis.conf",
|
||||||
|
"tcp-backlog 511",
|
||||||
|
"tcp-backlog 32768")
|
||||||
|
WOFileUtils.chown(self, '/etc/redis/redis.conf',
|
||||||
|
'redis',
|
||||||
|
'redis',
|
||||||
|
recursive=False)
|
||||||
|
WOService.restart_service(self, 'redis-server')
|
||||||
if 'mariadb-server' in apt_packages:
|
if 'mariadb-server' in apt_packages:
|
||||||
# setting innodb memory usage
|
# setting innodb memory usage
|
||||||
wo_ram = psutil.virtual_memory().total / (1024 * 1024)
|
wo_ram = psutil.virtual_memory().total / (1024 * 1024)
|
||||||
|
|||||||
Reference in New Issue
Block a user