一、安装redis
sudo apt install redis-server
二、配置redis
sudo vim /etc/redis/redis.conf
可以输入“:?supervised”找到supervised指令,指令默认为no,改为systemd
# If you run Redis from upstart or systemd, Redis can interact with your # supervision tree. Options: # supervised no - no supervision interaction # supervised upstart - signal upstart by putting Redis into SIGSTOP mode # supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET # supervised auto - detect upstart or systemd method based on # UPSTART_JOB or NOTIFY_SOCKET environment variables # Note: these supervision methods only signal "process is ready." # They do not enable continuous liveness pings back to your supervisor. supervised systemd
重启redis:
sudo service redis-server restart
查看redis启动状态:
ps -ef|grep redis
三、redis远程连接
打开配置文件:
sudo vim /etc/redis/redis.conf
将 bind 127.0.0.1 ::1 改为 bind 0.0.0.0
之后重新启动 redis
四、redis设置密码
打开 Redis 的配置文件
sudo vim /etc/redis/redis.conf
找到下面这一行:
# requirepass foobared
将注释符号去掉,将后面呢修改成自己的密码,如:
requirepass 123456