def _configure_redis(): """ * Redis needs to be able to overcommit memory or it will fail during replication. * It does not have any enviromental specific configuration and can be installed on any server or enviroment. * redis-check is the script keepalived uses in order to setup master/slave replication. """ x("echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf") x("mv {0}redis.conf {1}org.redis.conf".format(REDIS_CONF_DIR, REDIS_CONF_DIR)) x("cp {0}var/redis/redis.conf {1}redis.conf".format(SYCO_FO_PATH, REDIS_CONF_DIR)) x("cp {0}var/redis/redis-check {1}redis-check".format(SYCO_FO_PATH, REDIS_SCRIPT_DIR)) x("chmod 755 {0}redis-check".format(REDIS_SCRIPT_DIR)) scopen.scOpen(REDIS_CONF_DIR + "redis.conf").replace("${REDIS_PASSWORD}", password.get_redis_production_password()) scopen.scOpen(REDIS_SCRIPT_DIR + "redis-check").replace("${REDIS_PASSWORD}", password.get_redis_production_password()) _chkconfig("redis", "on") _service("redis", "restart")
def install_redis(args): """Install the packages and then configure them.""" app.print_verbose("Install Redis version: %d" % script_version) version_obj = version.Version("InstallRedis", script_version) version_obj.check_executed() # Initialize used passwords. password.get_redis_production_password() install.packages("tcl redis keepalived") _configure_selinux() _configure_iptables() _configure_keepalived() _configure_redis() x("sysctl -p") version_obj.mark_executed()
def _configure_redis(): """ * Redis needs to be able to overcommit memory or it will fail during replication. * It does not have any enviromental specific configuration and can be installed on any server or enviroment. * redis-check is the script keepalived uses in order to setup master/slave replication. """ x("echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf") x("mv {0}redis.conf {1}org.redis.conf".format(REDIS_CONF_DIR, REDIS_CONF_DIR)) x("cp {0}var/redis/redis.conf {1}redis.conf".format( SYCO_FO_PATH, REDIS_CONF_DIR)) x("cp {0}var/redis/redis-check {1}redis-check".format( SYCO_FO_PATH, REDIS_SCRIPT_DIR)) x("chmod 755 {0}redis-check".format(REDIS_SCRIPT_DIR)) scopen.scOpen(REDIS_CONF_DIR + "redis.conf").replace( "${REDIS_PASSWORD}", password.get_redis_production_password()) scopen.scOpen(REDIS_SCRIPT_DIR + "redis-check").replace( "${REDIS_PASSWORD}", password.get_redis_production_password()) _chkconfig("redis", "on") _service("redis", "restart")