Rate This Document
Findability
Accuracy
Completeness
Readability

(Optional) Deploying MySQL Primary/Secondary Replication on x86 Servers

MySQL replication architecture with one primary and one secondary databases requires at least two servers. If there is only one x86 server, skip this section. Otherwise, start deploying MySQL primary/secondary replication as the instructions below.

  1. Log in to the primary database.
    mysql -uroot -p -S /data/mysql/run/mysql.sock
  2. Verify that the value of log_bin of the primary database is ON.
    show variables like '%log_bin%';

    If the value of log_bin is OFF, perform the following operations to enable log_bin on the two x86 servers:
    1. Open the /etc/my.cnf file.
      vim /etc/my.cnf
    2. Press i to enter the insert mode and find the [mysqld] section in the file. If this section does not exist, add it. Modify the [mysqld] section as follows:
      log-error=/data/mysql/log/mysql.log
      pid-file=/data/mysql/run/mysqld.pid
      [mysqldump]
      quick
      [mysql]
      no-auto-rehash
      [client]
      default-character-set=utf8
      [mysqld]
      basedir=/usr/local/mysql
      socket=/data/mysql/run/mysql.sock
      tmpdir=/data/mysql/tmp
      datadir=/data/mysql/data
      default_authentication_plugin=caching_sha2_password
      port=3306
      user=mysql
      server-id=1 # The server-id of the primary database server is 1, and that of the secondary database 1 (x86) server is 2.
      log-bin=/data/mysql/data/mysql-bin
      relay_log=/data/mysql/relaylog/relay-bin
      report_host=x.x.x.x # Change x.x.x.x to the actual IP address. In this document, the IP address of the primary database server is 192.168.0.1, and the IP address of the secondary database 1 (x86) server is 192.168.0.2.
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Restart MySQL to make the configurations take effect. See 3 for the restart commands.
  3. Deploy MySQL primary/secondary replication on the x86 servers.

    Plan the nodes as in Table 3. After MySQL is successfully installed, the primary/secondary replication has no requirement for the server architecture. Therefore, you can configure the databases by referring to the "Deploying MySQL Primary-Secondary Replication" section of Kunpeng Documentation

    1. Configure the primary database. See Configuring the Primary Database.
    2. Configure the secondary database. See Configuring Secondary Databases.

      During the configuration of the secondary database, if the following error is displayed after the start slave; command is executed, see Authentication Error Occurs When MySQL Primary/Secondary Replication Is Deployed on an x86 Server to rectify the fault.

      Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection. Error_code: MY-002061