修改Redis中bind地址

昨天刚装完redis,今天想通过eclipse去实现一些业务场景,发现被服务器拒绝连接了,然后想到应该是自己的IP变掉了,然后想去redis.conf里面去修改下bind

  [root@localhost /]# cd redis/redis-5.0.3/
    [root@localhost redis-5.0.3]# ls
    00-RELEASENOTES  CONTRIBUTING  deps     Makefile   README.md   runtest          runtest-sentinel  src    utils
    BUGS             COPYING       INSTALL  MANIFESTO  redis.conf  runtest-cluster  sentinel.conf     tests
	[root@localhost redis-5.0.3]# vi redis.conf

?bind 然后回车,按n向上搜索

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1

# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.

并没有昨天绑定的IP,然后想去etc目录去找下,果然,里面有个昨天我安装redis时修改的配置文件

	[root@localhost redis]# cd /etc/redis
    [root@localhost redis]# ls
	 6379.conf
    [root@localhost redis]#      

然后去里面找到昨天bind的地址,把它修改成自己要连的IP就好了

  [root@localhost redis]# vi 6379.conf 

?bind,然后回车,按n,向上搜索,果然被我找到了

  # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1 192.168.160.128

# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.

去客户端查下:

127.0.0.1:6379> CONFIG GET bind
1) "bind"
2) "127.0.0.1 192.168.160.128"
127.0.0.1:6379> 

然后就有结果了,之后就能正常连接。(初学redis,服务器在自己电脑上,会出现这样的问题,感觉以后去公司应该就不会碰到这样的问题了)

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值