MySQL Shell 8.0  /  MySQL InnoDB ReplicaSet  /  Configuring InnoDB ReplicaSet Instances

9.2 Configuring InnoDB ReplicaSet Instances

Use dba.configureReplicaSetInstance(instance) to configure each instance you want to use in your ReplicaSet. MySQL Shell can either connect to an instance and then configure it, or you can pass in an instance name to configure a specific remote instance. To use an instance in a ReplicaSet, it must support persisting settings. See Section 6.2.4, “Persisting Settings”.

When you connect to the instance for administration tasks, you require a user with suitable privileges. The preferred method to create users to administer a ReplicaSet is using the setupAdminAccount() operation. See. Alternatively, the dba.configureReplicaSetInstance() operation can optionally create an administrator account, if you provide the clusterAdmin option. The account is created with the correct set of privileges required to manage InnoDB ReplicaSet.

Important

The administrator account must have the same user name and password across all instances of the same cluster or replica set.

To configure the instance at rs-1:3306, with a cluster administrator named rsadmin, issue:

mysql-js> dba.configureReplicaSetInstance('root@rs-1:3306', {clusterAdmin: "'rsadmin'@'rs-1%'"});

The interactive prompt requests the password required by the specified user. To configure the instance MySQL Shell is currently connected to, you can specify a null instance definition. For example, issue:

mysql-js> dba.configureReplicaSetInstance('', {clusterAdmin: "'rsadmin'@'rs-1%'"});

The interactive prompt requests the password required by the specified user, this checks the instance which MySQL Shell is currently connected to is valid for use in an InnoDB ReplicaSet. Settings that are incompatible with InnoDB ReplicaSet are configured if possible. The cluster administrator account is created with the privileges required for InnoDB ReplicaSet.

You can define a password expiration using the clusterAdminPasswordExpiration option. This option can be set to a number of days, NEVER to never expire, or DEFAULT, to use the system default.

If you are using SSL certificates for authentication, you can add the certificate issuer and subject using the clusterAdminCertIssuer and clusterAdminCertSubject options, respectively.