This class provides an API for "manually" configuring sharding, at the level of individual InterSystems IRIS Data Platform instances. More...
Static Public Member Functions | |
_.Library.Status | ActivateNewShards (_.Library.String MasterNamespace) |
This class provides an API for "manually" configuring sharding, at the level of individual InterSystems IRIS Data Platform instances. More... | |
_.Library.Status | AssignShard (_.Library.String MasterNamespace, _.Library.String ShardHost, _.Library.Integer ShardPort, _.Library.String ShardNamespace, _.Library.Integer ShardNumber, _.Library.String ShardMirrorName, _.Library.String ShardBackupHost, _.Library.Integer ShardBackupPort, _.Library.String ShardVIP) |
Assigns a shard to a master namespace. More... | |
_.Library.Status | ConnectFederatedTable (_.Library.String ShardNamespace, _.Library.String FederatedTableName, _.Library.String SourceNamespace, _.Library.String SourceTableName, _.Library.List ColumnList, _.Library.Boolean Force, _.Library.Boolean Verbose) |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases More... | |
_.Library.Status | CreateFederatedTable (_.Library.String ShardNamespace, _.Library.String FederatedTableName, _.Library.String SourceNamespace, _.Library.String SourceTableName, _.Library.List ColumnList, _.Library.Boolean Force, _.Library.Boolean Verbose) |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases More... | |
_.Library.Status | DeassignShard (_.Library.String MasterNamespace, _.Library.String ShardHost, _.Library.Integer ShardPort, _.Library.String ShardNamespace) |
De-assigns a shard from a master namespace to which it had previously been assigned. More... | |
_.Library.Status | DisconnectFederatedTable (_.Library.String ShardNamespace, _.Library.String FederatedTableName) |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases More... | |
_.Library.Status | DropFederatedTable (_.Library.String ShardNamespace, _.Library.String FederatedTableName) |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases More... | |
_.Library.Status | EnableSharding (_.Library.Integer MaxConn, _.Library.Boolean EnableAsShardServer, _.Library.String AllowedConnections) |
Enables the current InterSystems IRIS instance to act as a shard master or shard server. More... | |
_.Library.Status | GetConfig (_.Library.String Namespace, ConfigInfo) |
Retrieves configuration information about the sharded cluster to which the specified master or cluster namespace belongs. More... | |
_.Library.Status | GetFederatedTableInfo (_.Library.String ShardNamespace, _.Library.String FederatedTableName, _.Library.List Info) |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases More... | |
_.Library.Status | GetOption (_.Library.String MasterNamespace, _.Library.String OptionName, _.Library.Integer OptionValue) |
Gets the value of a sharding configuration option specified by name, within the scope. More... | |
_.Library.Status | ListShards (_.Library.String MasterNamespace) |
Lists the shards assigned to a specified master namespace, to the console or current device. More... | |
_.Library.Status | ReassignShard (_.Library.String MasterNamespace, _.Library.String ShardHost, _.Library.Integer ShardPort, _.Library.String ShardNamespace, _.Library.Integer ShardNumber, _.Library.String ShardMirrorName, _.Library.String ShardBackupHost, _.Library.Integer ShardBackupPort, _.Library.String ShardVIP) |
Re-assigns an existing data shard. More... | |
_.Library.Status | Rebalance (_.Library.String Namespace, _.Library.Integer TimeLimit, Report, _.Library.Integer MinBuckets) |
Rebalances existing sharded data across all current shards, including newly assigned ones. More... | |
_.Library.Status | Reinitialize (_.Library.String MasterNamespace, _.Library.Boolean IgnoreMappings) |
Reinitializes the internal mappings, connections, and cluster metadata of a sharded cluster which has been. More... | |
_.Library.Status | SetNodeIPAddress (_.Library.String NodeIPAddress) |
Specifies the IP address or DNS name to be used by this InterSystems IRIS instances, when. More... | |
_.Library.Status | SetOption (_.Library.String MasterNamespace, _.Library.String OptionName, _.Library.Integer OptionValue) |
Sets a specified sharding configuration option to a specified value, within the scope of. More... | |
_.Library.Status | VerifyShards (_.Library.String MasterNamespace, _.Library.Integer ShardNumber, _.Library.Integer QueryShardNumber, _.Library.Boolean ReturnFirstError) |
Verifies that assigned shards are reachable and are correctly configured. More... | |
![]() | |
_.Library.String | Help (_.Library.String method) |
This is a helper class that is used by the various SYSTEM classes to provide a Help method. More... | |
This class provides an API for "manually" configuring sharding, at the level of individual InterSystems IRIS Data Platform instances.
It can be used via the special $SYSTEM object, for example:
set status = $SYSTEM.Sharding.EnableSharding()
The $SYSTEM.Sharding API provides an alternative to using ICM (InterSystems Cloud Manager) to provision and configure sharded clusters, for scenarios ICM does not support, or situations where step-by-step manual control, or avoiding the use of containers, is preferred. Unlike ICM, which manages the entire process of installing and configuring InterSystems IRIS instances to function together as sharded clusters, the $SYSTEM.Sharding API adds only sharding-specific functionality, depending on other InterSystems IRIS tools and APIs for tasks such as installing InterSystems IRIS instances, configuring mirroring, or creating namespaces and databases.
Most of the $SYSTEM.Sharding API calls operate at the level of a specified master namespace. The two exceptions are <method>EnableSharding</method> and <method>SetNodeIPAddress</method>, which operate on an entire InterSystems IRIS instance (which may contain multiple master namespaces).
Terminology
API Usage
A InterSystems IRIS instance is enabled to act as a shard master or shard server by calling <method>EnableSharding</method>.
The set of shards belonging to a master namespace is defined by making repeated calls to <method>AssignShard</method>, one call for each shard.
Once shards have been assigned, <method>VerifyShards</method> can be called to verify that they are reachable and correctly configured.
If additional shards are assigned to a namespace that already contains sharded tables, and the new shards can't be reached for automatic verification during the calls to <method>AssignShard</method>, <method>ActivateNewShards</method> can be called to activate them, once they are reachable.
After new shards are assigned, existing sharded data can be rebalanced across all shards, including new ones, by calling <method>Rebalance</method>.
A shard can be removed from the set belonging to a master namespace by calling <method>DeassignShard</method>.
An existing data shard can be assigned a different shard namespace address by calling <method>ReassignShard</method>.
All the shards assigned to a master namespace can be listed by calling <method>ListShards</method>.
A non-default IP address or DNS name for connecting an InterSystems IRIS instance to other instances of sharded cluster can be specified by calling <method>SetNodeIPAddress</method>.
Sharding configuration options can be set by calling <method>SetOption</method>, and their values can be retrieved by calling <method>GetOption</method>.
|
static |
This class provides an API for "manually" configuring sharding, at the level of individual InterSystems IRIS Data Platform instances.
It can be used via the special $SYSTEM object, for example:
set status = $SYSTEM.Sharding.EnableSharding()
The $SYSTEM.Sharding API provides an alternative to using ICM (InterSystems Cloud Manager) to provision and configure sharded clusters, for scenarios ICM does not support, or situations where step-by-step manual control, or avoiding the use of containers, is preferred. Unlike ICM, which manages the entire process of installing and configuring InterSystems IRIS instances to function together as sharded clusters, the $SYSTEM.Sharding API adds only sharding-specific functionality, depending on other InterSystems IRIS tools and APIs for tasks such as installing InterSystems IRIS instances, configuring mirroring, or creating namespaces and databases.
Most of the $SYSTEM.Sharding API calls operate at the level of a specified master namespace. The two exceptions are <method>EnableSharding</method> and <method>SetNodeIPAddress</method>, which operate on an entire InterSystems IRIS instance (which may contain multiple master namespaces).
Terminology
API Usage
A InterSystems IRIS instance is enabled to act as a shard master or shard server by calling <method>EnableSharding</method>.
The set of shards belonging to a master namespace is defined by making repeated calls to <method>AssignShard</method>, one call for each shard.
Once shards have been assigned, <method>VerifyShards</method> can be called to verify that they are reachable and correctly configured.
If additional shards are assigned to a namespace that already contains sharded tables, and the new shards can't be reached for automatic verification during the calls to <method>AssignShard</method>, <method>ActivateNewShards</method> can be called to activate them, once they are reachable.
After new shards are assigned, existing sharded data can be rebalanced across all shards, including new ones, by calling <method>Rebalance</method>.
A shard can be removed from the set belonging to a master namespace by calling <method>DeassignShard</method>.
An existing data shard can be assigned a different shard namespace address by calling <method>ReassignShard</method>.
All the shards assigned to a master namespace can be listed by calling <method>ListShards</method>.
A non-default IP address or DNS name for connecting an InterSystems IRIS instance to other instances of sharded cluster can be specified by calling <method>SetNodeIPAddress</method>.
Sharding configuration options can be set by calling <method>SetOption</method>, and their values can be retrieved by calling <method>GetOption</method>.
Activates shards that could not be activated by prior calls to <method>AssignShard</method>.
If new data shards are assigned when sharded tables already exist, <method>AssignShard</method> attempts to connect to the newly assigned shards to verify them before they are activated. If this fails (either because the new shards are not reachable, or because they fail verification), <method>AssignShard</method> returns an error indicating that <method>ActivateNewShards</method> must be called to activate the new shards.
If this API call returns an error, it can be called again, after correcting the problem reported in the error, until it succeeds. If there are multiple shards requiring activation, none of them is activated until all of them can be successfully activated.
Newly assigned shards are always automatically activated, except in the case where sharded tables already exist and the new shards cannot be reached or cannot be verified. Therefore, <method>ActivateNewShards</method> never needs to be called unless new shards are assigned while sharded tables already exist.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Assigns a shard to a master namespace.
This API call can be used to assign a data shard or a query shard.
A data shard can be a namespace on a single InterSystems IRIS instance, or it can be a namespace whose globals database is mirrored.
A query shard must be a namespace on a single InterSystems IRIS instance, whose globals database is a remote database mapped to the globals database of the corresponding data shard. When assigning a query shard, the ShardNumber of the corresponding data shard must be specified, and that data shard must already have been assigned.
New data shards cannot be assigned if any sharded tables with user-defined shard keys already exist in the specified master namespace. If new data shards are assigned when sharded tables without user-defined shard keys already exist, this API call attempts to connect to the newly assigned shards to verify them before they are activated; if this fails (either because the new shards are not reachable, or because they fail verification), this API call returns an error indicating that <method>ActivateNewShards</method> must be called to activate the new shards.
New query shards can be assigned at any time, regardless of whether sharded tables already exist.
If a data shard has been flagged for pending removal by calling <method>DeassignShard</method> while sharded tables exist, and the shard's removal has not yet been completed by calling <method>Rebalance</method>, the pending removal can be cancelled by calling AssignShard. In that case, if the shard is mirrored, it optional whether to specify the ShardMirrorName, ShardBackupHost, and ShardBackupPort parameters, but an error is returned if they are specified, and do not match the actual mirror name, or the host and port of the shard's current backup failover member. Call <method>ListShards</method> to determine whether a shard is flagged for pending removal.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases
Connect an additional source table to a read-only federated table, which has been created by a previous call to <method>CreateFederatedTable</method>.
If a source table has already been connected to the specified FederatedTableName in the specified ShardNamespace, it is replaced by the source table specified by SourceTableName.
Parameters:
$lb( $lb(sourceColumnName1 [, federatedColumnName1 ] ), ...)
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
set status = $SYSTEM.Sharding.ConnectFederatedTable(,"Sample.Person","Samples","Sample.Person")
set status = $SYSTEM.Sharding.ConnectFederatedTable(,"Myschema.Person","Samples","Sample.Person",$lb($lb("name"),$lb("home_city","homecity"),$lb("age")))
|
static |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases
Creates a read-only federated table, based on a specified source table.
If the specified federated table already exists, this method re-creates it, based on the current definition of the source table.
The federated table is visible in any shard namespace of the sharded cluster to which the specified ShardNamespace belongs. The list of columns determined by this method, either based on the list of columns of the specified source table, or customized with the optional ColumnList argument, becomes the list of columns for the overall federated table. Additional source tables can be attached to this federated table, on any instance of this sharded cluster, by calling <method>ConnectFederatedTable</method> in that instance, specifying a ShardNamespace and SourceNamespace on that instance. Queries of a federated table span all currently-connected source tables.
Parameters:
$lb( $lb(sourceColumnName1 [, federatedColumnName1 ] ), ...)
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
set status = $SYSTEM.Sharding.CreateFederatedTable(,"Sample.Person","Samples","Sample.Person")
set status = $SYSTEM.Sharding.CreateFederatedTable(,"Myschema.Person","Samples","Sample.Person",$lb($lb("name"),$lb("home_city","homecity"),$lb("age")))
|
static |
De-assigns a shard from a master namespace to which it had previously been assigned.
This
removes the shard from the set of shards belonging to the master namespace.
This API call can be used to de-assign a data shard or a query shard.
If a data shard is de-assigned while any sharded tables exist, the data shard is not immediately removed, but is flagged for pending removal. The next call to <method>Rebalance</method> will move all sharded data from any shards that are flagged for pending removal, to other data shards, and will complete the process of removing the shards that are pending removal. The last remaining data shard in a cluster may not be de-assigned.
When a query shard is de-assigned, it is always immediately removed.
When de-assigning a data shard to which any query shards are currently assigned, those query shards are automatically de-assigned as well.
When de-assigning a mirrored data shard, the host and port of either failover member may be specified. In either case, both failover members are de-assigned as shards.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases
Disconnect this shard from a read-only federated table, which has been created by a previous call to <method>CreateFederatedTable</method>.
This method does not delete any data, and has no effect on any of the source tables that are connected to this federated table. It only disconnects any source table that was connected to this federated table on this shard, by a previous call to <method>CreateFederatedTable</method> or <method>ConnectFederatedTable</method>, and drops any proxy classes that were projected for this federated table in this shard namespace, unless those proxy classes are still needed for another federated table.
Parameters:
The name of the federated table from which to disconnect.
Examples:
set status = $SYSTEM.Sharding.DisconnectFederatedTable(,"Myschema.Person")
|
static |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases
Drop a read-only federated table, which has been created by a previous call to <method>CreateFederatedTable</method>.
This method does not delete any data, and has no effect on any of the source tables that are connected to this federated table. It only drops the federated table's definition, and drops any proxy classes that were projected for this federated table in any shard namespace of this sharded cluster, unless those proxy classes are still needed for another federated table.
Parameters:
The name of the federated table to be dropped.
Examples:
set status = $SYSTEM.Sharding.DropFederatedTable(,"Myschema.Person")
|
static |
Enables the current InterSystems IRIS instance to act as a shard master or shard server.
This API call provides a convenient way to perform several configuration steps which would otherwise need to be performed separately: Enables the ECP service. Sets the config options MaxServers and MaxServerConn. Optionally enables the sharding service, so this InterSystems IRIS instance can act as a shard server. Optionally configures a list of allowed connections for the sharding and ECP services.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Retrieves configuration information about the sharded cluster to which the specified master or cluster namespace belongs.
The information is returned in an array, passed by reference, under the following top-level subscripts: "Master" - Information about the cluster's master namespace and database, and the node on which they reside. For mirrored clusters, this subscript appears as "Master:Primary" or "Master:Backup" to distinguish the two failover members. "Shard", shard number - Information about the shard with the indicated shard number. For mirrored clusters, the shard number subscript includes "Primary", "Backup", or "DRAsync", separated from the shard number by a colon, for example "1:Primary". For query shards, the shard number subscript includes "Query", separated from the shard number by a colon. For DR async nodes or query shards, the subscript includes an additional colon-separated number, to distinguish between multiple DR async nodes or query shards with the same shard number, for example "1:DRAync:2" or "3:Query:1".
Configuration details for the master and each shard are returned under a second subscript (for the master) or third subscript (for shards) with the following values: "GlobalsDatabase" (master only) - the name of the master globals database. "GlobalsDirectory" (master only) - the directory path of the master globals database. "RoutinesDatabase" (master only) - the name of the master routines database. "RoutinesDirectory" (master only) - the directory path of the master routines database. "Database" (shards only) - the name of the shard database. "Directory" (shards only) - the directory path of the shard database. "Host" - the hostname or IP address of the machine hosting the node's InterSystems IRIS instance. "SuperServerPort" - the default port (Super Server port) of the InterSystems IRIS instance. "Namespace" - the name of the master or shard namespace.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Example:
Get configuration information for the 2-shard cluster whose master namespace is "IRISDM", returned in the array config:
set status = $SYSTEM.Sharding.GetConfig("IRISDM",.config)
zw config
config("Master","GlobalsDatabase")="IRISDM"
config("Master","GlobalsDirectory")="/home/iris/mgr/irisdm/"
config("Master","Host")="machine1"
config("Master","Namespace")="IRISDM"
config("Master","RoutinesDatabase")="IRISDM"
config("Master","RoutinesDirectory")="/home/iris/mgr/irisdm/"
config("Master","SuperServerPort")=1972
config("Shard",1,"Database")="IRISSHARD"
config("Shard",1,"Directory")="/home/iris/mgr/irisshard/"
config("Shard",1,"Host")="machine1"
config("Shard",1,"Namespace")="IRISCLUSTER"
config("Shard",1,"SuperServerPort")=1972
config("Shard",2,"Database")="IRISSHARD"
config("Shard",2,"Directory")="/home/iris/mgr/irisshard/"
config("Shard",2,"Host")="machine2"
config("Shard",2,"Namespace")="IRISCLUSTER"
config("Shard",2,"SuperServerPort")=1972
|
static |
Experimental Feature – InterSystems reserves the right to make backwards-incompatible changes to this API in future releases
Returns information about a specified federated table.
Parameters:
Info(shardNumber) = $lb(sourceNamespace, sourceTableName, columnList)
$lb( $lb(sourceColumnName1, federatedColumnName1), ...)
Info(shardNumber) = ""
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
set status = $SYSTEM.Sharding.GetFederatedTableInfo(,"Sample.Person",.personInfo)
|
static |
Gets the value of a sharding configuration option specified by name, within the scope.
of a specified master namespace.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Lists the shards assigned to a specified master namespace, to the console or current device.
The list contains a row for each shard, with information in columns under the following headings: Shard - the shard number (1 through number of shards). Host - the hostname or IP address of the machine hosting the shard. Port - the default port (Super Server port) of the InterSystems IRIS instance hosting the shard. Namespace- the shard namespace. Mirror - the mirror name, if the shard is mirrored. Role - the shard's role: (blank) - ordinary data shard. "Query" - query shard. "Primary" - primary failover member hosting mirrored shard. "Backup - backup failover member hosting mirrored shard. VIP - VIP for mirrored shard, if one is configured.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Re-assigns an existing data shard.
This API call assigns a different shard namespace (specified by
host, port, and namespace) to a shard number to which a data shard has previously been assigned.
The newly specified shard namespace can be a namespace on a single InterSystems IRIS instance, or it can be a namespace whose globals database is mirrored. It is expected to contain identical data to the namespace previously assigned to the specified ShardNumber. The caller is responsible for ensuring this.
This API call has the following use cases:
The globals database of the shard namespace is being relocated on a different InterSystems IRIS instance and/or host machine. The move itself is done outside of this API, and can be done in two general ways:
Dismount the source database, copy its IRIS.DAT file to its target location, and configure the new shard namespace with a globals database configured to use the copied IRIS.DAT file. This requires a maintenance window during which no applications access sharded tables in this master namespace.
Temporarily configure the source and target InterSystems IRIS instances as a mirrored set, with the target instance as backup failover member, backup the source database to the target database, and then promote the target instance to primary failover member. Applications can continue to access sharded tables throughout this process.
The source and target versions of the relocated shard can each either be mirrored or not. If the target is mirrored, the relocation can be done in multiple steps: first call ReassignShard to specify the target shard as a namespace on a single InterSystems IRIS instance, then after configuring the target as a mirror and backing up the target database to the backup failover member, call ReassignShard to re-specify the target shard as a mirrored namespace. If the relocation is done during a maintenance window, then ReassignShard only needs to be called once, after the target mirror is configured and the target database is up to date on both failover members.
The ability to relocate shards can be used to allow for future horizontal scaling, by initially configuring more shards than the number of of host machines, which multiple shards on each machine (each hosted on a different InterSystems IRIS instance), and later adding machines to the sharded cluster, and relocating shards to separate host machines.
A shard that was previously not mirrored is being reconfigured to be mirrored. In this case, specify the ShardHost, ShardPort, and ShardNamespace of the current shard namespace, specify the ShardMirrorName of the newly configured mirror, and specify the ShardBackupHost, ShardBackupPort, and (optionally) ShardVIP of the newly configured backup failover member.
A shard that was previously mirrored is being reconfigured as not mirrored, leaving what was previously the primary failover member as the sole instance hosting the shard. In this case, specify the ShardHost, ShardPort, and ShardNamespace of the current primary failover member, and do not specify values for ShardMirrorName, ShardBackupHost, ShardBackupPort, or ShardVIP.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Rebalances existing sharded data across all current shards, including newly assigned ones.
Causes future inserts to
all sharded tables to be balanced across all shards that exist at the time Rebalance is called.
Rebalancing, together with the capability to assign new shards, provides elasticity to sharded clusters.
Data is rebalanced at the granularity of "buckets". For tables with user-defined shard keys, rows of data are assigned to buckets based on a hash of the shard key. There are always 2048 buckets, and the number of rows per bucket varies depending on the size of a table. For tables with system-assigned shard keys, rows are assigned to buckets based on ranges of rowids. Each range contains 256,000 rowid values, providing a fixed maximum bucket size, and the number of buckets varies with the size of the table.
Internally, the shard locations of a table's buckets are recorded in a "shard map". All tables with user-defined shard keys share the same shard map, ensuring that they are always mutually "cosharded" (that is, rows with the same user-defined shard key value will be located in the same shard, for tables with the same number and order of shard key fields). For tables with system-assigned shard keys, each table has its own shard map (which is shared by any table that is specified to "COSHARD WITH" that table).
Rebalancing moves buckets from shards with more than average number of buckets to shards with less than average, until the bucket counts of all shards differ by at most 1. Rebalancing modifies the shard maps accordingly, so that internal logic can always find rows in their current locations, and newly inserted data will be stored in the shard to which rebalancing has moved the bucket to which the data belongs.
When, for all sharded tables, the buckets counts of all shards differ by no more than one, the cluster is considered to be completely rebalanced. By default, <method>Rebalance</method> runs until the cluster is completely rebalanced. If the TimeLimit argument is specified to restrict rebalancing to a maintenance window, multiple calls to <method>Rebalance</method> may be required to reach a completely rebalanced state. Between these calls, the cluster and all sharded data it contains is in a fully usable state, but is not yet taking full advantage of newly-added shards.
If any data shards are flagged for pending removal, due to calling <method>DeassignShard</method> or the <class>SYSTEM.Cluster</class> method Detach, all sharded data is moved from those shards to other shards that are not flagged for pending removal. In that case, the cluster is not considered to be completely rebalanced until all sharded data has been removed from shards that are flagged for pending removal. Once the cluster is completely rebalanced, Rebalance completes the process of removing the shards that are flagged for pending removal.
Parameters:
Returns detailed information about the rebalancing operation, in a subscripted variable, as follows:
Report("Completed"): Set to 1 if all sharded tables have been fully rebalanced, or 0 if further rebalancing is required. Report("Elapsed Seconds"): Elapsed time for executing this call, in seconds. Report("Buckets Moved"): The cumulative total number of buckets moved by this and previous calls, since rebalancing started. Report("Buckets To Move"): The total number of buckets remaining to be moved, for rebalancing of all sharded tables to be completed. Report("Maps",mapname,"Buckets Moved"): The cumulative number of buckets moved by this and previous calls, for the shard map identified by mapname, which is the class name of one of the tables which share this map, or the special map name "||udsk" used for tables with user defined shard keys. Report("Maps",mapname,"Buckets To Move"): The number of buckets remaining to be moved for the shard map identified by mapname. Report("Maps",mapname,"Average Time"): The average time for moving a bucket of the shard map identified by mapname, computed cumulatively since rebalancing started.
If Rebalance fails, leaving a bucket in an inconsistent, incompletely moved state, Report contains the following additional information: Report("Incomplete Move"): Map name identifying the shard map for which a move was incomplete. Report("Maps",mapname,"Incomplete Move","Bucket"): The bucket number of the shard map identified by mapname, which was incompletely moved. Report("Maps",mapname,"Incomplete Move","From Shard"): The shard number from which the bucket was being moved. Report("Maps",mapname,"Incomplete Move","To Shard"): The shard number to which the bucket was being moved. Report("Maps",mapname,"Incomplete Move","Action Needed"): The action needed to correct the situation, which will be automatically performed at the beginning of the next call to Rebalance. One of: "Delete New": Delete any data belonging to this bucket from the new location. A complete copy of this bucket is guaranteed to still exist at the old location. "Delete Old": Delete any data belonging to this bucket from the old location. A complete copy of this bucket is guaranteed to already exist at the new location. "Update Map": Update the shard map to record this bucket's new location. The bucket's data is guaranteed to have already been moved to the new location.
MinBuckets The minimum number of buckets to move during this call to Rebalance, regardless of the time limit (default 1).
If 0 is specified, no buckets will be moved if the average bucket move time for every shard map is greater than the specified time limit.
Returns: Status code reporting success or failure of this API call.
Notes:
Examples:
|
static |
Reinitializes the internal mappings, connections, and cluster metadata of a sharded cluster which has been.
"cloned".
A sharded cluster is cloned by copying its master and shard databases to a new set of IRIS instances, and reassigning the shards to the hosts, ports, and namespaces of their new locations. This method is called as the final step of the process.
Parameters:
Returns: Status code reporting success or failure of this API call.
Cluster cloning usage:
Examples:
|
static |
Specifies the IP address or DNS name to be used by this InterSystems IRIS instances, when.
interconnecting with other instances in a sharded cluster, rather than using the IP address resulting from resolving this machine's default hostname.
This API call does not need to be used in most sharded cluster deployment scenarios. It is only needed when neither DNS resolution of the default hostname, nor calling $SYSTEM.TCPDevice.LocalAddr() on an open TCP device, return an IP address that is usable for interconnecting nodes of a cluster. (For purposes of this discussion, the default hostname is the name returned by $piece($system,":",1) in an IRIS session).
When this API call is needed, it must be called in each instance of a sharded cluster, before any shards are assigned (in the case of a shard master instance), before any namespace in the current instance is assigned as a shard (in the case of a data shard or query shard instance), or before any sharded operations or other sharding API calls are made in this instance (in the case of a master app server instance). The same IP address or DNS name specified for a shard instance in this API call should also be passed as the ShardHost argument to <method>AssignShard</method> when assigning a namespace in the instance as a shard, rather than passing the machine's default hostname.
Parameters:
Returns: Status code reporting success or failure of this API call.
Notes:
Example:
|
static |
Sets a specified sharding configuration option to a specified value, within the scope of.
a specified master namespace.
All option values are integers, except in the case of MasterIPAddress. The supported options, with their allowed values and defaults, are as follows:
Option Name | Description | Allowed Values | Default |
---|---|---|---|
AutoVerify |
Should <method>AssignShard</method> automatically call <method>VerifyShards</method>? 1: Yes. 0: No. | 0/1 | No |
ConnectTimeout |
Timeout when connecting to a shard, in seconds. | =1 | 60 |
Debug |
Enables debug trace. 1: Enable all debug trace messages. Higher numbers: enable increasingly selective debug trace. Only recommended when working directly with InterSystems support. | 1-10 | No debug trace. |
DropIgnoreError |
Should errors occurring during DROP TABLE be ignored? 1: Yes. 0: No, return the error. | 0/1 | No |
MasterIPAddress |
IP address to use for master data server, rather than using DNS resolution on hostname. Deprecated, use <method>SetNodeIPAddress</method> instead. | Valid IP address | Use hostname. |
MirrorConnectAttempts |
Number of times to retry connecting to a mirrored shard. | =1 | 1 |
QuiesceAllowReads |
Should Backup.ShardedCluster.Quiesce allow reads? 1: Yes. 0: No, block reads as well as writes. | 0/1 | No |
RunQueriesAsync |
(DEPRICATED) Should queries be run asynchronously? 1: Yes. 0: No, run queries synchronously. This permits transparent completion in event of shard failover, when executing queries on mirrored data shards, but it prevents cancelling queries and increases the risk of filling the IRISTEMP database. This option is depricated. The recommended approach for transparent query failover handling is to assign a query shard for each data shard. | 0/1 | Run queries asynchronously. |
Parameters:
Returns: Status code reporting success or failure of this API call.
Examples:
|
static |
Verifies that assigned shards are reachable and are correctly configured.
Verifies either all shards that have been assigned to a specified master namespace (the simplest and recommended usage), or a specified data shard, or a specified query shard of a specified data shard.
For each shard verified, this API call verifies the following, and returns a specific error for each failure: The shard is reachable (the InterSystems IRIS instance hosting the shard is started, and can be reached via TCP/IP). The ECP and sharding services are enabled on the instance hosting the shard. If the sharding service on that instance has a list of allowed incoming connections, the host on which this API call is made is included in the list. The instance hosting the shard has the config parameters MaxServers and MaxServerConn set to sufficiently high values for the currently assigned set of shards. This checks for a value that is at least as great as the total number of InterSystems IRIS instances participating in the sharded cluster, including the shard master and each additional instance that hosts one or more shards, but not including any master app servers. For this purpose, a mirror counts as one instance. (If there are any master app servers participating in the sharded cluster, the number of master app servers must be added to the MaxServer and MaxServerConn settings on each instance in the sharded cluster, beyond the minimum value that is checked by this API call.) The instance hosting the shard does not require restart due to changes having been made to the CPF file and not yet activated. (Note that changes to MaxServers and MaxServerConn require restart before they are effective.) The shard namespace exists. The shard namespace is not the master namespace of some other sharded cluster, and has not already been assigned as a shard of some other sharded cluster. (<method>AssignShard</method> ensures that the same namespace is not assigned twice as a shard of the present sharded cluster.) For query shards, the shard namespace has as its default globals database a remote database that is mapped to the default globals database of the data shard to which the query shard is assigned. For mirrored shards, the instance assigned as primary failover member really is a mirror failover member, and really does have, as its backup failover member, the instance assigned as backup failover member (for this purpose, it does not matter which failover member is currently the primary; if the mirror is correctly configured, this API call transparently connects to whichever failover member is currently the primary, and verifies that the other failover member's host and port were correctly specified to <method>AssignShard</method>).
This API call also verifies that the master instance on which it is invoked has the ECP service enabled, has sufficient values for the config parameters MaxServers and MaxServerConn, and does not require restart due to changes not yet activated in the CPF file.
Parameters:
Returns: Status code reporting success or failure of this API call. If multiple shards fail verification, this is a nested status code indicating how many shards failed, which shards failed, and the specific error for each failed shard.
Notes:
Examples: