Redis Topology Monitor
Supplemented by the blog post here.
Tools to help monitor and change the redis topology
Installation
Simply install from npm:
npm i -g redis-topology-monitor
Finding the current topology
Use the find-topology
command.
redis-topology-monitor find-topology -u redis://localhost:6379 -a password
npx redis-topology-monitor find-topology -u redis://localhost:6379 -a password
If you want to script using this, as of now, it is highly recommended that you fork this and modify the code to suit your purposes. This is a proof of concept. If you really want to use this directly, you can use the --raw
flag to get a json of the below shape in standard output. Note that standard error can still contain text, so you may want to pipe away standard error (for example, using 2>/dev/null
).
{
"id": "redis id",
"address": "redis address string",
"host": "host addr",
"port": port,
"cport": cport,
"role": "master" | "slave"
}
{
"status": "success",
"stats": [
{
"risk": 0,
"num_hosts": 0,
"max_on_same_host": 0,
"nodes": [],
"allocation": {
"host addr": [],
...
}
}
]
}
---
{
"status": "fail",
"reason": "reason string"
}