容器安装hyperf7.4 +consul 出现 guzzlehttp connection refused,消费者和提供者在同一个项目里
service消费者配置:
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'consumers' => [
[
// The service name, this name should as same as with the name of service provider.
'name' => 'CalculatorService',
// The service registry, if `nodes` is missing below, then you should provide this configs.
'service' => \App\JsonRpc\CalculatorServiceInterface::class,
// 对应容器对象 ID,可选,默认值等于 service 配置的值,用来定义依赖注入的 key
'id' => \App\JsonRpc\CalculatorServiceInterface::class,
'registry' => [
'protocol' => 'consul',
'address' => 'http://consul:8500',
],
// If `registry` is missing, then you should provide the nodes configs.
'nodes' => [
// Provide the host and port of the service provider.
// ['host' => 'The host of the service provider', 'port' => 9502]
],
],
],
'enable' => [
// 开启服务发现
'discovery' => true,
// 开启服务注册
'register' => true,
],
'drivers' => [
'consul' => [
'uri' => 'http://consul:8500',
'token' => '',
'check' => [
'deregister_critical_service_after' => '90m',
'interval' => '1s',
],
]
],
];
尝试安装hyperf/consule,docker network 实现hyperf和consul通信,然而没什么软用
希望能启动hyperf + consul发现监控