RedisInsight 是一个直观高效的 Redis GUI 管理工具,它可以对 Redis 的内存、连接数、命中率以及正常运行时间进行监控,并且可以在界面上使用 CLI 和连接的 Redis 进行交互(RedisInsight 内置对 Redis 模块支持):
https://docs.redis.com/latest/ri/
RedisInsight 提供的功能:
唯一支持 Redis Cluster 的 GUI 工具;
可以基于 Browser 的界面来进行搜索键、查看和编辑数据;
支持基于 SSL/TLS 的连接,同时还可以在界面上进行内存分析;
1)下载 RedisInsight 软件包:
https://redis.com/redis-enterprise/redis-insight/#insight-form
[[email protected] ~]# ls
anaconda-ks.cfg redisinsight-linux64-1.11.0
[[email protected] ~]# mkdir /usr/local/redisinsight
[[email protected] ~]# mv redisinsight-linux64-1.11.0 /usr/local/redisinsight/redisinsight-1.11.0
[[email protected] ~]# chmod +x /usr/local/redisinsight/redisinsight-1.11.0
2)配置 RedisInsight 的环境变量
[[email protected] ~]# echo "export REDISINSIGHT_HOST=192.168.1.1" >> ~/.bash_profile
[[email protected] ~]# echo "export REDISINSIGHT_HOST_DIR=/usr/local/redisinsight/.redisinsight" >> ~/.bash_profile
[[email protected] ~]# source ~/.bash_profile
注解:
REDISINSIGHT_PORT:配置 RedisInsight 的监听端口(default:8001)
REDISINSIGHT_HOST:配置 RedisInsight 的 IP 地址(default:0.0.0.0)
LOG_DIR:配置 RedisInsight 的日志存放路径(default:REDISINSIGHT_HOST_DIR)
REDISINSIGHT_HOST_DIR:配置 RedisInsight 的数据存放路径(default:~/.redisinsight)
3)启动 RedisInsight 服务
[[email protected] ~]# nohup /usr/local/redisinsight/redisinsight-linux64-1.4.0 & // 后台运行
[[email protected] ~]# ps aux | grep redis // 查看进程是否存在
1)创建 RedisInsight 的 yaml 文件:
[[email protected] ~]# vim redisinsight.yaml
apiVersion: v1
kind: Service
metadata:
name: redisinsight-service
spec:
type: NodePort
ports:
- port: 80
targetPort: 8001
nodePort: 31888
selector:
app: redisinsight
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redisinsight
labels:
app: redisinsight
spec:
replicas: 1
selector:
matachLabels:
app: redisinsight
template:
metadata:
labels:
app: redisinsight
spec:
containers:
- name: redisinsight
image: redislabs/redisinsight:1.7.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: db
mountPath: /db
ports:
- containerPort: 8001
protocol: TCP
volumes:
- name: db
emptyDir: {}
[[email protected] ~]# kubectl apply -f redisinsight.yaml
安装 Redis(已安装可直接跳过)
[[email protected] ~]# wget https://download.redis.io/releases/redis-6.2.6.tar.gz
[[email protected] ~]# tar zxf redis-6.2.6.tar.gz
[[email protected] ~]# cd redis-6.2.6
[[email protected] redis-6.2.6]# make PREFIX=/usr/local/redis install
[[email protected] redis-6.2.6]# sed -i '/^bind 127.0.0.1/s/127.0.0.1/192.168.1.1/g' redis.conf # 修改监听 IP
[[email protected] redis-6.2.6]# sed -i '/protected-mode/s/yes/no/g' redis.conf # 关闭保护模式
[[email protected] redis-6.2.6]# sed -i '/daemonize/s/no/yes/g' redis.conf # 开启后台运行
[[email protected] redis-6.2.6]# sed -i '/requirepass/s/foobared/123123/g' redis.conf # 配置密码
[[email protected] redis-6.2.6]# sed -i '/requirepass 123123/s/^#//g' redis.conf # 将密码前的 # 删除
[[email protected] redis-6.2.6]# cp redis.conf /usr/local/redis/
[[email protected] redis-6.2.6]# /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf # 启动 Redis
1)通过配置的 IP 和端口,来访问 RedisInsight 的管理界面:
2)在这里可以看到 Redis 的各种信息:
3)同时 RedisInsight 还可以在界面上进行操作:
4)还可以在界面上对 Redis 使用的内存进行分析:
好文推荐
欢迎关注 系统安全运维