3.13 Redis安装及监控

1. Redis

1.1 Redis安装、配置

[root@130 src]# tar xf redis-5.0.7.tar.gz
[root@130 src]# cd redis-5.0.7
[root@130 redis-5.0.7]# make
[root@130 redis-5.0.7]# make install
[root@130 redis-5.0.7]# mkdir /etc/redis
[root@130 redis-5.0.7]# cp redis.conf /etc/redis/.		//复制配置文件到指定位置
[root@130 redis-5.0.7]# vim /etc/redis/redis.conf
	bind 192.168.80.130		//绑定ip地址
	port 6379				//绑定端口号
	requirepass 123456		//设置连接密码

//被监控服务器需执行以下命令,监控端可安装后无需启动
[root@130 redis-5.0.7]# nohup redis-server /etc/redis/redis.conf &		//启动缓存服务,并加载指定配置文件

1.2 Redis监控

语法: redis-cli [ OPTIONS ] [cmd [arg [arg …] ] ]
常用参数:

  • -h <hostname>
  • -p <port>
  • -s <socket>
  • -a <password>

redis-cli 详细使用方法请查看以下链接:

示例:

//监控需安装Redis,参考13.1,无需启动Redis服务

//无密码监控无法查看
[root@131 ~]# redis-cli -h 192.168.80.130 -p 6379
192.168.80.130:6379> keys *
(error) NOAUTH Authentication required.
192.168.80.130:6379>

//密码正确可正常监控
[root@131 ~]# redis-cli -h 192.168.80.130 -p 6379 -a 123456
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.80.130:6379> keys *
(empty list or set)
发布了50 篇原创文章 · 获赞 8 · 访问量 1884

猜你喜欢

转载自blog.csdn.net/Yusyang_/article/details/103839422