PHP code example of daison / laravel-horizon-cluster
1. Go to this page and download the library: Download daison/laravel-horizon-cluster 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/ */
daison / laravel-horizon-cluster example snippets
return [
'providers' => [
// ...
Daison\LaravelHorizonCluster\AppServiceProvider::class,
App\Providers\HorizonServiceProvider::class,
],
];
return [
'redis' => [
'client' => 'predis',
'clusters' => [
'default' => [
[
'host' => env('REDIS_HOST', '127.0.0.1'),
'port' => env('REDIS_PORT', '6379'),
'password' => env('REDIS_PASSWORD', null),
'database' => 0,
],
],
// ...
],
'options' => [
'cluster' => 'redis',
],
],
];
return [
'use' => 'clusters.default',
// ...
'defaults' => [
'worker' => [
'connection' => 'redis',
'balance' => env('HORIZON_QUEUE_WORKER_BALANCE', false),
'timeout' => env('HORIZON_QUEUE_WORKER_TIMEOUT', 10),
'sleep' => env('HORIZON_QUEUE_WORKER_SLEEP', 3),
'maxTries' => env('HORIZON_QUEUE_WORKER_MAXTRIES', 3),
],
],
'environments' => [
env('APP_ENV') => [
'worker' => [
'connection' => 'redis',
'queue' => [
'{redis-high}',
'{redis}',
'{redis-low}',
],
'memory' => env('HORIZON_QUEUE_WORKER_MEMORY', 128),
'minProcesses' => env('HORIZON_QUEUE_WORKER_MIN_PROCESSES', 1),
'maxProcesses' => env('HORIZON_QUEUE_WORKER_MAX_PROCESSES', 3),
],
],
],
];
bash
php artisan horizon:install