Asher has submitted this change and it was merged.

Change subject: make redis persistence model configurable, use aof in 
role::redisdb and rdb for sessions
......................................................................


make redis persistence model configurable, use aof in role::redisdb and rdb for 
sessions

Change-Id: I88fa394f574867e3ed9b9bfb912a7b70807a84b4
---
M manifests/role/redisdb.pp
M modules/redis/manifests/init.pp
M modules/redis/templates/redis.conf.erb
3 files changed, 15 insertions(+), 7 deletions(-)

Approvals:
  Asher: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/redisdb.pp b/manifests/role/redisdb.pp
index d1527c6..5c27ab8 100644
--- a/manifests/role/redisdb.pp
+++ b/manifests/role/redisdb.pp
@@ -17,6 +17,7 @@
 
        class { "::redis":
                maxmemory => $maxmemory,
+               persist => "aof",
                redis_replication => $redis_replication,
        }
 
diff --git a/modules/redis/manifests/init.pp b/modules/redis/manifests/init.pp
index 3c8c591..ddf51a2 100644
--- a/modules/redis/manifests/init.pp
+++ b/modules/redis/manifests/init.pp
@@ -2,10 +2,10 @@
 class redis (
        $port = 6379,
        $dir = "/a/redis",
-       $dbfilename = "dump.rdb",
        $maxmemory = "1GB",
        $maxmemory_policy = "volatile-lru",
        $maxmemory_samples = 5,
+       $persist = "rdb", # [ rdb, aof, both ]
        $redis_options = {},
        $redis_replication = undef,
        $package = "redis-server",
diff --git a/modules/redis/templates/redis.conf.erb 
b/modules/redis/templates/redis.conf.erb
index fddfa4a..95d44b4 100644
--- a/modules/redis/templates/redis.conf.erb
+++ b/modules/redis/templates/redis.conf.erb
@@ -37,7 +37,7 @@
 # unixsocketperm 755
 
 # Close the connection after a client is idle for N seconds (0 to disable)
-timeout 120
+timeout 60
 
 # Set server verbosity to 'debug'
 # it can be one of:
@@ -88,9 +88,13 @@
 #   like in the following example:
 #
 #   save ""
+<% if persist == "rdb" or persist == "both" -%>
 save 900 1
 save 300 100
-#save 60 10000
+save 60 10000
+<% else -%>
+# rdb disabled
+<% end -%>
 
 # By default Redis will stop accepting writes if RDB snapshots are enabled
 # (at least one save point) and the latest background save failed.
@@ -123,7 +127,7 @@
 rdbchecksum yes
 
 # The filename where to dump the DB
-dbfilename <%= dbfilename %>
+dbfilename <%= hostname %>-<%= port %>.rdb
 
 # The working directory.
 #
@@ -340,10 +344,13 @@
 # with the better durability guarantees.
 #
 # Please check http://redis.io/topics/persistence for more information.
+<% if persist == "aof" or persist == "both" -%>
+appendonly yes
+<% else -%>
 appendonly no
-
+<% end -%>
 # The name of the append only file (default: "appendonly.aof")
-# appendfilename appendonly.aof
+appendfilename <%= hostname %>-<%= port %>.aof
 
 # The fsync() call tells the Operating System to actually write data on disk
 # instead to wait for more data in the output buffer. Some OS will really flush
@@ -408,7 +415,7 @@
 # Specify a percentage of zero in order to disable the automatic AOF
 # rewrite feature.
 auto-aof-rewrite-percentage 100
-auto-aof-rewrite-min-size 64mb
+auto-aof-rewrite-min-size 512mb
 
 ################################ LUA SCRIPTING  ###############################
 

-- 
To view, visit https://gerrit.wikimedia.org/r/53873
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I88fa394f574867e3ed9b9bfb912a7b70807a84b4
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Asher <afeld...@wikimedia.org>
Gerrit-Reviewer: Asher <afeld...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to