- redis 127.0.0.1:6379> keys *
- 1) "key2"
- 2) "test"
- 3) "name"
- 4) "myhash"
- 5) "mylist"
- redis 127.0.0.1:6379> type test
- string
- redis 127.0.0.1:6379> type mylist
- list
- redis 127.0.0.1:6379> type myhash
- hash
- redis 127.0.0.1:6379> monitor
- OK
- 1341712254.633378 "monitor"
- 1341712284.551501 "keys" "*"
- 1341712294.886231 (db 2) "select" "2"
- 1341712304.387199 (db 2) "get" "test"
- 1341712314.647020 (db 2) "type" "test"
- redis 127.0.0.1:6379> config set requirepass chen
- OK
- redis 127.0.0.1:6379> keys *
- (error) ERR operation not permitted
- redis 127.0.0.1:6379> auth chen
- OK
- redis 127.0.0.1:6379> keys *
- 1) "key2"
- 2) "test"
- 3) "name"
- 4) "myhash"
- 5) "mylist"
这里的pass需要设置密码,可以在配置文件里,也可以在在命令行中配置。那么ping其实就是用来测试是否通畅的,如果有密码那就ping不同了。
