Compare commits

...

12 Commits

5 changed files with 73 additions and 34 deletions

View File

@ -2,6 +2,7 @@
<creole>
<files>
<!-- System configuration -->
<file filelist='redis' name='/etc/sysctl.d/100-redis-tuning.conf' source='redis_sysctl.conf' mkdir='True' rm='True'/>
<file filelist='redis' name='/etc/redis/redis.conf' mkdir='True' rm='True'/>
<file filelist='redisSlave' name='/etc/redis/redis-slave.conf' mkdir='True' rm='True'/>
<file filelist='redisCl' name='/etc/redis/cluster.conf' source='redis-cluster.conf' mkdir='True' rm='True'/>
@ -31,8 +32,9 @@
<variable name='redisSlaveInstance' type='oui/non' description="Voulez-vous lancer une instance esclave Redis sur ce serveur ?">
<value>non</value>
</variable>
<!-- Instance Principale-->
<variable name='redisInstanceName' type='string' description="Nom de l'instance secondaire"/>
<variable name='redisInstanceName' type='string' description="Nom de l'instance principale"/>
<variable name='redisPort' type='number' description="Port d'écoute du service Redis">
<value>6379</value>
</variable>
@ -49,9 +51,13 @@
<!-- Instance Secondaire -->
<variable name='redisSlaveInstanceName' type='string' description="Nom de l'instance secondaire"/>
<variable name='redisSlaveInstanceMaster' type='string' description="Nom du noeud a répliquer sur l'instance secondaire"/>
<variable name='redisPortSlave' type='number' description="Port d'écoute du service Redis">
<variable name='redisMasterIPSlave' type='domain' description="Nom de domaine du service Redis master" mandatory="True"/>
<variable name='redisMasterPortSlave' type='number' description="Port d'écoute du service Redis master">
<value>6379</value>
</variable>
<variable name='redisPortSlave' type='number' description="Port d'écoute du service Redis slave">
<value>8379</value>
</variable>
<variable name='redisClPortSlave' type='number' description="Port d'écoute du service Cluster Redis"/>
<variable name='redisMaxMemorySlave' type='number' description="Quantité de mémoire utilisable par Redis en Mo">
<value>512</value>
@ -87,15 +93,21 @@
<variable name='rdClMemberSlaveMaster' type='string' description="Noeud du noeud répliquer sur cette instance secondaire"/>
</family>
<family name='Redis tunning' mode='expert'>
<variable name='redisMaxClients' type='number' description="Maximum allowed clients">
<value>10000</value>
</variable>
<variable name='rdCliOutBuffHardLimit' type='number' description="Client output buffer hard limit (for slave)">
<value>512</value>
</variable>
<variable name='rdCliOutBuffSoftLimit' type='number' description="Client output buffer soft limit (for slave)">
<value>256</value>
</variable>
<variable name='rdSaveDisable' type='oui/non' description="Désactiver la presistence des données sur les maitres">
<variable name='rdSaveDisable' type='oui/non' description="Désactiver la persistence des données sur les maitres et esclaves">
<value>non</value>
</variable>
<variable name='rdAOFDisable' type='oui/non' description="Désactiver la sauvegarde AOF sur les maitres et esclaves">
<value>non</value>
</variable>
</family>
<separators>
<separator name='redisInstanceName'>Instance Principale</separator>
@ -141,14 +153,32 @@
<condition name='disabled_if_in' source='redisMode'>
<param>Local</param>
<target type='variable'>redisRole</target>
<target type='variable'>redisInstanceName</target>
<target type='variable'>redisSlaveInstance</target>
<target type='filelist'>redisCl</target>
<target type='variable'>redisClPort</target>
</condition>
<condition name='disabled_if_in' source='redisMode'>
<param>Local avec slave distant</param>
<target type='variable'>redisRole</target>
<target type='variable'>redisInstanceName</target>
<target type='variable'>redisSlaveInstanceName</target>
<target type='variable'>redisSlaveInstanceMaster</target>
<target type='variable'>redisClPortSlave</target>
<target type='variable'>redisClPort</target>
</condition>
<condition name='disabled_if_not_in' source='redisMode'>
<param>Local avec slave distant</param>
<target type='variable'>redisMasterIPSlave</target>
<target type='variable'>redisMasterPortSlave</target>
</condition>
<condition name='disabled_if_in' source='redisRole'>
<param>Node</param>
<target type='filelist'>redisCl</target>
<target type='variable'>redisInstanceName</target>
<target type='variable'>rdClMember</target>
<target type='variable'>rdClMemberIP</target>
<target type='variable'>rdClMemberPort</target>
@ -188,7 +218,7 @@
<param>['Leader','Node']</param>
</check>
<check name="valid_enum" target="redisMode">
<param>['Local','Cluster']</param>
<param>['Local', 'Local avec slave distant', 'Cluster']</param>
</check>
<check name="valid_enum" target="rdClMemberRole">
<param>['master','slave']</param>
@ -214,35 +244,18 @@
<param>slave</param>
</auto>
<fill name='intAdd' target='rdClMemberSlavePort'>
<param type='eole' name='num1'>rdClMemberPort</param>
<param name='num2'>2000</param>
</fill>
<fill name='calc_val' target='redisInstanceName'>
<param type='eole' name='valeur'>nom_machine</param>
</fill>
<fill name='intAdd' target='redisClPort'>
<param type='eole' name='num1'>redisPort</param>
<param name='num2'>10000</param>
</fill>
<fill name='intAdd' target='redisPortSlave'>
<param type='eole' name='num1'>redisPort</param>
<param name='num2'>2000</param>
</fill>
<fill name='intAdd' target='redisClPortSlave'>
<param type='eole' name='num1'>redisPortSlave</param>
<param name='num2'>10000</param>
</fill>
<fill name='calc_val' target='redisMaxMemorySlave'>
<param type='eole' name='valeur'>redisMaxMemory</param>
</fill>
<fill name='calc_val' target='redisMemoryPolicySlave'>
<param type='eole' name='valeur'>redisMemoryPolicy</param>
</fill>
<fill name='calc_val' target='redisTCPKeepAliveSlave'>
<param type='eole' name='valeur'>redisTCPKeepAlive</param>
</fill>

