webman redis 集群 使用出现问题

yzh52521

配置:

'options'  => [
        'cluster'  => 'redis',
        'prefix'   => 'webman_database_',
        'password' => null,
    ],
    'clusters' => [
        'default' => [
            [
                'host'     => env('REDIS_MS_HOST1', '127.0.0.1'),
                'port'     => env('REDIS_MS_PORT1', '6379'),
                'password' => null,
                'database' => 0,
            ],
            [
                'host'     => env('REDIS_MS_HOST2', '127.0.0.1'),
                'port'     => env('REDIS_MS_PORT2', '6379'),
                'password' => null,
                'database' => 1,
            ],
            [
                'host'     => env('REDIS_MS_HOST3', '127.0.0.1'),
                'port'     => env('REDIS_MS_PORT3', '6379'),
                'password' => null,
                'database' => 2,
            ],
            [
                'host'     => env('REDIS_MS_HOST4', '127.0.0.1'),
                'port'     => env('REDIS_MS_PORT4', '6379'),
                'password' => null,
                'database' => 3,
            ],
            [
                'host'     => env('REDIS_MS_HOST5', '127.0.0.1'),
                'port'     => env('REDIS_MS_PORT5', '6379'),
                'password' => null,
                'database' => 4,
            ],
            [
                'host'     => env('REDIS_MS_HOST6', '127.0.0.1'),
                'port'     => env('REDIS_MS_PORT6', '6379'),
                'password' => null,
                'database' => 5,
            ],
            'options' => [
                'prefix'     => 'webman_database_',
                'cluster'    => 'redis', //使用原生集群
                'parameters' => [
                    'password' => null,
                ]
            ],
        ],
    ],

控制器使用

 $key = 'test_key';
        Redis::set($key, rand());
        return response(Redis::get($key));

报错

RedisClusterException: Couldn't map cluster keyspace using any provided seed in /Users/yuanzhihai/Sites/local/webman/vendor/illuminate/redis/Connectors/PhpRedisConnector.php:183
Stack trace:
#0 /Users/yuanzhihai/Sites/local/webman/vendor/illuminate/redis/Connectors/PhpRedisConnector.php(183): RedisCluster->__construct(NULL, Array, 0, 0, false, NULL)
#1 /Users/yuanzhihai/Sites/local/webman/vendor/illuminate/redis/Connectors/PhpRedisConnector.php(48): Illuminate\Redis\Connectors\PhpRedisConnector->createRedisClusterInstance(Array, Array)
#2 /Users/yuanzhihai/Sites/local/webman/vendor/illuminate/redis/RedisManager.php(136): Illuminate\Redis\Connectors\PhpRedisConnector->connectToCluster(Array, Array, Array)
#3 /Users/yuanzhihai/Sites/local/webman/vendor/illuminate/redis/RedisManager.php(117): Illuminate\Redis\RedisManager->resolveCluster('default')
#4 /Users/yuanzhihai/Sites/local/webman/vendor/illuminate/redis/RedisManager.php(91): Illuminate\Redis\RedisManager->resolve('default')
#5 /Users/yuanzhihai/Sites/local/webman/support/Redis.php(235): Illuminate\Redis\RedisManager->connection('default')
#6 /Users/yuanzhihai/Sites/local/webman/app/controller/test.php(73): support\Redis::__callStatic('set', Array)
#7 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/webman-framework/src/App.php(234): app\controller\Test->lock(Object(support\Request))
#8 /Users/yuanzhihai/Sites/local/webman/app/middleware/AccessControlTest.php(39): Webman\App::Webman\{closure}(Object(support\Request))
#9 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/webman-framework/src/App.php(228): app\middleware\AccessControlTest->process(Object(support\Request), Object(Closure))
#10 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/webman-framework/src/App.php(162): Webman\App::Webman\{closure}(Object(support\Request))
#11 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Connection/TcpConnection.php(638): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
#12 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #331, 2, Resource id #331)
#13 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Events/Event.php(193): EventBase->loop()
#14 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Worker.php(2417): Workerman\Events\Event->loop()
#15 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Worker.php(1541): Workerman\Worker->run()
#16 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Worker.php(1383): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
#17 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Worker.php(1357): Workerman\Worker::forkWorkersForLinux()
#18 /Users/yuanzhihai/Sites/local/webman/vendor/workerman/workerman/Worker.php(549): Workerman\Worker::forkWorkers()
#19 /Users/yuanzhihai/Sites/local/webman/start.php(93): Workerman\Worker::runAll()
#20 {main}

那是配置不对?

3178 1 0
1个回答

2548a
年代过于久远,无法发表回答
×
🔝