【发布时间】:2018-05-21 14:47:08
【问题描述】:
我在从安装在 EC2 实例上的 Laravel 应用程序连接到 ElastiCache Redis 时遇到问题,甚至在使用 EC2 实例中的 redis-cli 时遇到问题。
Laravel
我尝试将 predis 与 database.php 中的配置一起使用
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'read_write_timeout' => -1,
'timeout' => 0
],
],
得到'Error while reading line from the server. [tcp:server here]'
我尝试使用具有相同配置的 phpRedis 扩展只更改 'client' => 'phpredis' 并得到错误 read error on connection {"exception":"[object] (RedisException(code: 0): read error on connection at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:69)
Redis cli
使用 redis cli redis-cli -h host_here -p 6379 -a password_here 我看到类似host:6379> 的提示,但输入任何命令都会引发错误Error: Connection reset by peer
ElastiCache Redis 配置
我的 EC2 和弹性缓存在同一个 VPC 中,使用 telnet 我可以连接到 redis 实例
~$ telnet host 6379
Trying 172.31.23.113...
Connected to host.
Escape character is '^]'.
感谢您的帮助!
【问题讨论】:
-
hm,当我在没有 AUTH 的情况下创建新的 redis 实例时,它开始工作。但是问题仍然存在,为什么 redis 不能与 AUTH 一起工作
-
你能检查一下这个文档吗 -docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/… ?
标签: laravel amazon-web-services amazon-ec2 redis