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)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章