1、下載:redis.io,我下載的是5.0.
2、安裝
1)、tar -zxvf redis-5.0.0
2)、進入src目錄,執行make
3、回退到src的上一級目錄,編輯redis.conf
1)、protected-mode no
2)、注釋掉bind 127.0.0.1
3)、修改密碼為:requirepass 123456
4、啟動
進入src目錄,./redis-server ../redis.conf
一定要指定redis.conf ,否則客戶端連不上。
5、客戶端操作
[root@cent7-zuoys src]# ./redis-cli 127.0.0.1:6379> get zuo:1 (error) NOAUTH Authentication required. 127.0.0.1:6379> auth "123456" OK