# Redis
## Refs
[The Little Redis Book](https://github.com/karlseguin/the-little-redis-book)
[https://github.com/redis/redis/blob/unstable/redis.conf](https://github.com/redis/redis/blob/unstable/redis.conf)
[https://stackoverflow.com/questions/27735411/understanding-latency-using-redis-cli](https://stackoverflow.com/questions/27735411/understanding-latency-using-redis-cli)
[https://www.compose.com/articles/mastering-redis-high-availability-and-blocking-connections/](https://www.compose.com/articles/mastering-redis-high-availability-and-blocking-connections/)
## Run Redis
```bash
docker volume create redis
docker run --name redis -d \
--restart=always \
-v redis:/data \
-p 127.0.0.1:6379:6379 \
redis redis-server --appendonly yes
```
## Redis CLI
```bash
docker run --rm redis:5 redis-cli --help
redis-cli -h test.example.com -p 6379 PING
redis-cli -h test.example.com -p 6379 -a secret PING
```
Test latency ([docs](https://redis.io/docs/reference/optimization/latency/))
```bash
redis-cli -h test.example.com -p 6379 --intrinsic-latency 100
```
## Monitor with Grafana
[Redis Plugin](https://grafana.com/grafana/plugins/redis-datasource/?tab=installation)
[Redis Dashboard](https://grafana.com/grafana/dashboards/12776-redis/)
Install plugin
```bash
grafana-cli plugins install redis-datasource
```
Import Dashboard with id `12776`