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的视频监控系统的研究 ...
随机推荐
- 破解微信防盗链&微信公众号文章爬取方案
破解微信图文防盗链:https://www.cnblogs.com/xsxshmily/p/8000043.html 图片解除防盗链:https://blog.csdn.net/show_ljw/ar ...
- win10更新后 chrome内核浏览器总是打开网页一直加载 甚至打不开 解决方法
https://blog.csdn.net/qq754772661/article/details/81452131 升级win10之后如果出现chrome内核的浏览器网页总是打不开 打开很慢 而ie ...
- kod 编辑器下载
链接: https://pan.baidu.com/s/1ZACwJZ_x2ZBziqPlm17z6w 提取码: 3w9m
- CSS之user-select——设置标签中的文字是否可被复制
详细介绍请参考 http://www.css88.com/book/css/properties/user-interface/user-select.htm CSS样式 user-select:no ...
- Python打包项目为EXE程序
安装pyinstaller 如果使用了VirtualENV环境,则必须在要打包的项目环境中安装... 否则会找不到项目需求的包和模块 pip install -i https://pypi.douba ...
- vue form表单验证
<el-select v-model="ruleForm.region" placeholder="请选择活动区域"> <el-option ...
- canvas资料
w3c比较全面的api http://www.w3school.com.cn/tags/html_ref_canvas.asp 一个总结比较全面的网站 http://blog.csdn.net/qq_ ...
- CentOS7.5下安装、配置mariadb --CentOS7.5
1.安装mariadb [root@VM_39_157_centos bin]# yum -y install mariadb-server 2.启动mariadb服务 [root@VM_39_157 ...
- winform 分页控件
http://www.cnblogs.com/liuyunsheng/p/4853387.html http://www.cnblogs.com/wuhuacong/archive/2011/07/0 ...
- phpldapadmin操作指导
1.在浏览器中打开http://IP/phpldapadmin 2. 点击[Login]按钮,输入管理员密码. 3.点击[创建新条目]. 4. 点击[Generic: Postfix Group]. ...