先进/usr/local/bin目录下
[root@hadoop100 bin]# pwd /usr/local/bin [root@hadoop100 bin]# ll 总用量 15456 -rwxr-xr-x. 1 root root 4589155 3月 6 19:30 redis-benchmark -rwxr-xr-x. 1 root root 22217 3月 6 19:30 redis-check-aof -rwxr-xr-x. 1 root root 45435 3月 6 19:30 redis-check-dump -rwxr-xr-x. 1 root root 4693114 3月 6 19:30 redis-cli lrwxrwxrwx. 1 root root 12 3月 6 19:30 redis-sentinel -> redis-server -rwxr-xr-x. 1 root root 6466389 3月 6 19:30 redis-server
redis的启动
[root@hadoop100 bin]# redis-server /myredis/redis.conf
启动客户端
[root@hadoop100 bin]# redis-cli -p 6379
127.0.0.1:6379> keys * (empty list or set) 127.0.0.1:6379> set s1 1 OK 127.0.0.1:6379> get s1 "1" 127.0.0.1:6379> select 1 OK 127.0.0.1:6379[1]> keys * (empty list or set) 127.0.0.1:6379[1]> set s1 =22 OK 127.0.0.1:6379[1]> get s1 "=22" 127.0.0.1:6379[1]>
关闭redis
[root@hadoop100 bin]# redis-cli -p 6379 127.0.0.1:6379> SHUTDOWN not connected> exit [root@hadoop100 bin]#
127.0.0.1:6379[2]> config get requirepass 1) "requirepass" 2) "" 127.0.0.1:6379[2]> config get dir 1) "dir" 2) "/usr/local/bin" 127.0.0.1:6379[2]>
设置密码
127.0.0.1:6379> config get requirepass 1) "requirepass" 2) "" 127.0.0.1:6379> config set requirepass "123456" OK 127.0.0.1:6379> ping (error) NOAUTH Authentication required. 127.0.0.1:6379> auth 123456 OK 127.0.0.1:6379> ping PONG 127.0.0.1:6379>