Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: empty etcd hosts #2376

Open
1511563371 opened this issue Sep 11, 2022 · 12 comments
Open

Problem: empty etcd hosts #2376

1511563371 opened this issue Sep 11, 2022 · 12 comments
Labels

Comments

@1511563371
Copy link

Describe the bug
A clear and concise description of what the bug is.

proto file:

syntax = "proto3"; 

package rpcUser;
option go_package="./rpcUser";

message UserRequest {
 string UserID = 1;
 string UserName = 2;
}

message UserResponse {
 string UserID = 1;
 string UserName = 2;
}

service UserInfo {
    rpc UserInfoSearch (UserRequest) returns (UserResponse);
}
XXX.yaml文件

Name: user.rpc
ListenOn: 0.0.0.0:8081
Etcd:
  Hosts:
  - 127.0.0.1:2379
  Key: user.rpc

ShopOwnerRpc:
  Etcd:
    Hosts:
      - 127.0.0.1:2379
    Key: shopowner.rpc
build and run: 
go run .

result:
XXXXX:39 empty etcd hosts
exit status 1


@kevwan
Copy link
Contributor

kevwan commented Sep 11, 2022

I'm not sure if it's your formatting issue. Check your yaml format first please.

@dobet
Copy link

dobet commented Nov 11, 2022

i meet this problem too. and i do this:
fmt.Println("has etcd ?", c.HasEtcd())
fmt.Println("etcd hosts:", c.Etcd.Hosts)
fmt.Println("validator etcd", c.Etcd.Validate())

i get:
has etcd ? true
etcd hosts: [etcd:2379]
validator etcd
2022/11/11 08:13:22 empty etcd hosts

@dobet
Copy link

dobet commented Nov 11, 2022

the Validate code is :
func (c EtcdConf) Validate() error {
if len(c.Hosts) == 0 {
return errEmptyEtcdHosts
} else if len(c.Key) == 0 {
return errEmptyEtcdKey
} else {
return nil
}
}

so, I print key and hosts
fmt.Println("has etcd ?", c.HasEtcd())
fmt.Println("etcd hosts:", c.Etcd.Hosts)
fmt.Println("etcd Key:", c.Etcd.Key)
fmt.Println("validator etcd", c.Etcd.Validate())

i got
has etcd ? true
etcd hosts: [etcd:2379]
etcd Key: order.rpc
validator etcd
2022/11/11 08:16:27 empty etcd hosts

@dobet
Copy link

dobet commented Nov 11, 2022

i found is my yaml xxxRpc config is nil, but the error is so simple

@zaunist
Copy link

zaunist commented Dec 9, 2022

I meet the same error..

@zaunist
Copy link

zaunist commented Dec 10, 2022

I meet the same error..

I wrote wrong config, after correction it's ok.

@dahaipublic
Copy link

empty etcd hosts
Name: identify.rpc
ListenOn: 0.0.0.0:9004

Etcd:
Hosts:
- etcd:2379
Key: identify.rpc

Mysql:
DataSource: root:123456@tcp(mysql:3306)/mall?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai

CacheRedis:

  • Host: redis:6379
    Type: node
    Pass:

Salt: HWVOFkGgPTryzICwd7qnJaZR9KQ2i8xe

ymal里面如何配置

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


empty etcd hosts
Name: identify.rpc
ListenOn: 0.0.0.0:9004

Etcd:
Hosts:
- etcd:2379
Key: identify.rpc

Mysql:
DataSource: root:123456@tcp(mysql:3306)/mall?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai

CacheRedis:

  • Host: redis:6379
    Type: node
    Pass:

Salt: HWVOFkGgPTryzICwd7qnJaZR9KQ2i8xe

ymal里面如何配置

@CaoLei-JS
Copy link

i found is my yaml xxxRpc config is nil, but the error is so simple

i found my yaml property name(xxxRpc) must be the same as in the config.go

@chenxinlong
Copy link

chenxinlong commented Dec 20, 2023

遇到同样的问题。 漏配置了 xxxRPC, 结果报错内容是 etcd 配置不存在。 这种问题很难怀疑到框架身上,排查了半天,抱着侥幸心理查到这里,结果真的是框架问题。

@kevwan

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Encountered the same problem. A was not configured, and the error message was that the etcd configuration does not exist.

@github-actions github-actions bot added the stale label Dec 23, 2024
@kevwan
Copy link
Contributor

kevwan commented Jan 28, 2025

遇到同样的问题。 漏配置了 xxxRPC, 结果报错内容是 etcd 配置不存在。 这种问题很难怀疑到框架身上,排查了半天,抱着侥幸心理查到这里,结果真的是框架问题。

@kevwan

You're not using the correct key, right?

@zeromicro zeromicro deleted a comment from github-actions bot Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants