Skip to content

Commit 2589adf

Browse files
committed
RDBTC-245 Guide: Server wide connection strings Fixing code
1 parent b26a199 commit 2589adf

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

guides/server-wide-connection-string.mdx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ var sharedWarehouse = new SqlConnectionString
104104
What changes is where the definition lives. Instead of saving this connection string inside one database, you put it at the server-wide level. Internally, this is handled through dedicated Raft/Rachis commands in the cluster state machine, the same general pattern RavenDB already uses for other server-wide features. From the client side, you do not call those internal commands directly. You send the matching server operation through `Maintenance.Server`.
105105

106106
```c#
107-
// Client-facing server operation, following the server-wide pattern.
108-
// This is a brand-new feature. Confirm the exact operation name and
109-
// signature against the shipped release, as the public API surface and
110-
// Studio work were still being finalized at PR time.
107+
var serverWideConStr = new ServerWideConnectionString
108+
{
109+
ConnectionString = sharedWarehouse
110+
};
111+
111112
store.Maintenance.Server.Send(
112-
new PutServerWideConnectionStringOperation(sharedWarehouse));
113+
new PutServerWideConnectionStringOperation(serverWideConStr));
113114
```
114115

115116
The important part is not the exact internal command name. It is the behavior. Because the change goes through RavenDB’s consensus layer, it is not a loose setting that eventually makes its way around the cluster. Once accepted, the server-wide connection string is part of the cluster state and is consistent across the nodes in that cluster.
@@ -169,20 +170,23 @@ var sharedWarehouse = new SqlConnectionString
169170
ConnectionString = "Server=warehouse.internal;Database=Analytics;Uid=etl_user;"
170171
};
171172

172-
// The exclusion list identifies databases that should NOT receive this
173-
// particular server-wide string. Exact property/parameter names follow the
174-
// server-wide pattern and should be confirmed against the shipped release.
173+
// The exclusion list belongs to the ServerWideConnectionString wrapper,
174+
// not to the underlying connection string object.
175+
var serverWideConStr = new ServerWideConnectionString
176+
{
177+
ConnectionString = sharedWarehouse,
178+
ExcludedDatabases = new[] { "RegionalDb-EU" }
179+
};
180+
175181
store.Maintenance.Server.Send(
176-
new PutServerWideConnectionStringOperation(
177-
sharedWarehouse,
178-
excludedDatabases: new[] { "RegionalDb-EU" }));
182+
new PutServerWideConnectionStringOperation(serverWideConStr));
179183
```
180184

181-
The [exclusion list](/7.2/integrations/connection-strings/server-wide/add-or-update-connection-string) belongs to the connection string, not to the database. RegionalDb-EU can be excluded from the shared warehouse connection string while still using other server-wide definitions, such as a shared backup destination or a shared replication target. You are not opting the database out of server-wide configuration as a whole. You are only saying that this one shared destination does not apply to it.
185+
The [exclusion list](/7.2/integrations/connection-strings/server-wide/add-or-update-connection-string) belongs to the server-wide connection string, not to the database. RegionalDb-EU can be excluded from the shared warehouse connection string while still using other server-wide definitions, such as a shared backup destination or a shared replication target. You are not opting the database out of server-wide configuration as a whole. You are only saying that this one shared destination does not apply to it.
182186

183187
Most databases use the shared definition because they really do point at the same place. The exceptions stay local because they really are different. That gives you a clean split: one server-wide definition for the common path, and local connection strings only where the database has a good reason to be different.
184188

185-
In Studio, once the server-wide connection strings page is available, this same distinction should be visible instead of implied. A databases own Connection Strings view can show which entries come from the cluster level, so you do not have to guess whether a connection string is locally owned or resolved from a server-wide definition.
189+
In Studio, this same distinction is visible instead of implied. The **Manage Server > Server-Wide Connection Strings** view lists every server-wide definition in the cluster, and a database's own Connection Strings view shows which entries are propagated from the cluster level, so you do not have to guess whether a connection string is locally owned or resolved from a server-wide definition.
186190

187191
## Cheatsheet: per-database vs. server-wide
188192

0 commit comments

Comments
 (0)