Redis 开启远程连接

默认 bind 127.0.0.1 即绑定本机 IP,只能本机访问,你也可以绑定别的 IP 地址,如果注释掉,表示不限制 IP,所有 IP 都能访问

# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# bind 127.0.0.1

 验证, *:6379 表示任意 IP:6379 均可访问

[root@mch ~]# ps -ef | grep redis
 root      2175     1  0 08:15 ?        00:00:05 /usr/local/bin/redis-server *:6379

 

posted @ 2018-08-06 17:11  huanggy  阅读(170)  评论(0编辑  收藏  举报