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的视频监控系统的研究 ...
随机推荐
- 通过修改DNS达到不FQ也能访问Google(2018-12-25至现在已失效)
一.前言 不知道各位小伙伴们现在用的搜索引擎是用Google搜索还是百度搜索呢?但我个人还是比较极力推荐用Google搜索的,首先用百度搜索后的结果的前几项大部分是满屏的广告,甚至搜索的结果并不能直接 ...
- 点击倒计时60S获取验证码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...
- 使用Docker方式创建3节点的Etcd集群
一.简要说明 二.运行容器 三.验证集群 四.运行截图 五.参考链接 一.简要说明 参考etcd官网文档, 在node1.node2.node3三个节点上,分别运行etcd容器,创建etcd集 ...
- 日常英语---八、REBOOT - What is the difference? -MapleStory
日常英语---八.REBOOT - What is the difference? -MapleStory 一.总结 一句话总结: trade transfer drop_rate equipment ...
- js之Object属性封装
在object.create出现之前,我们实现继承一般使用: function base(){} function children(){} //实现children继承base (function( ...
- Android之Fragment(碎片)方方面面
Fragment简介碎片(Fragment)是一种可以嵌入到活动当中的UI片段,它能让程序更加合理和充分的利用大屏幕的空间. Fragment的生命周期 它与Activity生命周期的关系: 可以看到 ...
- 『TensorFlow』pad图片
tf.pad()文档如下, pad(tensor, paddings, mode='CONSTANT', name=None, constant_values=0) Pads a tensor. ...
- SSH框架学习摸索记
Unable to load configuration. - bean - jar:file:/E:/tomcat-7.0.11/webapps/struts/WEB-INF/lib/struts ...
- MVC模式和MVP模式的区别
MVC模式: 1. MVC的所有通信都是单向的. 2. view传送指令到controller(用户也可以直接将指令传到controller). 3. controller完成业务逻辑后要求model ...
- 为Linux技术学习推荐看的书籍—《Linux就该这么学》
成长,是一种经历:经历,是一种人生的体验.人生的意义不在于我们拥有了什么,而在于从中我们体悟了什么.在这短短的三年,却在我的人生中弥足珍贵,在脑海中记忆犹新,在这大学三年里,我从一个莽撞少年成长为一名 ...