dotnet-etcd
4.2.0
See the version list below for details.
dotnet add package dotnet-etcd --version 4.2.0
NuGet\Install-Package dotnet-etcd -Version 4.2.0
<PackageReference Include="dotnet-etcd" Version="4.2.0" />
<PackageVersion Include="dotnet-etcd" Version="4.2.0" />
<PackageReference Include="dotnet-etcd" />
paket add dotnet-etcd --version 4.2.0
#r "nuget: dotnet-etcd, 4.2.0"
#:package dotnet-etcd@4.2.0
#addin nuget:?package=dotnet-etcd&version=4.2.0
#tool nuget:?package=dotnet-etcd&version=4.2.0
dotnet-etcd

A C# .NET (dotnet) GRPC client for etcd v3+
Supported .NET Versions
- .NET 5
- .NETCoreApp 3.1
- .NETCoreApp 3.0
- .NETCoreApp 2.2
- .NETCoreApp 2.1
- .NETCoreApp 2.0
- .NETStandard 2.1
- .NETStandard 2.0
- .NETFramework 4.8
- .NETFramework 4.7.2
- .NETFramework 4.7.1
- .NETFramework 4.7
- .NETFramework 4.6.2
- .NETFramework 4.6.1
- .NETFramework 4.6
Installing Package
Nuget package is published on nuget.org and can be installed in the following ways :
Nuget Package Manager
Install-Package dotnet-etcd
.NET CLI
dotnet add package dotnet-etcd
Paket CLI
paket add dotnet-etcd
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Usage :
Add using statement at the top of your class file
using dotnet_etcd;
Client Initialization
EtcdClient client = new EtcdClient("host1:port1:,...., hostN:portN");
// E.g.
EtcdClient etcdClient = new EtcdClient("https://localhost:23790,https://localhost:23791,https://localhost:23792");
Available Constructor Parameters
- caCert - String containing ca cert when using self signed certificates with etcd. Default : EmptyString
- clientCert - String containing client cert when using self signed certificates with client auth enabled in etcd. Default : EmptyString
- clientKey - String containing client key when using self signed certificates with client auth enabled in etcd. Default : EmptyString
- publicRootCa - Bool depicting whether to use publicy trusted roots to connect to etcd. Default : false.
Operations
A lot of methods have been implemented using etcd's default input/output parameters. I am simplifying a lot of methods by including more overloads as I come across use cases. If you have some, please feel free to raise and issue or a PR 😃
Key-Value Operations
Put a key
client.Put(<KEY_STRING>,<VALUE_STRING>);
// E.g Put key "foo/bar" with value "foobar"
client.Put("foo/bar","barfoo");
await client.PutAsync(<KEY_STRING>,<VALUE_STRING>);
// E.g Put key "foo/bar" with value "foobar" in async
await client.PutAsync("foo/bar","barfoo");
Get a key
client.GetVal(<KEY_STRING>);
// E.g Get key "foo/bar"
client.GetVal("foo/bar");
// To get full etcd response
client.Get("foo/bar");
await client.GetValAsync(<KEY_STRING>);
// E.g. Get key "foo/bar" in async
await client.GetValAsync("foo/bar");
// To get full etcd response
await client.GetAsync("foo/bar");
Get multiple keys with a common prefix
client.GetRange(<PREFIX_STRING>);
// E.g. Get all keys with pattern "foo/*"
client.GetRange("foo/");
await client.GetRangeAsync(<PREFIX_STRING>);
// E.g. Get all keys with pattern "foo/*" in async
await client.GetRangeAsync("foo/");
// E.g. Get all keys
await client.GetRangeAsync("");
Delete a key
client.Delete(<KEY_STRING>);
// E.g. Delete key "foo/bar"
client.Delete("foo/bar");
await client.DeleteAsync(<KEY_STRING>);
// E.g. Delete key "foo/bar" in async
await client.DeleteAsync("foo/bar");
Delete multiple keys with a common prefix
client.DeleteRange(<PREFIX_STRING>);
// E.g. Delete all keys with pattern "foo/*"
client.DeleteRange("foo/");
await client.DeleteRangeAsync(<PREFIX_STRING>);
// E.g. Delete all keys with pattern "foo/*" in async
await client.DeleteRangeAsync("foo/");
Watch Operations
Watch a key
WatchRequest request = new WatchRequest()
{
CreateRequest = new WatchCreateRequest()
{
Key = ByteString.CopyFromUtf8("foo")
}
};
etcdClient.Watch(request, print);
-------------------------------
// Print function that prints key and value from the watch response
private static void print(WatchResponse response)
{
if (response.Events.Count == 0)
{
Console.WriteLine(response);
}
else
{
Console.WriteLine($"{response.Events[0].Kv.Key.ToStringUtf8()}:{response.Events .Kv.Value.ToStringUtf8()}");
}
}
----------------------------------
// Print function that prints key and value from the minimal watch
// response data
private static void print(WatchEvent[] response)
{
foreach(WatchEvent e1 in response)
{
Console.WriteLine($"{e1.Key}:{e1.Value}:{e1.Type}");
}
}
Watch also has a simple overload as follows
etcdClient.Watch("foo", print);
More overloads are also available. You can check them using IntelliSense (Ctrl+Shift+Space). Detailed documentation coming soon.
Cluster Operations
Add a member into the cluster
MemberAddRequest request = new MemberAddRequest();
request.PeerURLs.Add("http://example.com:2380");
request.PeerURLs.Add("http://10.0.0.1:2380");
MemberAddResponse res = etcdClient.MemberAdd(request);
// Async
MemberAddResponse res = await etcdClient.MemberAddAsync(request);
// Do something with response
Remove an existing member from the cluster
MemberRemoveRequest request = new MemberRemoveRequest
{
// ID of member to be removed
ID = 651748107021
};
MemberRemoveResponse res = etcdClient.MemberRemove(request);
// Async
MemberRemoveResponse res = await etcdClient.MemberRemoveAsync(request);
// Do something with response
Update the member configuration
MemberUpdateRequest request = new MemberUpdateRequest
{
// ID of member to be updated
ID = 651748107021
};
request.PeerURLs.Add("http://10.0.0.1:2380");
MemberUpdateResponse res = etcdClient.MemberUpdate(request);
// Async
MemberUpdateResponse res = await etcdClient.MemberUpdateAsync(request);
// Do something with response
List all the members in the cluster
MemberListRequest request = new MemberListRequest();
etcdClient.MemberList(request);
MemberListResponse res = etcdClient.MemberList(request);
// Async
MemberListResponse res = await etcdClient.MemberListAsync(request);
// Do something with response
foreach(var member in res.Members)
{
Console.WriteLine($"{member.ID} - {member.Name} - {member.PeerURLs}");
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 2.1
- DnsClient (>= 1.3.2)
- Google.Protobuf (>= 3.14.0)
- Grpc.Core (>= 2.34.0)
-
.NETCoreApp 3.1
- DnsClient (>= 1.3.2)
- Google.Protobuf (>= 3.14.0)
- Grpc.Core (>= 2.34.0)
-
.NETStandard 2.0
- DnsClient (>= 1.3.2)
- Google.Protobuf (>= 3.14.0)
- Grpc.Core (>= 2.34.0)
-
.NETStandard 2.1
- DnsClient (>= 1.3.2)
- Google.Protobuf (>= 3.14.0)
- Grpc.Core (>= 2.34.0)
-
net5.0
- DnsClient (>= 1.3.2)
- Google.Protobuf (>= 3.14.0)
- Grpc.Core (>= 2.34.0)
NuGet packages (36)
Showing the top 5 NuGet packages that depend on dotnet-etcd:
| Package | Downloads |
|---|---|
|
NetCorePal.Extensions.Snowflake.Etcd
NetCorePal Cloud Framework |
|
|
Etcd.Microsoft.Extensions.Configuration
Etcd based configuration provider for Microsoft.Extensions.Configuration |
|
|
cm-catalog-etcd
A CM Catalog implementation using etcd. |
|
|
Etcd.Configuration
Get configuration from etcd configuration center. |
|
|
etcd.Provider.Cluster.Extensions
etcd客户端扩展,集群客户端刷新 |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on dotnet-etcd:
| Repository | Stars |
|---|---|
|
asynkron/protoactor-dotnet
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
|
|
|
netcorepal/netcorepal-cloud-framework
一个基于ASP.NET Core实现的整洁领域驱动设计落地战术框架。 A tactical framework for Clean Domain-Driven Design based on ASP.NET Core.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 8.1.0 | 31,599 | 12/21/2025 |
| 8.0.1 | 58,709 | 5/10/2025 |
| 8.0.0 | 5,085 | 3/22/2025 |
| 7.2.0 | 133,626 | 10/19/2024 |
| 7.1.1 | 31,716 | 8/4/2024 |
| 7.1.0 | 850 | 7/30/2024 |
| 7.0.0 | 2,831 | 7/14/2024 |
| 7.0.0-beta | 27,991 | 1/7/2024 |
| 6.2.0-beta | 25,989 | 12/7/2022 |
| 6.0.1 | 325,562 | 11/9/2022 |
| 6.0.0-beta.0 | 3,555 | 9/27/2022 |
| 5.2.1 | 184,888 | 7/16/2022 |
| 5.2.0 | 122,805 | 3/2/2022 |
| 5.1.0 | 78,536 | 10/19/2021 |
| 5.0.2 | 36,396 | 9/6/2021 |
| 5.0.2-alpha | 1,010 | 8/22/2021 |
| 5.0.0-alpha | 963 | 8/9/2021 |
| 4.2.0 | 479,512 | 12/8/2020 |
| 4.1.1 | 94,731 | 7/12/2020 |
Add .NET5 target