View File

@ -14,12 +14,6 @@ Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=2755
ExecStartPre=-/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d
ExecStartPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-up.d
ExecStop=-/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d
ExecStop=/bin/kill -s TERM $MAINPID
ExecStopPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-down.d
UMask=007
PrivateTmp=yes
LimitNOFILE=65535
@ -29,7 +23,16 @@ ReadOnlyDirectories=/
ReadWriteDirectories=-/var/lib/redis
ReadWriteDirectories=-/var/log/redis
ReadWriteDirectories=-/var/run/redis
CapabilityBoundingSet=~CAP_SYS_PTRACE
NoNewPrivileges=true
CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE
MemoryDenyWriteExecute=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
# redis-server can write to its own config file when in cluster mode so we
# permit writing there by default. If you are not using this feature, it is

View File

@ -83,6 +83,12 @@ protected-mode no
# If port 0 is specified Redis will not listen on a TCP socket.
port %%redisPortSlave
%if %%redisMode == 'Local avec slave distant'
slaveof %%redisMasterIPSlave %%redisMasterPortSlave
%end if
# TCP listen() backlog.
#
# In high requests-per-second environments you need an high backlog in order
@ -199,9 +205,13 @@ databases 16
#
# save ""
%if %%rdSaveDisable == 'oui'
save ""
%else
save 900 1
save 300 10
save 60 10000
%end if
# By default Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and the latest background save failed.
@ -291,7 +301,7 @@ dir /var/lib/redis
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
#
# maxclients 10000
maxclients %%redisMaxClients
# Don't use more memory than the specified amount of bytes.
# When the memory limit is reached Redis will try to remove keys
@ -316,7 +326,7 @@ dir /var/lib/redis
# limit for maxmemory so that there is some free RAM on the system for slave
# output buffers (but this is not needed if the policy is 'noeviction').
#
maxmemory %{redisMaxMemory}mb
maxmemory %%{redisMaxMemory}mb
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached. You can select among five behaviors:
@ -372,7 +382,11 @@ maxmemory-policy %%redisMemoryPolicySlave
#
# Please check http://redis.io/topics/persistence for more information.
%if %%rdAOFDisable == 'oui'
appendonly no
%else
appendonly yes
%end if
# The name of the append only file (default: "appendonly.aof")
@ -488,6 +502,7 @@ aof-load-truncated yes
# Set it to 0 or a negative value for unlimited execution without warnings.
lua-time-limit 5000
%if %%getVar('redisMode','Local') == "Cluster"
################################ REDIS CLUSTER ###############################
#
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -595,6 +610,7 @@ cluster-require-full-coverage yes
# In order to setup your cluster make sure to read the documentation
# available at http://redis.io web site.
%end if
################################## SLOW LOG ###################################

View File

@ -295,7 +295,7 @@ dir /var/lib/redis
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
#
# maxclients 10000
maxclients %%redisMaxClients
# Don't use more memory than the specified amount of bytes.
# When the memory limit is reached Redis will try to remove keys
@ -320,7 +320,7 @@ dir /var/lib/redis
# limit for maxmemory so that there is some free RAM on the system for slave
# output buffers (but this is not needed if the policy is 'noeviction').
#
maxmemory %{redisMaxMemory}mb
maxmemory %%{redisMaxMemory}mb
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached. You can select among five behaviors:
@ -376,7 +376,12 @@ maxmemory-policy %%redisMemoryPolicy
#
# Please check http://redis.io/topics/persistence for more information.
%if %%rdAOFDisable == 'oui'
appendonly no
%else
appendonly yes
%end if
# The name of the append only file (default: "appendonly.aof")

2
tmpl/redis_sysctl.conf Normal file
View File

@ -0,0 +1,2 @@
net.core.somaxconn = 512