Skip to main content

Operations: Server: How to add database node?

AddDatabaseNodeOperation allows you to add extra node to database group.

Syntax

// Create the AddDatabaseNodeOperation
// Add a random node to 'Northwind' database-group
var addDatabaseNodeOp = new AddDatabaseNodeOperation("Northwind");

// Execute the operation by passing it to Maintenance.Server.Send
DatabasePutResult result = store.Maintenance.Server.Send(addDatabaseNodeOp);

// Can access the new topology
var numberOfReplicas = result.Topology.AllNodes.Count();
Parameters
databaseNamestringName of a database to add node
nodestringCluster node tag to extent database to. Default: random node tag.
Return Value
DatabasePutResultDatabase put result

Example I

// Create the AddDatabaseNodeOperation
// Add node C to 'Northwind' database-group
var addDatabaseNodeOp = new AddDatabaseNodeOperation("Northwind", "C");

// Execute the operation by passing it to Maintenance.Server.Send
DatabasePutResult result = store.Maintenance.Server.Send(addDatabaseNodeOp);

Example II

// add node C to 'Northwind' database group
store.Maintenance.Server.Send(new AddDatabaseNodeOperation("Northwind", "C"));