swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

[redis] 配置认证密码无法正常连接 #249

Closed guanzhao closed 6 years ago

guanzhao commented 6 years ago

redis 配置认证密码无法正常连接 1 2

daydaygo commented 6 years ago

$error = sprintf('Redis Connection format is incorrect uri=%s, eg:tcp://127.0.0.1:6379/1?auth=password', $uri);

guanzhao commented 6 years ago

`namespace Swoft\Redis;

RedisConnection.php 到这个方法这里过不去了getConnectRedis ` $error = sprintf('Redis connection failure host=%s port=%d', $host, $port);

CLI 和工具都可以正常连接

inhere commented 6 years ago

密码里有没有特殊字符,影响到解析?

guanzhao commented 6 years ago

@inhere 没有特殊字符只要字母和数字

inhere commented 6 years ago

但是其他人也有用密码的呀,没有这个问题

你用 Swoole 的 协程redis 客户端连接试下呢

guanzhao commented 6 years ago

@inhere Swoole 协程redis 客户端连 也是一样不行

guanzhao commented 6 years ago

@inhere tcp://127.0.0.1:6379/1?auth=123456abc 127.0.0.1:6379?auth=123456abc tcp://127.0.0.1:6379/?auth=123456abc 127.0.0.1:6379/?auth=123456abc 我把这几种写法都测试了

inhere commented 6 years ago

是不是你没有启用 协程 ? 安装hiredis,启用异步redis 没 ?

运行: php bin/swoft app:check 看下

guanzhao commented 6 years ago

@inhere 全部是YES PHP version is greater than 7? Yes (current is 7.1.14) Swoole extension is installed? Yes Swoole version is greater than 2.1? Yes (current is 2.1.3) Swoole async redis is enabled? Yes Swoole coroutine is enabled? Yes

Extensions that conflict with 'swoole'

inhere commented 6 years ago

如果用 Swoole 的协程redis 客户端连接都不行

guanzhao commented 6 years ago

我升级下试试~ 我把环境从新在搭建下.

guanzhao commented 6 years ago

从新安装了下环境之后,就好了