hyperf icon indicating copy to clipboard operation
hyperf copied to clipboard

[QUESTION] consul Health Checks exception

Open eicesoft opened this issue 6 years ago • 3 comments

Before you submit this issue, you has been search all existed issues and search the documentation

  • [Health Checks ] I've been search all existed issues
  • [Health Checks ] I've been read all documentation

Describe your question

我自己写的服务注册到consul, 可以使用, 但是健康检查显示异常. 我需要怎么写健康检查呢

eicesoft avatar Apr 29 '20 08:04 eicesoft

贴代码

limingxinleo avatar Apr 29 '20 08:04 limingxinleo

服务的核心测试代码 `<?php /**

  • @RpcService(name="CalculatorService", protocol="jsonrpc-http", server="jsonrpc-http", publishTo="consul") */ class CalculatorService implements CalculatorServiceInterface {

    public function sum(int $a, int $b): int { return $a + $b; } } `

服务注册的配置 <?php return [ 'consumers' => [ [ 'name' => 'CalculatorService', 'service' => CalculatorServiceInterface::class, 'id' => CalculatorServiceInterface::class, // 可选 jsonrpc-http jsonrpc jsonrpc-tcp-length-check 'protocol' => 'jsonrpc-http', 'load_balancer' => 'random', 'registry' => [ 'protocol' => 'consul', 'address' => 'http://127.0.0.1:8500', ], // 'nodes' => [ // ['host' => '127.0.0.1', 'port' => 9506], // ], 'options' => [ 'connect_timeout' => 10.0, 'recv_timeout' => 10.0, 'settings' => [ 'open_eof_split' => true, 'package_eof' => "\r\n", ], 'pool' => [ 'min_connections' => 1, 'max_connections' => 32, 'connect_timeout' => 10.0, 'wait_timeout' => 3.0, 'heartbeat' => -1, 'max_idle_time' => 60.0, ], ], ] ], ];

eicesoft avatar Apr 29 '20 08:04 eicesoft

Consul健康检查截图看看呢?

limingxinleo avatar Apr 29 '20 10:04 limingxinleo