laravel echo服务器、redis和ubuntu 18.04.4[ioredis]错误:connect etimedout

qlzsbp2j  于 2021-06-10  发布在  Redis
关注(0)|答案(0)|浏览(316)

希望有人能帮我解决这个问题:
我有我的laravel项目(7.x)在本地环境上没有问题地广播(带有redis的laragon 4.0)。我想用ubuntu18.04.4,apache2,virtualmincp对我的vps进行更精确的测试。
我安装了redis服务器(最新版本),并且正在运行(ping->pong,create key->value,read key->value。。。重新启动服务和键->值仍然存在。。。所有的测试都很好)。当我发射我的事件和广播的东西,我看到它在电视上queue:work regularly,但每次我启动laravel echo服务器时,客户端连接速度非常快,几秒钟后,我开始在控制台中收到此错误:

[ioredis] Unhandled error event: Error: connect ETIMEDOUT
at Socket.<anonymous> (/usr/local/lib/node_modules/laravel-echo-server/node_modules/ioredis/built/redis/index.js:285:37)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at Socket.emit (events.js:208:7)
at Socket._onTimeout (net.js:420:8)
at ontimeout (timers.js:482:11)
at tryOnTimeout (timers.js:317:5)
at Timer.listOnTimeout (timers.js:277:5)

我检查了stackoverflow,laracasts上的每一个帖子,以及任何提到这个错误的地方,但我找不到解决方法。我的.env文件感兴趣的部分如下:

APP_NAME=Testapp
APP_ENV=local
APP_KEY=[omitted]
APP_DEBUG=true
APP_URL=[omitted]
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=17306
DB_DATABASE=[omitted]
DB_USERNAME=[omitted]
DB_PASSWORD=[omitted]
BROADCAST_DRIVER=redis
CACHE_DRIVER=none
QUEUE_CONNECTION=redis
SESSION_DRIVER=database
SESSION_LIFETIME=1200
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

这里是broadcasting.php

'default' => env('BROADCAST_DRIVER', 'null'),

/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|

* /

'connections' => [

    'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
            'cluster' => env('PUSHER_APP_CLUSTER'),
            'useTLS' => true,
        ],
    ],

    'redis' => [
        'driver' => 'redis',
        'connection' => 'default',
    ],

我的数据库.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', '127.0.0.1'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', '6379'),
        'database' => env('REDIS_DB', '0'),
    ],

    'cache' => [
        'url' => env('REDIS_URL'),
        'host' => env('REDIS_HOST', '127.0.0.1'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', '6379'),
        'database' => env('REDIS_CACHE_DB', '1'),
        'timeout' => 10000,
    ],

我的laravel-echo-server.json

{
"authHost": "127.0.0.1",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
    "redis": {},
    "sqlite": {
        "databasePath": "/database/laravel-echo-server.sqlite"
    }
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "https",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "/home/[myuser]/ssl.cert",
"sslKeyPath": "/home/[myuser]/ssl.key",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
    "http": true,
    "redis": true
},
"apiOriginAllow": {
    "allowCors": false,
    "allowOrigin": "",
    "allowMethods": "",
    "allowHeaders": ""
}

}
防火墙上的端口应该是开放的,我发现服务正在监听它们的端口。
我真的不知道还能做什么,如果有人能帮我,因为我老了,我想在退休前解决:)
谢谢,
西蒙尼
更新
我在unixsocket上配置了redis,避免了网络问题,现在运行良好。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题