Version v1.5.1 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.
Redis Deploy & Monitor
Pigsty is also a universal application runtime that could be used for deploying & monitoring other databases and applications, such as Redis.
It takes two steps to deploy a Redis cluster:
- Declare it
- Execute playbook
Define Redis
E-R Model
The Redis entity conceptual model is almost identical to [PostgreSQL]c-pgsql.md#ER-Model), and also includes the concepts of Cluster and Instance. Note that the concept of Cluster here does not refer to the clusters in Redis’ native clustering scheme.
The core difference is that Redis is typically deployed in a single multi-instance deployment, with many Redis instances typically deployed on a single physical/virtual machine node to take advantage of multi-core CPUs. therefore, how Redis instances are defined is slightly different from PGSQL.
In Pigsty-managed Redis, the nodes are fully subordinate to the cluster, i.e. it is not currently allowed to deploy two Redis instances from different clusters on a single node, but this does not prevent you from deploying multiple independent Redis instances on a single node.
Redis Identity
The identity parameters are the information that must be provided when defining a Redis cluster and include.
| name | attributes | description | example |
|---|---|---|---|
redis_cluster |
must, cluster level | cluster-name | redis-test |
redis_node |
must, node level | node number | 1,2 |
redis_instances |
MUST, node level | instance definition | { 6001 : {} ,6002 : {}} |
redis_clusteridentifies the name of the Redis cluster, configured at the cluster level, and serves as the top-level namespace for cluster resources.redis_nodeidentifies the serial number of the node in the clusterredis_instancesis a JSON object with the Key as the instance port number and the Value as a JSON object containing the instance-specific configuration
Redis Cluster Definition
Given below are three condensed definitions of Redis clusters, including.
- A 1-node, 3-instance Redis Sentinel cluster
redis-sentinel - A 2-node, 12-instance Redis Cluster
redis-cluster - A 1-node, one-master-two-slave Redis Standalone cluster
redis-standalone
You need to assign a unique port number to the Redis instance on the node.
Create Cluster
Deployment script
Create a Redis instance/cluster using the script redis.yml
Notes
Although this is not the recommended behavior, you can deploy PostgreSQL with Redis in a mixed deployment to make the most of machine resources.
The redis.yml script will deploy the Redis Monitor Exporter on the machine at the same time, including redis_exporter and node_exporter (optional)
During this process, the machine’s node_exporter will be redeployed if it exists.
By default, Prometheus will use the “multi-target crawl” mode, using the Redis Exporter on port 9121 on the node to crawl all Redis instances on that node.
Redis Monitoring
Pigsty currently provides 3 Redis monitoring panels as part of a standalone monitoring application REDIS, which are.
- Redis Overview: provides a global overview of Redis across the entire environment
- Redis Cluster: focuses on monitoring information for a single Redis business cluster
- Redis Instance: provides detailed monitoring information about a single Redis instance
You can use the included redis-benchmark test
CAVEAT
Pigsty v1.5.1 supports whole-cluster Redis deployment and monitoring, and the tagged redis.yml/redis-remove.yml playbooks also target one instance with -e redis_port=<port>.
Offline, scale-up, scale-down, and single-instance management features will be provided in subsequent versions gradually.