2022-06-24 19:17:57 pid:28957 Worker[28957] process terminated with ERROR: E_ERROR "Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections in /root/webman/vendor/illuminate/database/Connectors/Connector.php:70
php8.1
webman 那里写了个接口 ,配置好了数据库,gateway-work没写代码 ,不到一分钟就报错
2022-06-24 19:34:16 pid:38372 Workerman[start.php] start in DEBUG mode 2022-06-24 19:35:12 pid:38869 Worker[38869] process terminated with ERROR: E_ERROR "Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections in /root/webman/vendor/illuminate/database/Connectors/Connector.php:70 Stack trace: #0 /root/webman/vendor/illuminate/database/Connectors/Connector.php(70): PDO->__construct() #1 /root/webman/vendor/illuminate/database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector->createPdoConnection() #2 /root/webman/vendor/illuminate/database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection() #3 /root/webman/vendor/illuminate/database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect() #4 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}() #5 /root/webman/vendor/illuminate/database/Connection.php(1168): call_user_func() #6 /root/webman/vendor/illuminate/database/Connection.php(1204): Illuminate\Database\Connection->getPdo() #7 /root/webman/vendor/illuminate/database/Connection.php(485): Illuminate\Database\Connection->getReadPdo() #8 /root/webman/vendor/illuminate/database/Connection.php(413): Illuminate\Database\Connection->getPdoForSelect() #9 /root/webman/vendor/illuminate/database/Connection.php(752): Illuminate\Database\Connection->Illuminate\Database\{closure}() #10 /root/webman/vendor/illuminate/database/Connection.php(719): Illuminate\Database\Connection->runQueryCallback() #11 /root/webman/vendor/illuminate/database/Connection.php(421): Illuminate\Database\Connection->run() #12 /root/webman/vendor/workerman/webman-framework/src/support/bootstrap/LaravelDb.php(79): Illuminate\Database\Connection->select() #13 /root/webman/vendor/workerman/workerman/Events/Select.php(233): support\bootstrap\LaravelDb::support\bootstrap\{closure}() #14 /root/webman/vendor/workerman/workerman/Events/Select.php(283): Workerman\Events\Select->tick() #15 /root/webman/vendor/workerman/workerman/Worker.php(2437): Workerman\Events\Select->loop() #16 /root/webman/vendor/workerman/workerman/Worker.php(1557): Workerman\Worker->run() #17 /root/webman/vendor/workerman/workerman/Worker.php(1399): Workerman\Worker::forkOneWorkerForLinux() #18 /root/webman/vendor/workerman/workerman/Worker.php(1373): Workerman\Worker::forkWorkersForLinux() #19 /root/webman/vendor/workerman/workerman/Worker.php(550): Workerman\Worker::forkWorkers() #20 /root/webman/start.php(112): Workerman\Worker::runAll() #21 {main} Next Illuminate\Database\QueryException: SQLSTATE[08004] [1040] Too many connections (SQL: select 1) in /root/webman/vendor/illuminate/database/Connection.php:759 Stack trace: #0 /root/webman/vendor/illuminate/database/Connection.php(719): Illuminate\Database\Connection->runQueryCallback() #1 /root/webman/vendor/illuminate/database/Connection.php(421): Illuminate\Database\Connection->run() #2 /root/webman/vendor/workerman/webman-framework/src/support/bootstrap/LaravelDb.php(79): Illuminate\Database\Connection->select() #3 /root/webman/vendor/workerman/workerman/Events/Select.php(233): support\bootstrap\LaravelDb::support\bootstrap\{closure}() #4 /root/webman/vendor/workerman/workerman/Events/Select.php(283): Workerman\Events\Select->tick() #5 /root/webman/vendor/workerman/workerman/Worker.php(2437): Workerman\Events\Select->loop() #6 /root/webman/vendor/workerman/workerman/Worker.php(1557): Workerman\Worker->run() #7 /root/webman/vendor/workerman/workerman/Worker.php(1399): Workerman\Worker::forkOneWorkerForLinux() #8 /root/webman/vendor/workerman/workerman/Worker.php(1373): Workerman\Worker::forkWorkersForLinux() #9 /root/webman/vendor/workerman/workerman/Worker.php(550): Workerman\Worker::forkWorkers() #10 /root/webman/start.php(112): Workerman\Worker::runAll() #11 {main} thrown in /root/webman/vendor/illuminate/database/Connection.php on line 759"
webman 启动后每个每个进程会主动连数据库,比如你启动100个进程,就会预先建立100个连接。要么你进程开太多了,要么数据库连接数上限太少了
webman + gatewaywork 默认启动有多少个进程 下面是我启动时候的提示,数量查了一下连接上限是151 看下面的启动时候的提示,我应该设置多少
1、查看GatewayWorker 数据库连接数量 + webman 进程数量(连接数) = 总共使用数据库连接数 2、查看mysql 服务器默认配置是多少连接数,你自己改一下配置文件。
webman 那里写了个接口 ,配置好了数据库,gateway-work没写代码 ,不到一分钟就报错
webman 启动后每个每个进程会主动连数据库,比如你启动100个进程,就会预先建立100个连接。要么你进程开太多了,要么数据库连接数上限太少了
webman + gatewaywork 默认启动有多少个进程
下面是我启动时候的提示,数量查了一下连接上限是151
看下面的启动时候的提示,我应该设置多少
Workerman[start.php] start in DEBUG mode
-------------------------------------------------------- WORKERMAN --------------------------------------------------------
Workerman version:4.0.39 PHP version:8.1.6 Event-Loop:\Workerman\Events\Select
--------------------------------------------------------- WORKERS ---------------------------------------------------------
proto user worker listen processes status
tcp root webman http://0.0.0.0:8787 128 [OK]
tcp root monitor none 1 [OK]
tcp root plugin.webman.gateway-worker.gateway websocket://0.0.0.0:7272 64 [OK]
tcp root plugin.webman.gateway-worker.worker none 128 [OK]
tcp root plugin.webman.gateway-worker.register text://0.0.0.0:1236 1 [OK]
1、查看GatewayWorker 数据库连接数量 + webman 进程数量(连接数) = 总共使用数据库连接数
2、查看mysql 服务器默认配置是多少连接数,你自己改一下配置文件。