redis默认只允许本地访问,要使redis可以远程访问可以修改redis.conf
 
打开redis.conf文件在NETWORK部分有说明
 
################################## 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
 
注意
下面还有个说明
 
# 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 yes
 
 
在redis3.2之后,redis增加了protected-mode,在这个模式下,即使注释掉了bind 127.0.0.1,再访问redisd时候还是报错,如下
 
(error) DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
 
修改办法:protected-mode no
 
查看版本号:
入redis-3.2.3目录,使用命令:cd redis-3.2.3,然后输入命令 src/redis-cli
输入info命令,会输出一系列的关于redis的信息,找到redis_version,就是redis的版本信息了,到此就是用命令查看到了redis的版本信息了。

redis开启外网访问的更多相关文章

  1. elasticsearch,kibana 坑之 开启外网访问

    安装elasticsearch,kibana,开启外网访问,总是失败,坑啊. 经过两天断断续续的艰苦奋战,终于搞定了,记录如下: kibana开启外网访问 1)  修改server.host 为本机i ...

  2. 关于腾讯云redis 无法外网访问的解决方案

    问题简介: 今天购买了一台腾讯云的redis:如图 可是我没有找到 腾讯云提供的外网地址,我该怎么连接呢?百度了一大堆 全部是 在腾讯云服务器上搭建的Redis实例的解决办法.完全不匹配. 开始解决: ...

  3. linux安装redis及外网访问

    1.下载Redis,最新版是redis-3.2.1.tar.gz 2.上传到Linux上,解压到/usr/local/下面  ,命令:tar -zxvf redis-3.2.1.tar.gz 3.我们 ...

  4. elasticsearch7.6 安装 并且开启外网访问,真的好累。

    下载 下载页面 https://www.elastic.co/cn/downloads/elasticsearch wget https://artifacts.elastic.co/download ...

  5. elasticsearch开启外网访问

    默认情况下,Elastic 只允许本机访问,如果需要远程访问,可以修改 Elastic 安装目录的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成 ...

  6. Elasticsearch(一)开启外网访问

    1. 设置Elasticsearch对外访问的Host 修改Elasticsearch配置文件 elasticsearch.yml : network.host: 128.24.108.84  //在 ...

  7. mac系统上mysql开启外网访问

    1.首先本地连到数据库在"mysql"库下把user表里User=root的那一行,把Hosts从"locahost"改成"%" 2.然后在 ...

  8. 配置 redis 外网访问

    redis采用的安全策略,默认会只准许本地访问 1 2 3 4 5 6 7 8 9 10 通过简单配置,完成允许外网访问 [root@cache01 conf]# egrep "(^bind ...

  9. Linux CentOS7 开启80,443端口外网访问权限

    一.查看系统防火墙状态(如果返回 running 代表防火墙启动正常) firewall-cmd --state 二.开启端口外网访问 1.添加端口 返回 success 代表成功(--permane ...

随机推荐

  1. Spring-boot+Spring-batch+hibernate+Quartz简单批量读文件写数据用例

    本文程序集成了Spring-boot.Spring-batch.Spring-data-jpa.hibernate.Quartz.H2等.完整代码在Github上共享,地址https://github ...

  2. Java-Runoob-高级教程-实例-数组:10. Java 实例 – 查找数组中的重复元素-un

    ylbtech-Java-Runoob-高级教程-实例-数组:10. Java 实例 – 查找数组中的重复元素 1.返回顶部 1. Java 实例 - 查找数组中的重复元素  Java 实例 以下实例 ...

  3. Underscore.js部分讲解

    underscore是非常好用的封装库,大小只有4KB,大多插件都是以underscore为基础: underscore分5大部分:集合:数组:函数:对象:工具 集合:集合就是伪数组,虽然长的和数组一 ...

  4. Jmeter(三)Test-Plan、Thread-Group

    思量再三,还是再记一会,看到技术群里边的讨论,真的是压力山大,学习一刻也不能耽搁.继续来回顾Jmeter的知识吧. Test-Plan,是所有Jmeter脚本的根节点,Test-Plan中包含名称.注 ...

  5. 基于JMX动态配置Log4J日志级别

    先来看比较low的修改日志级别的方式,在写程序里面. http://blog.gssxgss.me/java%E8%BF%90%E8%A1%8C%E6%97%B6%E5%8A%A8%E6%80%81% ...

  6. MySQL架构之keepalived+haproxy+mysql 实现MHA中slave集群负载均衡的高可用(原创)

    MySQL的高可用方案一般有如下几种:keepalived+双主,MHA,PXC,MMM,Heartbeat+DRBD等,比较常用的是keepalived+双主,MHA和PXC. HAProxy是一款 ...

  7. CRM 2016 IFrame_A嵌入 EXT.net 页面 a.aspx,刷新另一IFrame_B嵌入 b.aspx gird.

    说白了就是一个IFrame页面,执行另一IFrame页面的函数.  a.aspx JS: parent.Xrm.Page.getControl("IFRAME_B").getObj ...

  8. CentOS之正则表达式

    支持linux正则表达式的工具有:grep:实现查找,sed,awk:都是流式编辑器,可以实现查找和替换,并且把替换的文本输出到屏幕上. grep工具 grep [-cinvABC] 'word' - ...

  9. C++和C#进程之间通过命名管道通信(上)

    C++和C#进程之间通过命名管道通信(上) "命名管道"是一种简单的进程间通信(IPC)机制.命名管道可在同一台计算机的不同进程之间,或在跨越一个网络的不同计算机的不同进程之间,支 ...

  10. 《linux性能及调优指南》 3.3 内存瓶颈

    摘要:3.3内存瓶颈OnaLinuxsystem,manyprogramsrunatthesametime.Theseprogramssupportmultipleusers,andsomeproce ...