Removed options that are not vital, added an `extraConfig` for any
additional configuration options for flexibility.
This commit is contained in:
parent
bcf3a7bbf6
commit
a1c159bc4c
|
@ -12,39 +12,20 @@ let
|
|||
port ${toString cfg.port}
|
||||
${condOption "bind" cfg.bind}
|
||||
${condOption "unixsocket" cfg.unixSocket}
|
||||
${condOption "unixsocketperm" cfg.unixSocketPerm}
|
||||
timeout ${toString cfg.timeout}
|
||||
tcp-keepalive ${toString cfg.tcpKeepAlive}
|
||||
loglevel ${cfg.logLevel}
|
||||
logfile ${cfg.logfile}
|
||||
databases ${toString cfg.databases}
|
||||
${concatMapStrings (d: "save ${toString (builtins.elemAt d 0)} ${toString (builtins.elemAt d 1)}\n") cfg.save}
|
||||
stop-writes-on-bgsave-error ${redisBool cfg.stopWritesOnBgSaveError}
|
||||
rdbcompression ${redisBool cfg.rdbCompression}
|
||||
rdbchecksum ${redisBool cfg.rdbChecksum}
|
||||
dbfilename ${cfg.dbFilename}
|
||||
dir ${toString cfg.dbpath}
|
||||
${if cfg.slaveOf != null then "slaveof ${cfg.slaveOf.ip} ${toString cfg.slaveOf.port}" else ""}
|
||||
${condOption "masterauth" cfg.masterAuth}
|
||||
slave-serve-stale-data ${redisBool cfg.slaveServeStaleData}
|
||||
slave-read-only ${redisBool cfg.slaveReadOnly}
|
||||
repl-ping-slave-period ${toString cfg.replPingSlavePeriod}
|
||||
repl-timeout ${toString cfg.replTimeout}
|
||||
repl-disable-tcp-nodelay ${redisBool cfg.replDisableTcpNodelay}
|
||||
slave-priority ${toString cfg.slavePriority}
|
||||
${condOption "requirepass" cfg.requirePass}
|
||||
${concatMapStrings (c: "rename-command ${c} ${getAttr c cfg.renameCommand}\"\n") (attrNames cfg.renameCommand)}
|
||||
maxclients ${toString cfg.maxClients}
|
||||
${condOption "maxmemory" cfg.maxMemory}
|
||||
maxmemory-policy ${cfg.maxMemoryPolicy}
|
||||
appendOnly ${redisBool cfg.appendOnly}
|
||||
appendfsync ${cfg.appendFsync}
|
||||
no-appendfsync-on-rewrite ${redisBool cfg.noAppendFsyncOnRewrite}
|
||||
auto-aof-rewrite-percentage ${toString cfg.autoAofRewritePercentage}
|
||||
auto-aof-rewrite-min-size ${toString cfg.autoAofRewriteMinSize}
|
||||
lua-time-limit ${toString cfg.luaTimeLimit}
|
||||
slowlog-log-slower-than ${toString cfg.slowLogLogSlowerThan}
|
||||
slowlog-max-len ${toString cfg.slowLogMaxLen}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
@ -93,24 +74,6 @@ in
|
|||
example = "/var/run/redis.sock";
|
||||
};
|
||||
|
||||
unixSocketPerm = mkOption {
|
||||
default = null;
|
||||
description = "Permissions for the socket";
|
||||
};
|
||||
|
||||
timeout = mkOption {
|
||||
default = 0;
|
||||
description = "Close the connection after a client is idle for N seconds (0 to disable)";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
tcpKeepAlive = mkOption {
|
||||
default = 0;
|
||||
description = "If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence of communication.";
|
||||
example = 60;
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
logLevel = mkOption {
|
||||
default = "notice"; # debug, verbose, notice, warning
|
||||
example = "debug";
|
||||
|
@ -137,23 +100,6 @@ in
|
|||
example = [ [900 1] [300 10] [60 10000] ];
|
||||
};
|
||||
|
||||
stopWritesOnBgSaveError = mkOption {
|
||||
default = true;
|
||||
description = "This will make the user aware (in an hard way) that data is not persisting on disk properly, otherwise chances are that no one will notice and some disaster will happen.";
|
||||
};
|
||||
|
||||
rdbCompression = mkOption {
|
||||
default = true;
|
||||
description = "Compress string objects using LZF when dump .rdb databases";
|
||||
type = with types; bool;
|
||||
};
|
||||
|
||||
rdbChecksum = mkOption {
|
||||
default = true;
|
||||
description = "This makes the format more resistant to corruption but there is a performance hit to pay (around 10%) when saving and loading RDB files";
|
||||
type = with types; bool;
|
||||
};
|
||||
|
||||
dbFilename = mkOption {
|
||||
default = "dump.rdb";
|
||||
description = "The filename where to dump the DB";
|
||||
|
@ -179,71 +125,12 @@ in
|
|||
process, otherwise the master will refuse the slave request.'';
|
||||
};
|
||||
|
||||
slaveServeStaleData = mkOption {
|
||||
default = true;
|
||||
description = "Whether or not to serve data (as a slave) when data is still (not yet in sync)";
|
||||
type = with types; bool;
|
||||
};
|
||||
|
||||
slaveReadOnly = mkOption {
|
||||
default = true;
|
||||
description = "Configure whether this slave instance should accept writes or not";
|
||||
type = with types; bool;
|
||||
};
|
||||
|
||||
replPingSlavePeriod = mkOption {
|
||||
default = 10;
|
||||
description = "Slaves send PINGs to server in a predefined interval, configure the number of seconds that this PING should occur.";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
replTimeout = mkOption {
|
||||
default = 60;
|
||||
description = "Sets a timeout for both Bulk transfer I/O timeout and master data or ping response timeout";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
replDisableTcpNodelay = mkOption {
|
||||
default = false;
|
||||
description = "Disable TCP_NODELAY on the slave socket after SYNC";
|
||||
type = with types; bool;
|
||||
};
|
||||
|
||||
slavePriority = mkOption {
|
||||
default = 100;
|
||||
description = "Priority to be promoted to new master by Redis sentinel";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
requirePass = mkOption {
|
||||
default = null;
|
||||
description = "Password for database";
|
||||
example = "letmein!";
|
||||
};
|
||||
|
||||
renameCommand = mkOption {
|
||||
default = {}; # oldname = newname
|
||||
description = "Attribute set to rename commands e.g. for security reasons.";
|
||||
example = { config = "123haefhahefconfig"; };
|
||||
};
|
||||
|
||||
maxClients = mkOption {
|
||||
default = 10000;
|
||||
description = "Maximum number of concurrent clients.";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
maxMemory = mkOption {
|
||||
default = null; # in bytes
|
||||
description = "Maximum number of bytes of memory to use";
|
||||
};
|
||||
|
||||
maxMemoryPolicy = mkOption {
|
||||
default = "volatile-lru";
|
||||
description = "Policy to handle running out of memory, options: allkeys-lru, volatile-random, allkeys-random, volatile-ttl, noeviction";
|
||||
type = with types; string;
|
||||
};
|
||||
|
||||
appendOnly = mkOption {
|
||||
default = false;
|
||||
description = "By default data is only periodically persisted to disk, enable this option to use an append-only file for improved persistence.";
|
||||
|
@ -262,30 +149,6 @@ in
|
|||
type = with types; string;
|
||||
};
|
||||
|
||||
noAppendFsyncOnRewrite = mkOption {
|
||||
default = false;
|
||||
description = "Do not allow fsyncing of append-only log during rewrites";
|
||||
type = with types; bool;
|
||||
};
|
||||
|
||||
autoAofRewritePercentage = mkOption {
|
||||
default = 100;
|
||||
description = "Automatically rewrite (= reduce size) of append-only file when file grows with this percentage.";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
autoAofRewriteMinSize = mkOption {
|
||||
default = "64mb";
|
||||
description = "Minimal size to start rewriting.";
|
||||
type = with types; string;
|
||||
};
|
||||
|
||||
luaTimeLimit = mkOption {
|
||||
default = 5000;
|
||||
description = "Maximum execution time for Lua scripts in milliseconds";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
slowLogLogSlowerThan = mkOption {
|
||||
default = 10000;
|
||||
description = "Log queries whose execution take longer than X in milliseconds";
|
||||
|
@ -298,6 +161,12 @@ in
|
|||
description = "Maximum number of items to keep in slow log";
|
||||
type = with types; int;
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
description = "Extra configuration options for redis.conf";
|
||||
type = with types; string;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue