redis如何配置两个IP?如何配置一个本地IP,一个内网IP?
2019-07-04
阅读数:2079
今天遇到这样一个情况,本来redis只在本地调用,配置了个127.0.0.1,但又想让内网的另外一台服务器被调用,如何配置?相当于要配置两个IP,一个本地的IP,一个内网的IP。
其实配置0.0.0.0就可以随意访问,但又不想让外网可以访问。可以按以下方式配置:
1、找到conf配置文件,找到大概以下位置
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
配置相应的两个IP即可,参照例子,两个IP中间需要有个空格,如下即可:
bind 127.0.0.1 172.18.187.97
好了,其实很简单,这个就是redis如何配置两个IP的解决办法,希望对您有用!
声明: 本文采用
BY-NC-SA 协议进行授权. 转载请注明转自:
redis如何配置两个IP?如何配置一个本地IP,一个内网IP?
相关评论