17.1.2.7 Setting the Source Configuration on the Replica
这是一篇协同翻译的文章,你可以点击『我来翻译』按钮来参与翻译。
To set up the replica to communicate with the source for replication, configure the replica with the necessary connection information. To do this, on the replica, execute the CHANGE REPLICATION SOURCE TO
statement (from MySQL 8.0.23) or CHANGE MASTER TO
statement (before MySQL 8.0.23), replacing the option values with the actual values relevant to your system:
mysql> CHANGE MASTER TO
-> MASTER_HOST='source_host_name',
-> MASTER_USER='replication_user_name',
-> MASTER_PASSWORD='replication_password',
-> MASTER_LOG_FILE='recorded_log_file_name',
-> MASTER_LOG_POS=recorded_log_position;
Or from MySQL 8.0.23:
mysql> CHANGE REPLICATION SOURCE TO
-> SOURCE_HOST='source_host_name',
-> SOURCE_USER='replication_user_name',
-> SOURCE_PASSWORD='replication_password',
-> SOURCE_LOG_FILE='recorded_log_file_name',
-> SOURCE_LOG_POS=recorded_log_position;
Note
Replication cannot use Unix socket files. You must be able to connect to the source MySQL server using TCP/IP.
The CHANGE REPLICATION SOURCE TO
| CHANGE MASTER TO
statement has other options as well. For example, it is possible to set up secure replication using SSL. For a full list of options, and information about the maximum permissible length for the string-valued options, see Section 13.4.2.1, “CHANGE MASTER TO Statement”.
Important
As noted in Section 17.1.2.3, “Creating a User for Replication”, if you are not using a secure connection and the user account named in the
SOURCE_USER
|MASTER_USER
option authenticates with thecaching_sha2_password
plugin (the default from MySQL 8.0), you must specify theSOURCE_PUBLIC_KEY_PATH
|MASTER_PUBLIC_KEY_PATH
orGET_SOURCE_PUBLIC_KEY
|GET_MASTER_PUBLIC_KEY
option in theCHANGE REPLICATION SOURCE TO
|CHANGE MASTER TO
statement to enable RSA key pair-based password exchange.
本文中的所有译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接
我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。