Etcd: v3 Member Add API does not have support for providing Member Name

Created on 20 Jun 2020  路  10Comments  路  Source: etcd-io/etcd

Member Add operation of gRPC api (v3) doesn't have an option to specify member name while adding a number.

For e.g., the same was possible with the v2 API like this:

```
curl -X PUT http://example.com/v2/keys/_etcd/registry/${UUID}/${member_id}?prevExist=false -d value="${member_name}=${member_peer_url_1}&${member_name}=${member_peer_url_2}"

Current MemberAddRequest contract:

message MemberAddRequest {
// peerURLs is the list of URLs the added member will use to communicate with the cluster.
repeated string peerURLs = 1;
// isLearner indicates if the added member is raft learner.
bool isLearner = 2;
}
```

Please help with a support / alternative for the same.

Thanks.

stale

All 10 comments

The member name is populated at runtime which is more flexible in my opinion.

Oh, so by design it hasn't been provided and going forward we are sticking with runtime generation approach ?

Oh, so by design it hasn't been provided and going forward we are sticking with runtime generation approach ?

@hexfusion Can you confirm whether going forward its going to be generated only and there would be no option for specifying member name ?

@shubhamranjan IIUC, when you launch an etcd node (after you have issued - etcdctl member add <> - command), you can specify name of the member using environment variables. Not sure what you mean by generated. cc @hexfusion

@shubhamranjan IIUC, when you launch an etcd node (after you have issued - etcdctl member add <> - command), you can specify name of the member using environment variables. Not sure what you mean by generated. cc @hexfusion

@agargi The etcdctl does has that provision in v2 to provide name but the v3 api gRPC contract doesn't have the same provision. Names are auto generated at the moment if you try to add it via v3.

What I have here is a dotnet lib which is just a wrapper on top of grpc contract provided by etcd. I want to add the same provision of adding a name as well while adding a new member.

For my graduation project I'm implementing a library for service discovery in .NET Core.
It works like that:

  • service can register itself on ETCD or Consul with some user friendy name
  • find other registered services with some name
  • unregister itself.

I ran into problem where I need to implement self registration, because my needs require to pass a name when registering service (adding member). As far as I understand, this is impossible now. You said that name can be set trough environment variables, but the case is that more different services can run in the same environment, soo I can't see this working out.
It would be nice to have an option to set name of member via code and not just by environment variables, like it was possible in version 2, if I understand correctly.

@alenjursic1997 Will using the command-line options work for you? You can specify the name either using an environment variable or as a command-line option (or configuration file). Please refer:

https://etcd.io/docs/v3.4.0/op-guide/configuration/

@agargi We need that ability via gRPC to do such things programatically instead of CLI. Invoking a CLI from code doesn't seem to be a good option.

@alenjursic1997 Will using the command-line options work for you? You can specify the name either using an environment variable or as a command-line option (or configuration file). Please refer:

https://etcd.io/docs/v3.4.0/op-guide/configuration/

I can't see this working out, because ETCD server is usually running on another machine. In this case CLI is not the option.
I agree with @shubhamranjan.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings