CentOS6 安装redis
//如果没有yum源
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum install -y http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install redis
启动
service redis start
or
nohup redis-server > /dev/null 2>&1 &
客户端
redis-cli
配置文件
/etc/redis.conf
修改为允许远程连接
bind ip注释掉
protected-mode no
打开防火墙端口,
vim /etc/sysconfig/iptables
追加
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
重启防火墙,重启redis
service iptables restart
service redis restart
如果发现redis没有重启,
ps -ef | grep redis
找到,kill, start
远程测试
redis-cli -h 192.168.2.22
关注我的公众号
![](https://images2018.cnblogs.com/blog/686418/201808/686418-20180822091328437-1109977663.jpg)