redis 远程连接出错的解决办法
1. 配置防火墙端口
redis系统的默认端口是6379端口。
# 打开端口
$ firewall-cmd --zone=public --add-port=6379/tcp --permanent
# 命令含义:
# --zone #作用域
# --add-port=80/tcp #添加端口,格式为:端口/通讯协议
# --permanent #永久生效,没有此参数重启后失效
# 重启防火墙
$ firewall-cmd --reload
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
2. 关闭Redis的protected mode
# 关闭protected-mode
127.0.0.1:6379> CONFIG SET protected-mode no
# 如果不关闭,则会出现这个错误:
# Fatal error: Uncaught exception 'Predis\Response\ServerException' with message '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 authen in D:\www\redis\predis\Client.php on line 370
- 1
- 2
- 3
- 4
- 5
3. 下载Predis
Predis是Redis官方推荐的PHP连接工具。
<?php
require 'predis/Autoloader.php';
Predis\Autoloader::register();
$server = array(
'host' => '192.168.23.140',
'port' => 6379
);
$client = new Predis\Client($server);
$client->set('foo', 'bar');
$value = $client->get('foo');
echo $value;
redis 远程连接出错的解决办法的更多相关文章
- redis远程连接不上解决办法
结构:PC-A 运行redis client,PC-B运行redis server PC-B方面 在server中,修改配置文件redis.windows-service.conf中的: 1.注释 # ...
- navcat无法远程连接mysql数据库解决办法
navcat无法远程连接mysql数据库,一般都是因为本地ip没有访问权限,服务器上执行下面指令即可解决 mysql -u root -p GRANT ALL PRIVILEGES ON *.* TO ...
- MySql远程连接无法打开解决办法
1.改表法. 请使用mysql管理工具,如:SQLyog Enterprise 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑使用mysql管理工 ...
- 解决redis远程连接不上的问题
解决redis远程连接不上的问题 redis现在的版本开启redis-server后,redis-cli只能访问到127.0.0.1,因为在配置文件中固定了ip,因此需要修改redis.conf(有的 ...
- Win7安装Oracle Instantclient ODBC驱动 后配置DSN时出错的解决办法 SQORAS32
安装过程简述 oracle官网下载了 instantclient-odbc-nt--.zip instantclient-basic-nt-.zip 我这是32位版的win7,按照需要下载对应的版本. ...
- 非域环境下搭建自动故障转移镜像无法将 ALTER DATABASE 命令发送到远程服务器实例的解决办法
非域环境下搭建自动故障转移镜像无法将 ALTER DATABASE 命令发送到远程服务器实例的解决办法 环境:非域环境 因为是自动故障转移,需要加入见证,事务安全模式是,强安全FULL模式 做到最后一 ...
- Windows远程桌面卡的解决办法
Windows远程桌面卡的解决办法 如果在网络没有什么大问题的情况下,可以尝试以下操作. 1.显示中颜色选择 增强色15位 2.体验中 设置成下图的样子 然后在尝试连接试试有没有好点
- redis远程连接配置
解决redis远程连接不上的问题 redis现在的版本开启redis-server后,redis-cli只能访问到127.0.0.1,因为在配置文件中固定了ip,因此需要修改redis.conf(有的 ...
- FluorineFx 播放FLV 时堆棧溢出解决 FluorineFx NetStream.play 并发时,无法全部连接成功的解决办法
http://25swf.blogbus.com/tag/FluorineFx/ http://www.doc88.com/p-7002019966618.html 基于Red5的视频监控系统的研究 ...
随机推荐
- UVA11992 Fast Matrix Operations
思路 注意到最多20行,拆成20颗线段树即可 注意set标记清空左右儿子的add,不要清空自己的add,因为这个set操作之后可能还有add存在这个节点上 代码 #include <cstdio ...
- WebApi实现验证授权Token,WebApi生成文档等(转)
using System; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Security; ...
- Codeforces Round #FF (Div. 2) D. DZY Loves Modification 优先队列
D. DZY Loves Modification time limit per test 2 seconds memory limit per test 256 megabytes input st ...
- gym 101081 E. Polish Fortress 几何
E. Polish Fortress time limit per test 2.0 s memory limit per test 256 MB input standard input outpu ...
- Java-Mail邮件开发
Email的历史比Web还要久远,直到现在,Email也是互联网上应用非常广泛的服务. 几乎所有的编程语言都支持发送和接收电子邮件,但是,先等等,在我们开始编写代码之前,有必要搞清楚电子邮件是如何在互 ...
- regex-ways
regex的分组与捕获:分组就是用小括号(str)括起来的东西,就是一个分组.要想得到这些分组的信息,就要想办法捕获.每个分组都有编号,编号规则是从外向内,从左至右. .例如,在表达式 (A)(B(C ...
- PAT 1069 The Black Hole of Numbers
1069 The Black Hole of Numbers (20 分) For any 4-digit integer except the ones with all the digits ...
- ProtoBuf3.3 安装记录
翻了很多教程,下载了 PB 的源码在自己的 mac 上编译及安装,记录下新的 1. 首先是下载源码了 https://github.com/google/protobuf/releases 虽然是 g ...
- django1
* <pre>━━━━━━神兽出没━━━━━━ * ┏┓ ┏┓ * ┏┛┻━━━┛┻┓ * ┃ 王 ┃ * ┃ ┃ * ┃ ┳┛ ┗┳ ┃ * ┃ ┃ * ┃ ┻ ┃ * ┃ ┃ * ...
- DNS及DNS有什么作用
什么是DNS,DNS有什么作用: DNS(Domain Name System,域名系统),万维网上作为域名和IP地址相互映射的一个分布式数据库,能够使用户更方便的访问互联网,而不用去记住能够被机器直 ...