MySQL Shell API 8.0.40
Unified development interface for MySQL Products
|
Represents an InnoDB Cluster. More...
Methods | |
Undefined | addInstance (InstanceDef instance, Dictionary options) |
Adds an Instance to the cluster. More... | |
Dictionary | checkInstanceState (InstanceDef instance) |
Verifies the instance gtid state in relation to the cluster. More... | |
ClusterSet | createClusterSet (String domainName, Dictionary options) |
Creates a MySQL InnoDB ClusterSet from an existing standalone InnoDB Cluster. More... | |
ClusterSet | getClusterSet () |
Returns an object representing a ClusterSet. More... | |
Dictionary | describe () |
Describe the structure of the cluster. More... | |
Undefined | disconnect () |
Disconnects all internal sessions used by the cluster object. More... | |
Undefined | dissolve (Dictionary options) |
Dissolves the cluster. More... | |
Undefined | forceQuorumUsingPartitionOf (InstanceDef instance, String password) |
Restores the cluster from quorum loss. More... | |
String | getName () |
Retrieves the name of the cluster. More... | |
Dictionary | listRouters (Dictionary options) |
Lists the Router instances. More... | |
Dictionary | rejoinInstance (InstanceDef instance, Dictionary options) |
Rejoins an Instance to the cluster. More... | |
Undefined | removeInstance (InstanceDef instance, Dictionary options) |
Removes an Instance from the cluster. More... | |
Undefined | rescan (Dictionary options) |
Rescans the cluster. More... | |
Undefined | resetRecoveryAccountsPassword (Dictionary options) |
Reset the password of the recovery accounts of the cluster. More... | |
Dictionary | status (Dictionary options) |
Describe the status of the cluster. More... | |
Undefined | switchToSinglePrimaryMode (InstanceDef instance) |
Switches the cluster to single-primary mode. More... | |
Undefined | switchToMultiPrimaryMode () |
Switches the cluster to multi-primary mode. More... | |
Undefined | setPrimaryInstance (InstanceDef instance, Dictionary options) |
Elects a specific cluster member as the new primary. More... | |
Dictionary | options (Dictionary options) |
Lists the cluster configuration options. More... | |
Undefined | setOption (String option, String value) |
Changes the value of an option for the whole Cluster. More... | |
Undefined | setInstanceOption (InstanceDef instance, String option, String value) |
Changes the value of an option in a Cluster member. More... | |
Boolean | removeRouterMetadata (RouterDef routerDef) |
Removes metadata for a router instance. More... | |
Undefined | setupAdminAccount (String user, Dictionary options) |
Create or upgrade an InnoDB Cluster admin account. More... | |
Undefined | setupRouterAccount (String user, Dictionary options) |
Create or upgrade a MySQL account to use with MySQL Router. More... | |
Undefined | fenceAllTraffic () |
Fences a Cluster from All Traffic. More... | |
Undefined | fenceWrites () |
Fences a Cluster from Write Traffic. More... | |
Undefined | unfenceWrites () |
Unfences a Cluster. More... | |
Properties | |
String | name |
Retrieves the name of the cluster. | |
Represents an InnoDB Cluster.
The cluster object is the entry point to manage and monitor a MySQL InnoDB Cluster.
Undefined addInstance | ( | InstanceDef | instance, |
Dictionary | options | ||
) |
Adds an Instance to the cluster.
instance | Connection options for the target instance to be added. |
options | Optional dictionary with options for the operation. |
This function adds an Instance to a InnoDB cluster.
For additional information about MySQL connection data, see Connection Data.
The options dictionary may contain the following attributes:
The password may be contained on the instance definition, however, it can be overwritten if it is specified on the options.
The recoveryMethod option supports the following values:
The waitRecovery option supports the following values:
The recoveryProgress option supports the following values:
By default, if the standard output on which the Shell is running refers to a terminal, the waitRecovery option has the value of 3. Otherwise, it has the value of 2.
The exitStateAction option supports the following values:
If exitStateAction is not specified READ_ONLY will be used by default.
The ipAllowlist format is a comma separated list of IP addresses or subnet CIDR notation, for example: 192.168.1.0/24,10.0.0.1. By default the value is set to AUTOMATIC, allowing addresses from the instance private network to be automatically set for the allowlist.
This option is only used and allowed when communicationStack is set to XCOM.
The localAddress and groupSeeds are advanced options and their usage is discouraged since incorrect values can lead to Group Replication errors.
The value for localAddress is used to set the Group Replication system variable 'group_replication_local_address'. The localAddress option accepts values in the format: 'host:port' or 'host:' or ':port'. If the specified value does not include a colon (:) and it is numeric, then it is assumed to be the port, otherwise it is considered to be the host. When the host is not specified, the default value is the value of the system variable 'report_host' if defined (i.e., not 'NULL'), otherwise it is the hostname value. When the port is not specified, the default value is the port of the target instance if the communication stack in use by the Cluster is 'MYSQL', otherwise, port * 10 + 1 when the communication stack is 'XCOM'. In case the automatically determined default port value is invalid (> 65535) then an error is thrown.
The groupSeeds option is deprecated as of MySQL Shell 8.0.28 and is ignored. 'group_replication_group_seeds' is automatically set based on the current topology.
The value for exitStateAction is used to configure how Group Replication behaves when a server instance leaves the group unintentionally (for example after encountering an applier error) or exhausts its auto-rejoin attempts. When set to ABORT_SERVER, the instance shuts itself down. When set to READ_ONLY the server switches itself to super-read-only mode. When set to OFFLINE_MODE it switches itself to offline mode. In this mode, connected client users are disconnected on their next request and connections are no longer accepted, with the exception of client users that have the CONNECTION_ADMIN or SUPER privilege. The exitStateAction option accepts case-insensitive string values, being the accepted values: OFFLINE_MODE (or 2), ABORT_SERVER (or 1) and READ_ONLY (or 0).
The default value is READ_ONLY.
The value for memberWeight is used to set the Group Replication system variable 'group_replication_member_weight'. The memberWeight option accepts integer values. Group Replication limits the value range from 0 to 100, automatically adjusting it if a lower/bigger value is provided.
Group Replication uses a default value of 50 if no value is provided.
The value for autoRejoinTries is used to set the Group Replication system variable 'group_replication_autorejoin_tries' and configure how many times an instance will try to rejoin a Group Replication group after being expelled. In scenarios where network glitches happen but recover quickly, setting this option prevents users from having to manually add the expelled node back to the group. The autoRejoinTries option accepts positive integer values and, since 8.0.21, defaults to 3.
Undefined checkInstanceState | ( | InstanceDef | instance | ) |
Verifies the instance gtid state in relation to the cluster.
instance | An instance definition. |
Analyzes the instance executed GTIDs with the executed/purged GTIDs on the cluster to determine if the instance is valid for the cluster.
The instance definition is the connection data for the instance.
For additional information about MySQL connection data, see Connection Data.
The returned JSON object contains the following attributes:
The state of the instance can be one of the following:
The reason for the state reported can be one of the following:
ClusterSet createClusterSet | ( | String | domainName, |
Dictionary | options | ||
) |
Creates a MySQL InnoDB ClusterSet from an existing standalone InnoDB Cluster.
domainName | An identifier for the ClusterSet's logical dataset. |
options | Optional dictionary with additional parameters described below. |
Creates a ClusterSet object from an existing cluster, with the given data domain name.
Several checks and validations are performed to ensure that the target Cluster complies with the requirements for ClusterSets and if so, the Metadata schema will be updated to create the new ClusterSet and the target Cluster becomes the PRIMARY cluster of the ClusterSet.
InnoDB ClusterSet
A ClusterSet is composed of a single PRIMARY InnoDB Cluster that can have one or more replica InnoDB Clusters that replicate from the PRIMARY using asynchronous replication.
ClusterSets allow InnoDB Cluster deployments to achieve fault-tolerance at a whole Data Center / region or geographic location, by creating REPLICA clusters in different locations (Data Centers), ensuring Disaster Recovery is possible.
If the PRIMARY InnoDB Cluster becomes completely unavailable, it's possible to promote a REPLICA of that cluster to take over its duties with minimal downtime or data loss.
All Cluster operations are available at each individual member (cluster) of the ClusterSet. The AdminAPI ensures all updates are performed at the PRIMARY and controls the command availability depending on the individual status of each Cluster.
Please note that InnoDB ClusterSets don't have the same consistency and data loss guarantees as InnoDB Clusters. To read more about ClusterSets, see \? ClusterSet or refer to the MySQL manual.
Pre-requisites
The following is a non-exhaustive list of requirements to create a ClusterSet:
The options dictionary can contain the following values:
The clusterSetReplicationSslMode option supports the following values:
If clusterSetReplicationSslMode is not specified, it defaults to the value of the cluster's memberSslMode option.
ReplicaSet getClusterSet | ( | ) |
Returns an object representing a ClusterSet.
The returned object is identical to the one returned by createClusterSet() and can be used to manage the ClusterSet.
The function will work regardless of whether the target cluster is a PRIMARY or a REPLICA Cluster, but its copy of the metadata is expected to be up-to-date.
This function will also work if the PRIMARY Cluster is unreachable or unavailable, although ClusterSet change operations will not be possible, except for failover with forcePrimaryCluster().
shcore::Value describe | ( | void | ) |
Describe the structure of the cluster.
This function describes the structure of the cluster including all its information, ReplicaSets and Instances.
The returned JSON object contains the following attributes:
The defaultReplicaSet JSON object contains the following attributes:
Each instance dictionary contains the following attributes:
void disconnect | ( | ) |
Disconnects all internal sessions used by the cluster object.
Disconnects the internal MySQL sessions used by the cluster to query for metadata and replication information.
Undefined dissolve | ( | Dictionary | options | ) |
Dissolves the cluster.
options | Optional parameters as described below. |
This function stops group replication and unregisters all members from the cluster metadata.
It keeps all the user's data intact.
The options dictionary may contain the following attributes:
The force option (set to true) must only be used to dissolve a cluster with instances that are permanently not available (no longer reachable) or never to be reused again in a cluster. This allows to dissolve a cluster and remove it from the metadata, including instances than can no longer be recovered. Otherwise, the instances must be brought back ONLINE and the cluster dissolved without the force option to avoid errors trying to reuse the instances and add them back to a cluster.
Undefined forceQuorumUsingPartitionOf | ( | InstanceDef | instance, |
String | password | ||
) |
Restores the cluster from quorum loss.
instance | An instance definition to derive the forced group from. |
password | Optional string with the password for the connection. |
This function restores the cluster back into operational status from a loss of quorum scenario. Such a scenario can occur if a group is partitioned or more crashes than tolerable occur.
The instance definition is the connection data for the instance.
For additional information about MySQL connection data, see Connection Data.
Note that this operation is DANGEROUS as it can create a split-brain if incorrectly used and should be considered a last resort. Make absolutely sure that there are no partitions of this group that are still operating somewhere in the network, but not accessible from your location.
When this function is used, all the members that are ONLINE from the point of view of the given instance definition will be added to the group.
String getName | ( | ) |
Retrieves the name of the cluster.
String listRouters | ( | Dictionary | options | ) |
Lists the Router instances.
options | Optional dictionary with options for the operation. |
This function lists and provides information about all Router instances registered for the cluster.
Whenever a Metadata Schema upgrade is necessary, the recommended process is to upgrade MySQL Router instances to the latest version before upgrading the Metadata itself, in order to minimize service disruption.
The options dictionary may contain the following attributes:
Dictionary rejoinInstance | ( | InstanceDef | instance, |
Dictionary | options | ||
) |
Rejoins an Instance to the cluster.
instance | An instance definition. |
options | Optional dictionary with options for the operation. |
This function rejoins an Instance to the cluster.
The instance definition is the connection data for the instance.
For additional information about MySQL connection data, see Connection Data.
The options dictionary may contain the following attributes:
The password may be contained on the instance definition, however, it can be overwritten if it is specified on the options.
The ipAllowlist format is a comma separated list of IP addresses or subnet CIDR notation, for example: 192.168.1.0/24,10.0.0.1. By default the value is set to AUTOMATIC, allowing addresses from the instance private network to be automatically set for the allowlist.
This option is only used and allowed when communicationStack is set to XCOM.
The localAddress is an advanced option and its usage is discouraged since incorrect values can lead to Group Replication errors.
The value for localAddress is used to set the Group Replication system variable 'group_replication_local_address'. The localAddress option accepts values in the format: 'host:port' or 'host:' or ':port'. If the specified value does not include a colon (:) and it is numeric, then it is assumed to be the port, otherwise it is considered to be the host. When the host is not specified, the default value is the value of the system variable 'report_host' if defined (i.e., not 'NULL'), otherwise it is the hostname value. When the port is not specified, the default value is the port of the target instance if the communication stack in use by the Cluster is 'MYSQL', otherwise, port * 10 + 1 when the communication stack is 'XCOM'. In case the automatically determined default port value is invalid (> 65535) then an error is thrown.
Undefined removeInstance | ( | InstanceDef | instance, |
Dictionary | options | ||
) |
Removes an Instance from the cluster.
instance | An instance definition. |
options | Optional dictionary with options for the operation. |
This function removes an Instance from the cluster.
The instance definition is the connection data for the instance.
For additional information about MySQL connection data, see Connection Data.
The options dictionary may contain the following attributes:
The password may be contained in the instance definition, however, it can be overwritten if it is specified on the options.
The force option (set to true) must only be used to remove instances that are permanently not available (no longer reachable) or never to be reused again in a cluster. This allows to remove from the metadata an instance than can no longer be recovered. Otherwise, the instance must be brought back ONLINE and removed without the force option to avoid errors trying to add it back to a cluster.
Undefined rescan | ( | Dictionary | options | ) |
Rescans the cluster.
options | Optional Dictionary with options for the operation. |
This function rescans the cluster for new and obsolete Group Replication members/instances, as well as changes in the used topology mode (i.e., single-primary and multi-primary).
The options dictionary may contain the following attributes:
The value for addInstances and removeInstances is used to specify which instances to add or remove from the metadata, respectively. Both options accept list connection data. In addition, the "auto" value can be used for both options in order to automatically add or remove the instances in the metadata, without having to explicitly specify them.
'repairMetadata' is used to eliminate any inconsistencies detected in the Metadata. These inconsistencies may arise from a few scenarios, such as the failure of one or more commands. Clusters detected in the ClusterSet Metadata that do not qualify as valid members will be removed.
Undefined resetRecoveryAccountsPassword | ( | Dictionary | options | ) |
Reset the password of the recovery accounts of the cluster.
options | Dictionary with options for the operation. |
This function resets the passwords for all internal recovery user accounts used by the Cluster. It can be used to reset the passwords of the recovery user accounts when needed for any security reasons. For example: periodically to follow some custom password lifetime policy, or after some security breach event.
The options dictionary may contain the following attributes:
The use of the force option (set to true) is not recommended. Use it only if really needed when instances are permanently not available (no longer reachable) or never going to be reused again in a cluster. Prefer to bring the non available instances back ONLINE or remove them from the cluster if they will no longer be used.
String status | ( | Dictionary | options | ) |
Describe the status of the cluster.
options | Optional dictionary with options. |
This function describes the status of the cluster including its ReplicaSets and Instances. The following options may be given to control the amount of information gathered and returned.
The extended option supports Integer or Boolean values:
Undefined switchToSinglePrimaryMode | ( | InstanceDef | instance | ) |
Switches the cluster to single-primary mode.
instance | Optional An instance definition. |
This function changes a cluster running in multi-primary mode to single-primary mode.
The instance definition is the connection data for the instance.
For additional information about MySQL connection data, see Connection Data.
The instance definition is optional and is the identifier of the cluster member that shall become the new primary.
If the instance definition is not provided, the new primary will be the instance with the highest member weight (and the lowest UUID in case of a tie on member weight).
Undefined switchToMultiPrimaryMode | ( | ) |
Switches the cluster to multi-primary mode.
This function changes a cluster running in single-primary mode to multi-primary mode.
Undefined setPrimaryInstance | ( | InstanceDef | instance, |
Dictionary | options | ||
) |
Elects a specific cluster member as the new primary.
instance | An instance definition. |
options | Optional dictionary with options for the operation. |
This function forces the election of a new primary, overriding any election process.
The instance definition is the connection data for the instance.
For additional information about MySQL connection data, see Connection Data.
The instance definition is mandatory and is the identifier of the cluster member that shall become the new primary.
The options dictionary may contain the following attributes:
String options | ( | Dictionary | options | ) |
Lists the cluster configuration options.
options | Optional Dictionary with options. |
This function lists the cluster configuration options for its ReplicaSets and Instances. The following options may be given to control the amount of information gathered and returned.
Undefined setOption | ( | String | option, |
String | value | ||
) |
Changes the value of an option for the whole Cluster.
option | The option to be changed. |
value | The value that the option shall get. |
This function changes an option for the Cluster.
The accepted options are:
The value for the configuration option is used to set the Group Replication system variable that corresponds to it.
The exitStateAction option supports the following values:
If exitStateAction is not specified READ_ONLY will be used by default.
The consistency option supports the following values:
If consistency is not specified, EVENTUAL will be used by default.
The value for exitStateAction is used to configure how Group Replication behaves when a server instance leaves the group unintentionally (for example after encountering an applier error) or exhausts its auto-rejoin attempts. When set to ABORT_SERVER, the instance shuts itself down. When set to READ_ONLY the server switches itself to super-read-only mode. When set to OFFLINE_MODE it switches itself to offline mode. In this mode, connected client users are disconnected on their next request and connections are no longer accepted, with the exception of client users that have the CONNECTION_ADMIN or SUPER privilege. The exitStateAction option accepts case-insensitive string values, being the accepted values: OFFLINE_MODE (or 2), ABORT_SERVER (or 1) and READ_ONLY (or 0).
The default value is READ_ONLY.
The value for memberWeight is used to set the Group Replication system variable 'group_replication_member_weight'. The memberWeight option accepts integer values. Group Replication limits the value range from 0 to 100, automatically adjusting it if a lower/bigger value is provided.
Group Replication uses a default value of 50 if no value is provided.
The value for consistency is used to set the Group Replication system variable 'group_replication_consistency' and configure the transaction consistency guarantee which a cluster provides.
When set to BEFORE_ON_PRIMARY_FAILOVER, whenever a primary failover happens in single-primary mode (default), new queries (read or write) to the newly elected primary that is applying backlog from the old primary, will be hold before execution until the backlog is applied. When set to EVENTUAL, read queries to the new primary are allowed even if the backlog isn't applied but writes will fail (if the backlog isn't applied) due to super-read-only mode being enabled. The client may return old values.
When set to BEFORE, each transaction (RW or RO) waits until all preceding transactions are complete before starting its execution. This ensures that each transaction is executed on the most up-to-date snapshot of the data, regardless of which member it is executed on. The latency of the transaction is affected but the overhead of synchronization on RW transactions is reduced since synchronization is used only on RO transactions.
When set to AFTER, each RW transaction waits until its changes have been applied on all of the other members. This ensures that once this transaction completes, all following transactions read a database state that includes its changes, regardless of which member they are executed on. This mode shall only be used on a group that is used for predominantly RO operations to ensure that subsequent reads fetch the latest data which includes the latest writes. The overhead of synchronization on every RO transaction is reduced since synchronization is used only on RW transactions.
When set to BEFORE_AND_AFTER, each RW transaction waits for all preceding transactions to complete before being applied and until its changes have been applied on other members. A RO transaction waits for all preceding transactions to complete before execution takes place. This ensures the guarantees given by BEFORE and by AFTER. The overhead of synchronization is higher.
The consistency option accepts case-insensitive string values, being the accepted values: EVENTUAL (or 0), BEFORE_ON_PRIMARY_FAILOVER (or 1), BEFORE (or 2), AFTER (or 3), and BEFORE_AND_AFTER (or 4).
The default value is EVENTUAL.
The value for expelTimeout is used to set the Group Replication system variable 'group_replication_member_expel_timeout' and configure how long Group Replication will wait before expelling from the group any members suspected of having failed. On slow networks, or when there are expected machine slowdowns, increase the value of this option. The expelTimeout option accepts positive integer values and, since 8.0.21, defaults to 5 seconds.
The value for autoRejoinTries is used to set the Group Replication system variable 'group_replication_autorejoin_tries' and configure how many times an instance will try to rejoin a Group Replication group after being expelled. In scenarios where network glitches happen but recover quickly, setting this option prevents users from having to manually add the expelled node back to the group. The autoRejoinTries option accepts positive integer values and, since 8.0.21, defaults to 3.
The value for transactionSizeLimit is used to set the Group Replication system variable 'group_replication_transaction_size_limit' and configures the maximum transaction size in bytes which the Cluster accepts. Transactions larger than this size are rolled back by the receiving member and are not broadcast to the Cluster.
The transactionSizeLimit option accepts positive integer values and, if set to zero, there is no limit to the size of transactions the Cluster accepts
All members added or rejoined to the Cluster will use the same value.
The ipAllowlist format is a comma separated list of IP addresses or subnet CIDR notation, for example: 192.168.1.0/24,10.0.0.1. By default the value is set to AUTOMATIC, allowing addresses from the instance private network to be automatically set for the allowlist.
This option is only used and allowed when communicationStack is set to XCOM.
Tags
Tags make it possible to associate custom key/value pairs to a Cluster, storing them in its metadata. Custom tag names can be any string starting with letters and followed by letters, numbers and _. Tag values may be any JSON value. If the value is null, the tag is deleted.
Undefined setInstanceOption | ( | InstanceDef | instance, |
String | option, | ||
String | value | ||
) |
Changes the value of an option in a Cluster member.
instance | An instance definition. |
option | The option to be changed. |
value | The value that the option shall get. |
This function changes an option for a member of the cluster.
The instance definition is the connection data for the instance.
For additional information about MySQL connection data, see Connection Data.
The accepted options are:
The exitStateAction option supports the following values:
If exitStateAction is not specified READ_ONLY will be used by default.
The value for exitStateAction is used to configure how Group Replication behaves when a server instance leaves the group unintentionally (for example after encountering an applier error) or exhausts its auto-rejoin attempts. When set to ABORT_SERVER, the instance shuts itself down. When set to READ_ONLY the server switches itself to super-read-only mode. When set to OFFLINE_MODE it switches itself to offline mode. In this mode, connected client users are disconnected on their next request and connections are no longer accepted, with the exception of client users that have the CONNECTION_ADMIN or SUPER privilege. The exitStateAction option accepts case-insensitive string values, being the accepted values: OFFLINE_MODE (or 2), ABORT_SERVER (or 1) and READ_ONLY (or 0).
The default value is READ_ONLY.
The value for memberWeight is used to set the Group Replication system variable 'group_replication_member_weight'. The memberWeight option accepts integer values. Group Replication limits the value range from 0 to 100, automatically adjusting it if a lower/bigger value is provided.
Group Replication uses a default value of 50 if no value is provided.
The value for autoRejoinTries is used to set the Group Replication system variable 'group_replication_autorejoin_tries' and configure how many times an instance will try to rejoin a Group Replication group after being expelled. In scenarios where network glitches happen but recover quickly, setting this option prevents users from having to manually add the expelled node back to the group. The autoRejoinTries option accepts positive integer values and, since 8.0.21, defaults to 3.
The ipAllowlist format is a comma separated list of IP addresses or subnet CIDR notation, for example: 192.168.1.0/24,10.0.0.1. By default the value is set to AUTOMATIC, allowing addresses from the instance private network to be automatically set for the allowlist.
This option is only used and allowed when communicationStack is set to XCOM.
Tags
Tags make it possible to associate custom key/value pairs to a Cluster, storing them in its metadata. Custom tag names can be any string starting with letters and followed by letters, numbers and _. Tag values may be any JSON value. If the value is null, the tag is deleted.
The following pre-defined tags are available:
String removeRouterMetadata | ( | RouterDef | routerDef | ) |
Removes metadata for a router instance.
routerDef | identifier of the router instance to be removed (e.g. 192.168.45.70::system) |
MySQL Router automatically registers itself within the InnoDB cluster metadata when bootstrapped. However, that metadata may be left behind when instances are uninstalled or moved over to a different host. This function may be used to clean up such instances that no longer exist.
The Cluster.listRouters() function may be used to list registered router instances, including their identifier.
Undefined setupAdminAccount | ( | String | user, |
Dictionary | options | ||
) |
Create or upgrade an InnoDB Cluster admin account.
user | Name of the InnoDB cluster administrator account. |
options | Dictionary with options for the operation. |
This function creates/upgrades a MySQL user account with the necessary privileges to administer an InnoDB cluster.
This function also allows a user to upgrade an existing admin account with the necessary privileges before a dba.upgradeMetadata() call.
The mandatory argument user is the name of the MySQL account we want to create or upgrade to be used as Administrator account. The accepted format is username[@host] where the host part is optional and if not provided defaults to ''.
The options dictionary may contain the following attributes:
If the user account does not exist, either the password, requireCertIssuer or requireCertSubject are mandatory.
If the user account exists, the update option must be enabled.
The interactive option can be used to explicitly enable or disable the interactive prompts that help the user through the account setup process.
Undefined setupRouterAccount | ( | String | user, |
Dictionary | options | ||
) |
Create or upgrade a MySQL account to use with MySQL Router.
user | Name of the account to create/upgrade for MySQL Router. |
options | Dictionary with options for the operation. |
This function creates/upgrades a MySQL user account with the necessary privileges to be used by MySQL Router.
This function also allows a user to upgrade existing MySQL router accounts with the necessary privileges after a dba.upgradeMetadata() call.
The mandatory argument user is the name of the MySQL account we want to create or upgrade to be used by MySQL Router. The accepted format is username[@host] where the host part is optional and if not provided defaults to ''.
The options dictionary may contain the following attributes:
If the user account does not exist, either the password, requireCertIssuer or requireCertSubject are mandatory.
If the user account exists, the update option must be enabled.
Undefined fenceAllTraffic | ( | ) |
Fences a Cluster from All Traffic.
This function fences a Cluster from all Traffic by ensuring the Group Replication is completely shut down and all members are Read-Only and in Offline mode, preventing regular client connections from connecting to it.
Use this function when performing a PRIMARY Cluster failover in a ClusterSet to prevent a split-brain.
Undefined fenceWrites | ( | ) |
Fences a Cluster from Write Traffic.
This function fences a Cluster member of a ClusterSet from all Write Traffic by ensuring all of its members are Read-Only regardless of any topology change on it. The Cluster will be put into READ ONLY mode and all members will remain available for reads. To unfence the Cluster so it restores its normal functioning and can accept all traffic use Cluster.unfenceWrites().
Use this function when performing a PRIMARY Cluster failover in a ClusterSet to allow only read traffic in the previous Primary Cluster in the event of a split-brain.
The function is not permitted on standalone Clusters.
Undefined unfenceWrites | ( | ) |
Unfences a Cluster.
This function unfences a Cluster that was previously fenced to Write traffic with Cluster.fenceWrites().