连接REDIS

101上重新连接103并获取user.1.name的值

[root@linuxidc001 ~]# redis-cli -h 192.168.1.103 -p 6379  
redis 192.168.1.103:6379> get user.1.name  
(error) ERR operation not permitted  
redis 192.168.1.103:6379> 

为什么是error呢,当然是因为连接103时没传递密码了,退出重新连

redis 192.168.1.103:6379> quit  
[root@linuxidc001 ~]# redis-cli -h 192.168.1.103 -p 6379 -a "hi, coder"  
redis 192.168.1.103:6379> get user.1.name  
"zhangsan" 

看到zhangsan,说明你已经连接成功了。关于get、set    用法,可以直接看这里:http://redis.io/commands#string
原文地址:https://www.cnblogs.com/free3649/p/3772395.html