laravel redis cluster 사용할때 설정
Laravel에서 Redis 클러스터 설정에 대한 경험을 나눕니다. Horizon의 한계, MOVED 에러, phpredis의 자동 노드 설정까지, 실전 팁을 공개합니다.
GGAMI
Laravel에서 Redis 클러스터 설정에 대한 경험을 나눕니다. Horizon의 한계, MOVED 에러, phpredis의 자동 노드 설정까지, 실전 팁을 공개합니다.
'redis'=>[
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'ssl' => ['verify_peer' => false],
'parameters' => [ // Parameters provide defaults for the Connection Factory
'password' => env('REDIS_PASSWORD', null), // Redirects need PW for the other nodes
'scheme' => env('REDIS_SCHEME', 'tcp'), // Redirects also must match scheme
],
],
'clusters' => [
'default' => [
[
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DATABASE', 0),
],
],
'cache' => [
[
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DATABASE', 0),
],
],
'options' => [ // Clustering specific options
'cluster' => 'redis', // This tells Redis Client lib to follow redirects (from cluster)
]
],
'horizon' => [
'host' => env('REDIS_HORIZON_HOST', env('REDIS_HOST', 'localhost')),
'password' => env('REDIS_HORIZON_PASSWORD', env('REDIS_PASSWORD', null)),
'port' => env('REDIS_HORIZON_PORT', env('REDIS_PORT', 6379)),
'database' => env('REDIS_HORIZON_DATABASE', 8),
],
]아예 정보가 없다. 이거 때문에 개고생했음.
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
], 'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 900,
'block_for' => null,
'after_commit' => false,
], 'use' => 'horizon',