http://redisdoc.com/ redis 命令参考
$ wget http://download.redis.io/releases/redis-5.0.3.tar.gz
$ tar xzf redis-5.0.3.tar.gz
$ cd redis-5.0.3
$ make
The binaries that are now compiled are available in the src
directory. Run Redis with:
$ src/redis-server
You can interact with Redis using the built-in client:
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
要想运行远程登录
vi redis.conf
# bind 127.0.0.1 # 注释掉这句
# bind 127.0.0.1
# protected-mode yes # 修改这句
protected-mode no
远程连接redis : redis/src/redis-cli -h IP -p port
config get requirepass //获取当前密码
config set requirepass "yourpassword"
//设置当前密码,服务重新启动后又会置为默认,即无密码;不建议此种方式
修改redis.conf配置文件
requirepass yourpassword //此处注意,行前不能有空格
redis-cli -h 127.0.0.1 -p 6379 -a 123456 //需添加密码参数