mysql interview question 11: Talk about the MySQL master-slave replication model

Insert image description here

This article focuses on interviews. In interviews, you only need to answer the key points. You do not need to have a very in-depth answer to the framework. If you want to cope with the interview, it is enough. Grasp the key points.

Interviewer: Tell us about the MySQL master-slave replication model ?

The configuration steps for MySQL master-slave replication are as follows:

  1. Configure on the main server:

    • Open the configuration file my.cnf of the main server, enable the binary log function, configure parameters log-bin, and set a unique log file name, such as log-bin=mysql-bin.
    • Configure a unique server ID, you can use any integer, such as server-id=1.
    • Restart the main server to make the configuration take effect.
  2. Configure on the slave server:

    • Open the configuration file my.cnf of the slave server and configure a unique server ID that is different from the master server, such as server-id=2.
    • Configure the information for the slave server to connect to the master server, including the master server's IP address, replication account and password, such as:
      master-host = 主服务器IP地址
      master-user = 复制账户
      master-password = 复制账户密码
      master-port = 主服务器端口(默认为3306)
      
    • Restart the slave

Supongo que te gusta

Origin blog.csdn.net/qq_27471405/article/details/133563569
Recomendado
Clasificación