3Centos7 安装redis · SpringCloud微服务实战 · 看云

导航


下载

wget http://download.redis.io/releases/redis-4.0.10.tar.gz

解压

tar xzf redis-4.0.10.tar.gz

进入目录

cd redis-4.0.10

安装

make

等待2分钟

修改redis.conf

vim redis.conf

开启后台模式

daemonize no 设置为yes

设置密码

requirepass mypassword(自己的密码)

注释掉绑定ip

绑定限制的ip,如果让redis可以任意访问,注释掉即可

bind 127.0.0.1

保护模式

protected-mode no 设置为yes

启动

src/redis-server ./redis.conf

看到以下信息即成功

26430:C 14 Dec 17:43:30.176 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
26430:C 14 Dec 17:43:30.177 # Redis version=4.0.10, bits=64, commit=00000000, modified=0, pid=26430, just started
26430:C 14 Dec 17:43:30.177 # Configuration loaded

防火墙添加端口

vi  /etc/sysconfig/iptables
# 然后添加
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT

重启防火墙

service iptables restart

成功

30d4114d7a196a03b2e3f5e3bb2c4385_MD5.png