Redis3.2开启远程访问

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介: Redis3.2开启远程访问 环境 安装环境:win7系统  Redis版本:3.2.100  安装模式:msi文件安装 开启远程访问 Redis安装完之后,在服务中可以看到对应的Redis服务,打开属性,可以看到“可执行文件的路径”是:”D:\Program Files\Redis\redis-server.

Redis3.2开启远程访问

环境

安装环境:win7系统 
Redis版本:3.2.100 
安装模式:msi文件安装

开启远程访问

Redis安装完之后,在服务中可以看到对应的Redis服务,打开属性,可以看到“可执行文件的路径”是:”D:\Program Files\Redis\redis-server.exe” –service-run “D:\Program Files\Redis\redis.windows-service.conf” 
开启Redis远程访问的步骤如下:

  1. 打开redis.windows-service.conf
  2. 找到“bind 127.0.0.1”并在前面加#注释
  3. 找到“protected-mode yes”并改为“protected-mode no”

配置如下:

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

# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
#    "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
protected-mode no
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43

解决的过程

由于百度得到的答案基本都是说把“bind 127.0.0.1”注释掉就可以了,根据配置文件的描述,也确实是要注释掉才可以被其他机器访问到,配置完重启,通过其他机器的redis-cli客户端进行连接,连接命令:redis-cli -h 172.16.8.200 -p 6379 
意外的发现竟然连上了,于是随表敲一个命令,比如info,出现了如下提示: 
这里写图片描述 
通过阅读提示,在配置文件中找到protected-mode,并将其值改为no,重启之后,问题解决了。

原文地址https://blog.csdn.net/u010956470/article/details/64440983

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
NoSQL Ubuntu 网络安全
docker安装redis并允许远程访问
docker安装redis并允许远程访问
docker安装redis并允许远程访问
|
8月前
|
NoSQL Redis
redis设置允许远程访问-redis(2)
redis设置允许远程访问-redis(2)
78 0
|
弹性计算 NoSQL 网络安全
服务器上部署redis无法远程访问的问题
将redis部署至ECS上后,在自己本地上无法访问到redis server,redis 的默认端口6379远程访问不可用。
1099 1
服务器上部署redis无法远程访问的问题
|
NoSQL Redis 数据安全/隐私保护
|
NoSQL 数据库 Redis
Redis、MongoDB实现远程访问
修改redis.conf: sudo vi /etc/redis/redis.conf 将绑定主机这条注释掉: # bind 127.0.0.1 保护模式改为no: protected-mode no 打开文件mongodb.
729 0
|
NoSQL Redis 安全
redis开启远程访问
redis默认只允许本地访问,要使redis可以远程访问可以修改redis.conf   打开redis.conf文件在NETWORK部分有说明   ################################## NETWORK ###############################...
1235 0
|
13天前
|
NoSQL Linux Redis
06- 你们使用Redis是单点还是集群 ? 哪种集群 ?
**Redis配置:** 使用哨兵集群,结构为1主2从,加上3个哨兵节点,总计分布在3台Linux服务器上,提供高可用性。
33 0
|
21天前
|
负载均衡 监控 NoSQL
Redis的集群方案有哪些?
Redis集群包括主从复制(基础,手动故障恢复)、哨兵模式(自动高可用)和Redis Cluster(官方分布式解决方案,自动分片和容错)。此外,还有如Codis、Redisson和Twemproxy等第三方工具用于代理和负载均衡。选择方案需考虑应用场景、数据规模和并发需求。
31 2

热门文章

最新文章