修改Redis中bind地址
阿新 • • 發佈:2018-12-28
昨天剛裝完redis,今天想通過eclipse去實現一些業務場景,發現被伺服器拒絕連線了,然後想到應該是自己的IP變掉了,然後想去redis.conf裡面去修改下bind
[[email protected] /]# cd redis/redis-5.0.3/
[[email protected] 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
[ [email protected] 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時修改的配置檔案
[[email protected] redis]# cd /etc/redis
[[email protected] redis]# ls
6379.conf
[[email protected] redis]#
然後去裡面找到昨天bind的地址,把它修改成自己要連的IP就好了
[[email protected] 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,伺服器在自己電腦上,會出現這樣的問題,感覺以後去公司應該就不會碰到這樣的問題了)