When you have created a ReplicaSet, you can use the
operation to add an instance as a read-only secondary replica of
the current primary of the ReplicaSet.
ReplicaSet
.addInstance()
The primary of the ReplicaSet must be reachable and available
during this operation. MySQL Replication is configured between the
added instance and the primary, using an automatically created
MySQL account with a random password. Before the instance can be
an operational secondary, it must be in a synchronistic
arrangement with the primary. This process is called
recovery
, and InnoDB ReplicaSet supports
different methods which you configure with the
recoveryMethod
option.
For an instance to be able to join a ReplicaSet, various
prerequisites must be satisfied. They are automatically checked by
,
and the operation fails if any issues are found.
ReplicaSet
.addInstance()
Use dba.configureReplicaSetInstance()
to
validate and configure binary log and replication related options
before adding an instance. MySQL Shell connects to the target
instance using the same user name and password used to obtain the
ReplicaSet
handle object. All instances of the
ReplicaSet are expected to have the same administrator account
with the same grants and passwords. You can create a custom
administrator account with the required grants when you configure
an instance with
dba.configureReplicaSetInstance()
option. See
Section 9.2, “Configuring InnoDB ReplicaSet Instances”.