内容目录
Hyperf框架连接Redis报错:
[ERROR] config[redis.default] is not exist![40] in /data/project/hyperf-skeleton/vendor/hyperf/redis/src/Pool/RedisPool.php
- 原因是:没找到默认的redis配置文件
解决方法:在
项目地址/hyperf-skeleton\config\autoload
目录下添加一个redis.php文件,文件内容如下:<?php return [ 'default' => [ 'host' => env('REDIS_HOST', 'localhost'), 'auth' => env('REDIS_AUTH', ''), 'port' => (int) env('REDIS_PORT', 6379), 'db' => (int) env('REDIS_DB', 0), 'cluster' => [ 'enable' => (bool) env('REDIS_CLUSTER_ENABLE', false), 'name' => null, 'seeds' => [], ], 'pool' => [ 'min_connections' => 1, 'max_connections' => 10, 'connect_timeout' => 10.0, 'wait_timeout' => 3.0, 'heartbeat' => -1, 'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60), ], ], ];
然后进入容器并启动 Hyperf 服务
docker exec -it myhyperf /bin/sh
cd /data/project/hyperf-skeleton
php bin/hyperf.php start
重新运行查看结果
0 条评论
撰写评论