怎样使redis可以远程访问


本文摘自PHP中文网,作者V,侵删。

导语:

我们都知道redis默认只允许本地访问,那么我们如果要使redis可以远程访问该如何做呢?

具体方法:

打开redis.conf文件在NETWORK部分有说明

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

################################## NETWORK #####################################

  

# 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

#

# ~~~ 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

解决办法:注释掉bind 127.0.0.1可以使所有的ip访问redis

若是想指定多个ip访问,但并不是全部的ip访问,可以bind

注意

阅读剩余部分

相关阅读 >>

通过Redis实现服务器崩溃宕机的数据恢复

Redis性能为什么高

es和Redis区别

Redis哨兵模式是集群吗

Redis如何实现限流?3种实现方式介绍

为什么用Redis缓存

教你通过homebrew安装配置Redis

Redis中setex命令和set命令有什么区别

如何让Redis在后台运行

Redis为什么性能好

更多相关阅读请进入《Redis》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...