[QUESTION] 不能从nacos获取RPC服务nodes
- Dominant language
- PHP
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 4h 21m
- Merged PRs (30d)
- 4
Description
### Describe your question
使用的是nacos 3.1,
coposer中使用
"hyperf/config-nacos": "~3.1.0",
"hyperf/rpc": "~3.1.0",
"hyperf/rpc-client": "^3.1",
"hyperf/rpc-server": "~3.1.0",
"hyperf/service-governance": "^3.1",
"hyperf/service-governance-nacos": "^3.1"
在nacos控制台中能看到注册的服务。如果注释掉serviser.php中的registry,使用默认的nodes是没有问题的。但是如果使用注册中心的话,找不到对应的服务。
` [
// 开启服务发现
'discovery' => true,
// 开启服务注册
'register' => true,
],
'consumers' => [
[
// The service name, this name should as same as with the name of service provider.
'name' => 'PortalService',
// The service registry, if `nodes` is missing below, then you should provide this configs.
'service' => \App\ServiceInterface\PortalInterface::class,
'id' => \App\ServiceInterface\PortalInterface::class,
'protocol' => 'jsonrpc',
// 负载均衡算法,可选,默认值为 random
'load_balancer' => 'random',
'registry' => [
'protocol' => 'nacos',
'address' => 'http://192.168.1.98:8848',
],
// If `registry` is missing, then you should provide the nodes configs.
// 'nodes' => [
// ['host' => '192.168.1.29', 'port' => 9503],
// ],
'options' => [
'connect_timeout' => 5.0,
'recv_timeout' => 5.0,
'settings' => [
// 根据协议不同,区分配置
'open_eof_split' => true,
'package_eof' => "\r\n",
],
],
],
],
'drivers' => [
'nacos' => [
// nacos server url like https://nacos.hyperf.io, Priority is higher than host:port
// 'url' => '',
// The nacos host info
'host' => '192.168.1.98',
'port' => 8848,
// The nacos account info
'username' => "xxxx",
'password' => "xxxxx",
'version' => '3',
'guzzle' => [
'config' => null,
],
'group_name' => 'DEFAULT_GROUP',
'namespace_id' => '074b3fa6-9a88-4f3c-82cc-a7300a7612f1',
'heartbeat' => 5,
'ephemeral'=>true,
],
],
];
`
Contributor guide
Assessment
This issue has not been assessed yet.