windows上的redis链接linux上的redis服务

学习redis,今天遇到windows客户端无法链接linux上的服务的问题,查资料解决,过程如下。

linux上打开redis.conf文件,

1,将127.0.0.1这行给注释掉,(该行使其默认只有本机可以连接)

2,将protected-mod yes 修改为protected-mod no ,关闭保护模式,可以接受其他机器的访问。

3,关闭防火墙,我的linux是centos7,它的默认防火墙是firewalld,因为不熟悉,先将他换成centos6中的iptables,然后关闭防火墙,操作如下。

[root@d ~]# systemctl stop firewalld // 关闭firewalld服务
[root@d ~]# systemctl disable firewalld // 禁止开机启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@d ~]# yum install -y iptables-services  // 安装iptables-service
[root@d ~]# systemctl enable iptables //让它开机启动
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
[root@d ~]# systemctl start iptables 启动服务。
[root@d ~]# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT  // 添加一条规则

[root@d ~]# service iptables restart // 重启服务
 

至此,重启redis服务即可在windows上链接,命令如下。

D:\redis\redis-64.3.0.503>redis-cli.exe -h 192.168.0.106 -p 6379

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值