改进 集群

This commit is contained in:
iVampireSP.com 2023-01-05 03:43:59 +08:00
parent 28932babe3
commit 478251788f
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 9 additions and 0 deletions

View File

@ -61,6 +61,10 @@ public function switch($event, $message = []): string|null
'edge.deployed' => '已成功根据集群节点生成配置文件并应用。',
'edge.launched' => '边缘节点成功启动。',
'edge.error' => $message['message'] ?? '未知错误',
'cluster.restart.web' => '正在重启 web 服务。',
'cluster.restart.all' => '正在重启 整个 服务。',
'cluster.restarted.web' => 'Web 重启好了。',
'cluster.restarted.all' => '整个 重启好了。',
];
return $events[$event] ?? null;

View File

@ -5,6 +5,7 @@
use App\Support\Cluster;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Str;
use Symfony\Component\Console\Command\Command as CommandAlias;
@ -178,6 +179,8 @@ private function dispatchEvent($event, $message = []): void
exec('supervisorctl restart lae-web:*');
Cluster::publish('cluster.restarted.web');
$this->info('Web 重启完成。');
},
'cluster.restart.all' => function () {
@ -185,6 +188,8 @@ private function dispatchEvent($event, $message = []): void
exec('supervisorctl restart all');
Cluster::publish('cluster.restarted.all');
$this->info('整个莱云 重启完成。');
},
];