1 / 6

Cấu hình Master site

Cấu hình Master site. 1. Thiết lập tài khoản tại máy chủ làm master để máy slave kết nối. Tài khoản phải đặt quyền REPLICATION SLAVE Logon root $ mysql –u root –p mysql –p<password> mysql> GRANT REPLICATION SLAVE ON *.* -> TO repl@‘192.168.1.2’ IDENTIFIED BY ‘somepass';.

balin
Télécharger la présentation

Cấu hình Master site

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cấu hình Master site 1. Thiết lập tài khoản tại máy chủ làm master để máy slave kết nối. Tài khoản phải đặt quyền REPLICATION SLAVE Logon root $mysql –u root –p mysql –p<password> mysql> GRANT REPLICATION SLAVE ON *.* -> TO repl@‘192.168.1.2’ IDENTIFIED BY ‘somepass';

  2. Cấu hình Master site 2. Khoá ghi vào bảng • mysql> FLUSH TABLES WITH READ LOCK; 3. Edit /etc/my.cnf [mysqld] log-bin=mysql-bin server-id=1

  3. Cấu hình Master site 3. Restart mysql 4.Ghi lại các giá trị của binary log và offset tại master mysql > SHOW MASTER STATUS; +---------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +---------------+----------+--------------+------------------+ | mysql-bin.003 | 73 | test | manual,mysql | +---------------+----------+--------------+------------------+

  4. Cấu hình Slave site 5. Stop mysql 6. Edit /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock server-id=2 replicate-ignore-table=amss.private replicate-do-db=amss master-user=repl master-password=somepass master-host=server12 set-variable=max_connection=250 log-bin=mysql-bin binlog-do-db=amss [mysql.server] user=mysql [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid

  5. Cấu hình Slave site mysql> stop slave mysql> CHANGE MASTER TO -> MASTER_HOST='master_host_name', -> MASTER_USER=‘repl', -> MASTER_PASSWORD=‘somepas', -> MASTER_LOG_FILE=‘mysql-bin.000003', -> MASTER_LOG_POS=73; mysql> start slave

  6. Monitor Mysql Slave Site mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.1.1 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000003 Read_Master_Log_Pos: 79 Relay_Log_File: linux2-relay-bin.000001 Relay_Log_Pos: 358 Relay_Master_Log_File: mysql-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: amss Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: amss.private Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 79 Relay_Log_Space: 358 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 1 row in set (0.00 sec)

More Related