MySQL Replikation repliziert nicht

haschi

Registered User
Hallo!

Hab vor 2 Tagen eine Master-Slave Replikation eingerichtet. Soweit klappt das auch, der Slave sammelt fleißig die Daten, nur scheinbar werden sie nicht in die DB übernommen. Der Stand vom Inhalt der Tabellen entspricht immer noch dem vom SQL-Dump.

Was kann ja jetzt schief laufen? Server und Client Versionen sind auf Master und Slave identisch.

Hier mal die Config:

Master
Code:
server-id = 1
log-bin = /var/log/mysql/bin.log 
expire_logs_days = 10 
max_binlog_size = 100M 
binlog_do_db = DB-name

Slave
Code:
server-id = 2
master-host = 12.12.12.12
#master-port = 3306
master-user = replication
master-password = *******
replicate-do-db = DB-name
binlog_do_db = DB-name
expire_logs_days = 10
max_binlog_size = 100M
log-bin = /var/log/mysql/bin.log
log-bin-index = /var/log/mysql/log-bin.index
log-error = /var/log/mysql/error.log
relay-log = /var/log/mysql/relay.log
relay-log-info-file = /var/log/mysql/relay-log.info
relay-log-index = /var/log/mysql/relay-log.index

/var/log/mysql/error.log
Code:
080111 20:54:17 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'bin.000107' position 24670874
080111 20:54:17 [Note] Slave I/O thread: connected to master 'replication@12.12.12.12:3306',  replication started in log 'bin.000108' at position 2654809

nach erneutem "slave start"
Code:
080111 20:58:23 [Note] Slave I/O thread: connected to master 'replication@12.12.12.12:3306',  replication started in log 'bin.000108' at position 2654809

Seit dem kein Eintrag mehr im error.log

Ich danke euch! :D

Gruß
Marco
 
schau dir nochmal die error.log genauer an, das problem liegt in der Zeile:

080111 20:54:17 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'bin.000107' position 24670874

Warum der gestoppt wurde, sollte eventuell weiter oben im log stehen.

Es müssen auf dem slave 2 Threads laufen, der IO-Thread welcher die Daten vom Master holt und ins relay log schreibt, und der SQL Thread welcher die aus dem relay log holt und in die DBs schreibt.

SHOW PROCESSLIST, sollte also 2 System User zeigen, im ruhefall einer mit Status "Waiting for master to send event" (->I/O-Thread) und einer mit "Has read all relay log; waiting for the slave I/O thread to update it" (-> SQL Thread) der zweitere läuft bei dir vermutlich nicht.
Eine zweite möglichkeit das zu testen ist SHOW SLAVE STATUS; die beiden Angaben Slave_IO_Running und Slave_SQL_Running.

Lösung: error log durchsuchen nach Ursache, abstellen und SLAVE STOP; SLAVE START; ... evtl. sogar mal den Slave selbst durchstarten. (hatte den fall, dass der SQL-Thread nach SLAVE STOP; SLAVE START; nicht laufen wollte, nach einen mysql restart klappte es dann.)
 
Back
Top