校区服务
This commit is contained in:
16
config/autoload/nacos.php
Normal file
16
config/autoload/nacos.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use function Hyperf\Support\env;
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'host' => env('NACOS_HOST', '127.0.0.1'),
|
||||
'port' => env('NACOS_PORT', 8848),
|
||||
'username' => env('NACOS_USERNAME', 'nacos'),
|
||||
'password' => env('NACOS_PASSWORD', 'nacos'),
|
||||
'namespace' => env('NACOS_NAMESPACE', 'public'),
|
||||
'timeout' => 5.0,
|
||||
],
|
||||
];
|
||||
@@ -15,29 +15,29 @@ use function Hyperf\Support\env;
|
||||
return [
|
||||
'mode' => SWOOLE_PROCESS,
|
||||
'servers' => [
|
||||
[
|
||||
'name' => 'jsonrpc-http',
|
||||
'type' => Server::SERVER_HTTP,
|
||||
'host' => env('JSON_RPC_HOST', '0.0.0.0'),
|
||||
'port' => (int) env('JSON_RPC_PORT', 9620),
|
||||
'sock_type' => SWOOLE_SOCK_TCP,
|
||||
'callbacks' => [
|
||||
Event::ON_REQUEST => [HttpServer::class, 'onRequest'],
|
||||
],
|
||||
'settings' => [
|
||||
'open_eof_split' => true,
|
||||
'package_eof' => "\r\n",
|
||||
'package_max_length' => 1024 * 1024 * 2,
|
||||
],
|
||||
'options' => [
|
||||
// Whether to enable request lifecycle event
|
||||
'enable_request_lifecycle' => false,
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'jsonrpc-http',
|
||||
'type' => Server::SERVER_HTTP,
|
||||
'host' => env('JSON_RPC_HOST', '0.0.0.0'),
|
||||
'port' => (int) env('JSON_RPC_PORT', 9620),
|
||||
'sock_type' => SWOOLE_SOCK_TCP,
|
||||
'callbacks' => [
|
||||
Event::ON_REQUEST => [HttpServer::class, 'onRequest'],
|
||||
],
|
||||
'settings' => [
|
||||
'open_eof_split' => true,
|
||||
'package_eof' => "\r\n",
|
||||
'package_max_length' => 1024 * 1024 * 2,
|
||||
],
|
||||
'options' => [
|
||||
// Whether to enable request lifecycle event
|
||||
'enable_request_lifecycle' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
'settings' => [
|
||||
Constant::OPTION_ENABLE_COROUTINE => true,
|
||||
Constant::OPTION_WORKER_NUM => (int) env('SWOOLE_WORKER_NUM', swoole_cpu_num()), //swoole_cpu_num(),
|
||||
Constant::OPTION_WORKER_NUM => (int) env('SWOOLE_WORKER_NUM', swoole_cpu_num()), // swoole_cpu_num(),
|
||||
Constant::OPTION_PID_FILE => BASE_PATH . '/runtime/hyperf.pid',
|
||||
Constant::OPTION_OPEN_TCP_NODELAY => true,
|
||||
Constant::OPTION_MAX_COROUTINE => 100000,
|
||||
@@ -51,4 +51,10 @@ return [
|
||||
Event::ON_PIPE_MESSAGE => [PipeMessageCallback::class, 'onPipeMessage'],
|
||||
Event::ON_WORKER_EXIT => [WorkerExitCallback::class, 'onWorkerExit'],
|
||||
],
|
||||
// 健康检查配置(供Nacos检测服务状态)
|
||||
'health_check' => [
|
||||
'enable' => true,
|
||||
'path' => '/health',
|
||||
'interval' => 3,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use function Hyperf\Support\env;
|
||||
|
||||
return [
|
||||
'enable' => [
|
||||
'discovery' => true,
|
||||
'register' => true,
|
||||
],
|
||||
'consumers' => [],
|
||||
'providers' => [],
|
||||
'drivers' => [
|
||||
'enable' => true,
|
||||
'driver' => 'nacos',
|
||||
'registries' => [
|
||||
'nacos' => [
|
||||
// nacos server url like https://nacos.hyperf.io, Priority is higher than host:port
|
||||
// 'url' => '',
|
||||
// The nacos host info
|
||||
'host' => env('NACOS_HOST', '127.0.0.1'),
|
||||
'port' => env('NACOS_PORT', 8848),
|
||||
// The nacos account info
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
'guzzle' => [
|
||||
'config' => null,
|
||||
'username' => env('NACOS_USERNAME', 'nacos'),
|
||||
'password' => env('NACOS_PASSWORD', 'nacos'),
|
||||
'namespace' => env('NACOS_NAMESPACE', 'public'),
|
||||
'group_name' => env('NACOS_GROUP_NAME', 'DEFAULT_GROUP'),
|
||||
'service_name' => env('NACOS_SERVICE_NAME', 'hyperf-organization'),
|
||||
'protect_threshold' => 0.5,
|
||||
'metadata' => [
|
||||
'protocol' => 'jsonrpc-http',
|
||||
'server' => 'jsonrpc-http',
|
||||
'version' => '1.0.0',
|
||||
'weight' => 100,
|
||||
],
|
||||
'group_name' => 'api',
|
||||
'namespace_id' => env('NACOS_NAMESPACE', 'dev'),
|
||||
'heartbeat' => 5,
|
||||
'heartbeat_timeout' => 15,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user