Ergänzen Konfigurationsdatei my.ini auf Master-Server:!!! softgate gmbh!!! Master und Slave binary logging format - mixed recommended binlog_format = ROW Enabling this option causes the master to write checksums for events written to the binary log binlog-checksum=crc32 Nur Master required unique id between 1 and 2^32-1 defaults to 1 if master-host is not set but will not function as a master if omitted server-id=1 Nur Slave required unique id between 1 and 2^32-1 defaults to 1 if master-host is not set but will not function as a master if omitted server-id=2 Seite 1 von 16
Whether updates received by a slave server from a master server should be logged to the slave's own binary log log-slave-updates=1 which database should be replicated replicate-do-db=mysql To control reading of checksums by the slave (from the relay) log slave-sql-verify-checksum=1 The relay log info log holds status information about the execution point within the slave's relay log relay-log-info-repository=table The master info log contains status and current configuration information for the slave's connection to the master master-info-repository=table Enabling this option causes the master to verify events from the binary log using checksums, and to stop with an error in the event of a mismatch master-verify-checksum=true Ergänzen Konfigurationsdatei my.ini auf Slave-Server:!!! softgate gmbh!!! Master und Slave Seite 2 von 16
binary logging format - mixed recommended binlog_format = ROW Enabling this option causes the master to write checksums for events written to the binary log binlog-checksum=crc32 Nur Master required unique id between 1 and 2^32-1 defaults to 1 if master-host is not set but will not function as a master if omitted server-id=1 Nur Slave required unique id between 1 and 2^32-1 defaults to 1 if master-host is not set but will not function as a master if omitted server-id=2 Whether updates received by a slave server from a master server should be logged to the slave's own binary log log-slave-updates=1 Seite 3 von 16
which database should be replicated replicate-do-db=test To control reading of checksums by the slave (from the relay) log slave-sql-verify-checksum=1 The relay log info log holds status information about the execution point within the slave's relay log relay-log-info-repository=table The master info log contains status and current configuration information for the slave's connection to the master master-info-repository=table Enabling this option causes the master to verify events from the binary log using checksums, and to stop with an error in the event of a mismatch master-verify-checksum=true Auf Primärserver einen User replic1 mit Passwort replic1 erstellen mit den Berechtigungen Replikation, Super, Reload und Select auf alle Tabellen Seite 4 von 16
Seite 5 von 16
Primärserver über MySQL-Command-Line aufrufen: Seite 6 von 16
Show master status Seite 7 von 16
Datenbank anhalten mit FLUSH TABLES WITH READ LOCK; Seite 8 von 16
Show master status; Seite 9 von 16
File WERTHEIM-bin.000002 und Position 4403 merken Export der Datenbank mit mysqldump --events --opt --user=root --password=mysql test > c:\temp\mysql\test.dmp Seite 10 von 16
Seite 11 von 16
Replikationsserver aufsetzen Import der Primärserver-DB in die Replikations-DB mit Mysqldump: Konfigurationsdaten über MySQL-Command-Line einspielen: stop slave; change master to master_user='replic1'; change master to master_password='replic1'; Seite 12 von 16
change master to master_host='192.168.1.1'; change master to master_log_file='wertheim-bin.000005'; change master to master_log_pos=566; start slave; show slave status\g Primärserver über MySQL-Command-Line aufrufen: Datenbank entsperren mit Unlock tables; Seite 13 von 16
Test-Tabelle auf Primärserver erstellen: drop table test.testtable; CREATE TABLE test.testtable ( id int(11) NOT NULL AUTO_INCREMENT, c char(10) DEFAULT NULL, PRIMARY KEY (id) ); insert into test.testtable values (null, 'aaa'), (null, 'bbb'), (null, 'ccc'); insert into test.testtable values (null, 'b'), (null, 'bb'), (null, 'bbb'); insert into test.testtable values (null, 'c'), (null, 'cc'), (null, 'ccc'); insert into test.testtable values (null, 'd'), (null, 'dd'), (null, 'ddd'); commit; select * from test.testtable; Seite 14 von 16
Seite 15 von 16
Auf Replikationsserver mit select überprüfen, ob repliziert select * from test.testtable; Seite 16 von 16