配置密码:在 redis.conf 中加入 requirepass yDvQ3t$hwoJvWree
配置密码后登录 redis:redis-cli -a ‘yDvQ3t$hwoJvWree’或: redis-cli 后 >> auth yDvQ3t$hwoJvWree
登录远程 redis:redis-cli -h 192.168.1.115 -p 6379
启动 redis:redis-server redis.conf &
启动 redis:nohup redis-server redis.conf &
附 nohup 说明:http://www.williamlong.info/archives/482.html
关闭 redis:src/redis-cli shutdown
配置密码后关闭 redis:redis-cli -a ‘yDvQ3t$hwoJvWree’ shutdown
配置数据持久化路径:redis.conf中dir /home/redis/redis-3.2.9/data/
这样可以避免在不同的目录里启动同一个 redis 时,造成没有使用上次持久化的数据,从而导致数据丢失