Into my Laravel project I get this error message:
Predis\Connection\ConnectionException
Connection refused [tcp://redis:6380]
Settings Laravel .env
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6380
REDIS_CLIENT=predis
I added this to config/database.php
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', 'redis'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6380),
'database' => env('REDIS_DB', 0),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', 'redis'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6380),
'database' => env('REDIS_CACHE_DB', 1),
],
],
Into laradock .env I changed the redis port
### REDIS #################################################
REDIS_PORT=6380
...
REDIS_STORAGE_SERVER_HOST=redis
REDIS_STORAGE_SERVER_PORT=6379
REDIS_STORAGE_SERVER_DB=0
REDIS_STORAGE_SERVER_PASSWORD=None
REDIS_RESULT_STORAGE_SERVER_HOST=redis
REDIS_RESULT_STORAGE_SERVER_PORT=6379
REDIS_RESULT_STORAGE_SERVER_DB=0
REDIS_RESULT_STORAGE_SERVER_PASSWORD=None
...
REDIS_QUEUE_SERVER_HOST=redis
REDIS_QUEUE_SERVER_PORT=6379
REDIS_QUEUE_SERVER_DB="0"
REDIS_QUEUE_SERVER_PASSWORD=None
...
### REDISWEBUI #########################################
REDIS_WEBUI_USERNAME=laradock
REDIS_WEBUI_PASSWORD=laradock
REDIS_WEBUI_CONNECT_HOST=redis
REDIS_WEBUI_CONNECT_PORT=6379
REDIS_WEBUI_PORT=9987
...
WORKSPACE_INSTALL_PHPREDIS=true
...
PHP_FPM_INSTALL_PHPREDIS=true
I stopped all containers and let run:
docker-compose build --no-cache nginx mysql phpmyadmin redis workspace
Then I opend my laravel website and get this error.
What can I do to solve this problem?
Change port to 6379 in laravel and laradock .env:
REDIS_PORT=6379
And restart server
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.