PHP code example of namoshek / laravel-redis-sentinel
1. Go to this page and download the library: Download namoshek/laravel-redis-sentinel library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namoshek / laravel-redis-sentinel example snippets
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis-sentinel'),
'default' => [
'sentinel_host' => env('REDIS_SENTINEL_HOST', '127.0.0.1'),
'sentinel_port' => (int) env('REDIS_SENTINEL_PORT', 26379),
'sentinel_service' => env('REDIS_SENTINEL_SERVICE', 'mymaster'),
'sentinel_timeout' => (float) env('REDIS_SENTINEL_TIMEOUT', 0),
'sentinel_persistent' => env('REDIS_SENTINEL_PERSISTENT'),
'sentinel_retry_interval' => (int) env('REDIS_SENTINEL_RETRY_INTERVAL', 0),
'sentinel_read_timeout' => (float) env('REDIS_SENTINEL_READ_TIMEOUT', 0),
'sentinel_username' => env('REDIS_SENTINEL_USERNAME'),
'sentinel_password' => env('REDIS_SENTINEL_PASSWORD'),
'password' => env('REDIS_PASSWORD'),
'database' => (int) env('REDIS_DB', 0),
]
]
'sentinel_ssl' => [
// ... SSL settings ...
],
'context' => [
'stream' => [
// ... SSL settings ...
]
],
'scheme' => 'tls',
'redis' => [
'client' => 'phpredis-sentinel',
'redis_with_tls' => [
'sentinel_host' => 'tls://sentinel_host',
'sentinel_port' => 26379,
'sentinel_service' => 'mymaster',
'sentinel_timeout' => 0,
'sentinel_persistent' => false,
'sentinel_retry_interval' => 0,
'sentinel_read_timeout' => 0,
'sentinel_username' => 'sentinel_username',
'sentinel_password' => 'sentinel_password',
'sentinel_ssl' => [
'cafile' => '/path/to/sentinel_ca.crt',
],
'context' => [
'stream' => [
'cafile' => '/path/to/redis_ca.crt',
],
],
'scheme' => 'tls',
'username' => 'redis_username',
'password' => 'redis_password',
'database' => 1,
]
]