我把webman/gateway-worker插件和配置复制了一份,启动报错!(已解决)

wekyun

问题描述

我把webman/gateway-worker插件和配置复制了一份,修改了配置,启动报错!

程序代码:gateway-worker的process.php

<?php

use Webman\GatewayWorker\Gateway;
use Webman\GatewayWorker\BusinessWorker;
use Webman\GatewayWorker\Register;

return [
    'gateway' => [
        'handler'     => Gateway::class,
        'listen'      => 'websocket://0.0.0.0:7272',
        'count'       => cpu_count(),
        'reloadable'  => false,
        'constructor' => ['config' => [
            'lanIp'           => '127.0.0.1',
            'startPort'       => 2300,
            'pingInterval'    => 25,
            'pingData'        => '{"type":"ping"}',
            'registerAddress' => '127.0.0.1:1236',
            'onConnect'       => function(){},
        ]]
    ],
    'worker' => [
        'handler'     => BusinessWorker::class,
        'count'       => cpu_count()*2,
        'constructor' => ['config' => [
            'eventHandler'    => plugin\webman\gateway\Events::class,
            'name'            => 'ChatBusinessWorker',
            'registerAddress' => '127.0.0.1:1236',
        ]]
    ],
    'register' => [
        'handler'     => Register::class,
        'listen'      => 'text://127.0.0.1:1236',
        'count'       => 1, // Must be 1
        'constructor' => []
    ],
];

程序代码:gateway-worker2的process.php

<?php

use Webman\GatewayWorker\Gateway;
use Webman\GatewayWorker\BusinessWorker;
use Webman\GatewayWorker\Register;

return [
    'gateway' => [
        'handler'     => Gateway::class,
        'listen'      => 'websocket://0.0.0.0:7373',
        'count'       => cpu_count(),
        'reloadable'  => false,
        'constructor' => ['config' => [
            'lanIp'           => '127.0.0.1',
            'startPort'       => 2300,
            'pingInterval'    => 25,
            'pingData'        => '{"type":"ping"}',
            'registerAddress' => '127.0.0.1:1237',
            'onConnect'       => function(){},
        ]]
    ],
    'worker' => [
        'handler'     => BusinessWorker::class,
        'count'       => cpu_count()*2,
        'constructor' => ['config' => [
            'eventHandler'    => plugin\webman\gateway2\Events::class,
            'name'            => 'ChatBusinessWorker2',
            'registerAddress' => '127.0.0.1:1237',
        ]]
    ],
    'register' => [
        'handler'     => Register::class,
        'listen'      => 'text://127.0.0.1:1237',
        'count'       => 1, // Must be 1
        'constructor' => []
    ],
];

报错信息

---------------------------------------------- WORKERMAN -----------------------------------------------
----------------------------------------------- WORKERS ------------------------------------------------
worker                                          listen                              processes   status
webman                                          http://0.0.0.0:8787                 1           [ok]
monitor                                         none                                1           [ok]
plugin.webman.gateway-worker.gateway            websocket://0.0.0.0:7272            1           [ok]
plugin.webman.gateway-worker.worker             none                                1           [ok]
plugin.webman.gateway-worker.register           text://127.0.0.1:1236               1           [ok]
plugin.webman.gateway-worker2.gateway           websocket://0.0.0.0:7373            1           [ok]
plugin.webman.gateway-worker2.worker            none                                1           [ok]
plugin.webman.gateway-worker2.register          text://127.0.0.1:1237               1           [ok]
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready. See http://doc2.workerman.net/send-buffer-to-worker-fail.html
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready. See http://doc2.workerman.net/send-buffer-to-worker-fail.html
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0

截图报错信息里报错文件相关代码

代码截图:
截图

报错截图:
截图

操作系统及workerman/webman等框架组件具体版本

win10

447 1 0
1个回答

wekyun

修改startPort端口和重启电脑

  • 暂无评论
×
🔝