REDIS Config

Describe the redis cluster you want with redis config

IDNameSectionTypeLevelComment
700redis_clusterREDIS_IDENTITYstringCredis cluster identity
701redis_nodeREDIS_IDENTITYintIredis node identity
702redis_instancesREDIS_IDENTITYinstance[]Iredis instances definition on this node
710redis_fs_mainREDIS_NODEpathCmain data disk for redis
711redis_exporter_enabledREDIS_NODEboolCinstall redis exporter on redis nodes
712redis_exporter_portREDIS_NODEintCdefault port for redis exporter
713redis_exporter_optionsREDIS_NODEstringC/Idefault cli args for redis exporter
720redis_safeguardREDIS_PROVISIONboolCset to true to disable purge
721redis_cleanREDIS_PROVISIONboolCpurge existing redis during init
722redis_rmdataREDIS_PROVISIONboolCremove redis data dir with it?
723redis_modeREDIS_PROVISIONenumCstandalone,cluster,sentinel
724redis_confREDIS_PROVISIONstringCwhich config template will be used
725redis_bind_addressREDIS_PROVISIONipCe.g 0.0.0.0, empty will use inventory_hostname as bind address
726redis_max_memoryREDIS_PROVISIONsizeC/Imax memory used by each redis instance
727redis_mem_policyREDIS_PROVISIONenumCmemory eviction policy
728redis_passwordREDIS_PROVISIONstringCempty password disable password auth (masterauth & requirepass)
729redis_rdb_saveREDIS_PROVISIONstring[]CRDB save cmd, disable with empty array
730redis_aof_enabledREDIS_PROVISIONboolCenable redis AOF
731redis_rename_commandsREDIS_PROVISIONobjectCrename dangerous commands
732redis_cluster_replicasREDIS_PROVISIONintChow much replicas per master in redis cluster ?

REDIS_IDENTITY

Identity parameters are the information that must be provided to define a Redis cluster, including:

NameLevelDescriptionExample
redis_clusterMUST, cluster levelCluster nameredis-test
redis_nodeMUST, node levelNode Numberprimary, replica
redis_instancesMUST, node levelIns Definition{ 6001 : {} ,6002 : {}}
  • redis_cluster identifies the Redis cluster name, configured at the cluster level, and serves as the top-level namespace for cluster resources.
  • redis_node identifies the serial number of the node in the cluster.
  • redis_instances is a JSON object with the Key as the ins port and the Value as a JSON object containing the instance-specific config.

redis_cluster

Redis cluster identity, type: string, level: C, default value:

Redis cluster identity will be used as a namespace for resources within the cluster and needs to follow specific naming patterns: [a-z][a-z0-9-]* to be compatible with different constraints on identity identification. It is recommended to use redis- as the cluster name prefix.

Identity param is required params and cluster-level params.

redis_node

Redis node identity, type: int, level: I, default value:

Redis node identity, unique in the cluster, is used to distinguish and identify different nodes, starting with an assignment of 0 or 1.

redis_instances

Redis instances definition on this node, type: instance[], level: I, default value.

This database node deployed all Redis ins in JSON K-V object format. The key is the numeric type port number, and the value is the JSON config entry specific to that instance.

Sample example:

  1. redis_instances: { 6501 : {} ,6502 : {} ,6503 : {} ,6504 : {} ,6505 : {} ,6506 : {} }
  2. redis_instances:
  3. 6501: {}
  4. 6502: { replica_of: '10.10.10.13 6501' }
  5. 6503: { replica_of: '10.10.10.13 6501' }

Each Redis ins listens on a unique port on the node. You can configure separate parameter options for Redis ins (currently, only replica_of is supported for pre-built M-S replication).

Identity params required params and instance-level params.


REDIS_NODE

redis_fs_main

Primary data disk for Redis, type: path, level: C, default value: "/data".

Pigsty will create the redis dir under that dir to store Redis data. For example, /data/redis.

See FHS: Redis for details.

redis_exporter_enabled

Enable Redis exporter, type: bool, level: C, default: true.

Redis Exporter is enabled by default, one on each Redis node deployed and listens on port 9121 by default.

redis_exporter_port

Redis Exporter listens port, type: int, tier: C, default value: 9121.

Note: If you modify this default port, you will need to replace this port along with the relevant config rule file in Prometheus.

redis_exporter_options

Redis Exporter command parameter, type: string, level: C/I, default value: "".


REDIS_PROVISION

redis_safeguard

Disable erasure of existing Redis, type: string, level: C, default value: false.

if true, redis.yml and redis-remove.yml will not remove running redis instance

redis_clean

What to do when Redis exists, type: bool, level: C/A, default value: "false".

If true, redis.yml will purge existing instance during init.

redis_mode

Redis cluster mode, type: enum, level: C, default value: "standalone".

Specifies the mode of this Redis cluster, with three optional modes:

  • standalone: Default mode, deploys a series of independent Redis ins.
  • cluster: Redis native cluster mode
  • sentinel: Redis HA component: sentinel

Pigsty also sets up standalone Redis based on the replica_of parameter when using the standalone mode. Pigsty creates a native Redis cluster using all defined instances according to the redis_cluster_replicas parameter when using cluster mode.

redis_conf

Redis config template, type: string, level: C, default value: "redis.conf".

redis_bind_address

Redis listener address, type: ip, level: C, default value: "0.0.0.0".

Redis listener the IP, or inventory_hostname if left blank. The default listener has all local IPv4.

redis_max_memory

Max memory used by each Redis ins, type: size, level: C/I, default value: "1GB"

Max memory used by each Redis ins, default is 1GB; it is recommended to configure this parameter at the cluster level to keep the cluster ins config consistent.

redis_mem_policy

Memory eviction policy, type: enum, level: C, default value: "allkeys-lru".

Other optional policies include:

  • volatile-lru
  • allkeys-lru
  • volatile-lfu
  • allkeys-lfu
  • volatile-random
  • allkeys-random
  • volatile-ttl
  • noeviction

redis_password

Redis password, type: string, level: C, default value: "".

masterauth & requirepass password to use, leave blank to disable password, disabled by default.

Be careful with security, do not place Redis on the public network without password protection.

redis_rdb_save

RDB SAVE directives, type: string[], level: C, default value: [ "1200 1" ].

Redis SAVE directives, the config will enable RDB functionality, each Save policy as a string。

redis_aof_enabled

Enable AOF, type: bool, level: C, default value: false.

redis_rename_commands

Rename dangerous commands, Type: object, Level: C, Default value: {}.

JSON dictionary renames the command represented by Key to the command represented by Value to avoid misuse of dangerous commands.

redis_cluster_replicas

How many replicas per primary in Redis cluster, type: int, tier: C, default: 1.

  1. /bin/redis-cli --cluster create --cluster-yes \
  2. --cluster-replicas {{ redis_cluster_replicas|default(1) }}

Last modified 2022-06-04: fii en docs batch 2 (61bf601)