From 656648cc83dd32ade0a15e9cf8dab30d5286f7ef Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Wed, 18 Jan 2023 19:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=88=B7=E5=86=99=20node=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Cluster/Work.php | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/app/Console/Commands/Cluster/Work.php b/app/Console/Commands/Cluster/Work.php index 7ae1078..242c10d 100644 --- a/app/Console/Commands/Cluster/Work.php +++ b/app/Console/Commands/Cluster/Work.php @@ -71,33 +71,15 @@ public function handle(): int // 关闭 Octane Artisan::call('octane:stop'); - Artisan::call('config:cache'); - if (!config('settings.node.ip')) { $this->error('请先配置节点 IP。'); return CommandAlias::FAILURE; } - - // 重写 .env 文件中的 NODE_ID - $this->info('正在重写 .env 文件中的 NODE_ID。'); - - $node_id = Str::random(8); - - if (config('settings.node.type') === 'master') { - $node_id = 'master'; - } - - $env = file_get_contents(base_path('.env')); - - $env = preg_replace('/^NODE_ID=.*$/m', 'NODE_ID=' . $node_id, $env); - - file_put_contents(base_path('.env'), $env); - - // 刷新配置缓存 $this->info('正在刷新配置缓存。'); Artisan::call('config:cache'); + Artisan::call('route:cache'); // redis 创建一个 hash $this->info('正在注册节点。');