Couchbase.Extensions.DnsDiscovery
2.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Couchbase.Extensions.DnsDiscovery --version 2.0.0
NuGet\Install-Package Couchbase.Extensions.DnsDiscovery -Version 2.0.0
<PackageReference Include="Couchbase.Extensions.DnsDiscovery" Version="2.0.0" />
paket add Couchbase.Extensions.DnsDiscovery --version 2.0.0
#r "nuget: Couchbase.Extensions.DnsDiscovery, 2.0.0"
// Install Couchbase.Extensions.DnsDiscovery as a Cake Addin #addin nuget:?package=Couchbase.Extensions.DnsDiscovery&version=2.0.0 // Install Couchbase.Extensions.DnsDiscovery as a Cake Tool #tool nuget:?package=Couchbase.Extensions.DnsDiscovery&version=2.0.0
Couchbase.Extensions.DnsDiscovery
A .Net Core compatible DNS SRV mechanism for discovering a Couchbase cluster dynamically.
Getting Started
Assuming you have an installation of Couchbase Server and Visual Studio (examples with VSCODE forthcoming), do the following:
- Create a .NET Core Web Application using Visual Studio or VsCodeor CIL
- Install the package from NuGet or build from source and add reference
Configuration
To use, call AddCouchbaseDnsDiscovery
during the service registration process, usually in your Startup
class. You may choose whether or not to add this step based on the environment. Be sure to add the basic Couchbase configuration first.
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
Environment = env;
}
public IConfigurationRoot Configuration { get; }
public IHostingEnvironment Environment { get; }
public void ConfigureServices(IServiceCollection services)
{
// Register Couchbase with configuration section
services.AddCouchbase(Configuration.GetSection("Couchbase"));
if (Environment.IsProduction())
{
// Lookup DNS SRV records using the query _couchbase._tcp.services.local
services.AddCouchbaseDnsDiscovery("_couchbase._tcp.services.local");
// Note: the record name above could also be retreived from configuration
}
// Register other services, like .AddMvc()
}
The above configuration will perform a DNS SRV query (only in the Production environment). The results will be used to replace the Servers list in the Couchbase client configuration. Any servers listed in the configuration section will be thrown out.
Note that only the servers with the highest priority in the DNS SRV response will be used. For example, if the response returns 2 servers with a priority of 10 and 2 different servers with a priority of 20, the first set will be used to initialize the cluster. SRV record failover is not supported.
Additionally, due to the nature of Couchbase clusters, the weight fields in the DNS SRV records are ignored. However, the port is used and should normally be set to 8091.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.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. |
-
.NETStandard 2.0
- CouchbaseNetClient (>= 2.5.2)
- DnsClient (>= 1.0.1)
- Microsoft.Extensions.Logging (>= 1.1.2)
- Microsoft.Extensions.Options (>= 1.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.2 | 36,192 | 5/9/2018 |
2.0.1 | 5,679 | 3/1/2018 |
2.0.0 | 1,691 | 11/8/2017 |
1.0.2 | 4,750 | 8/7/2017 |
1.0.0 | 1,576 | 2/15/2017 |
1.0.0-beta4 | 909 | 1/26/2017 |
1.0.0-beta2 | 893 | 1/8/2017 |
Supports .NET Core 2.0