mysql data not replicating, but replication seems fine -
i have 4 machine mysql cluster running mariadb 10.0.21. have 2 masters setup, slaving off of each other. , 2 read-only slaves replicating 1st , 2nd db’s respectively.
in short, way setup this:
db1 replicates -> db2 db1 replicates -> db3 db2 replicates -> db1 db2 replicates -> db4
it's pretty basic 4 db setup.
the problem i'm having setup nagios user monitor cluster on 1st db.
i checked , log first 3 databases not 4th 1 nagios user. without creating nagios user on each db because i'm replicating mysql database on first 2 database machines.
but reason nagios user never created on db4 way on db2 tho replication seems fine on nodes.
as recall, have db 2 replicating 4th db.
and if show master status on db 2, can see i'm replicating mysql db:
mariadb [mysql]> show master status; +--------------------+----------+------------------------------+------------------+ | file | position | binlog_do_db | binlog_ignore_db | +--------------------+----------+------------------------------+------------------+ | mariadb-bin.000078 | 376 | jfwiki,jokefire,bacula,mysql | | +--------------------+----------+------------------------------+------------------+ 1 row in set (0.00 sec)
if check nagios user there on 2nd db, is.
mariadb [mysql]> select user,host,password user user 'nagios'; +--------+-------------+-------------------------------------------+ | user | host | password | +--------+-------------+-------------------------------------------+ | nagios | 52.4.204.96 | *somepasswordhash | +--------+-------------+-------------------------------------------+ 1 row in set (0.00 sec)
this user not created on db2, there because of replication.
and if check slave status on db4, replication seems fine:
[root@db4:~] #mysql -e "show slave status\g" | egrep "slave_io_state|master_host|slave_io_running|slave_sql_running|last_errno|seconds_behind_master" slave_io_state: waiting master send event master_host: db2.example.com slave_io_running: yes slave_sql_running: yes last_errno: 0 seconds_behind_master: 0
and if check presence of nagios user on db4 way did on db2, user isn't there:
mariadb [mysql]> select user,host user user 'nagios'; empty set (0.00 sec)
so question is, why did nagios user not replicated db4 way did db1 -> db2 , db1 -> db3? tho slave replication on db4 seems okay? log hosts using nagios user monitoring host.
here's full output of slave replication command on db4 in case missed grep earlier:
mariadb [(none)]> show slave status\g *************************** 1. row *************************** slave_io_state: waiting master send event master_host: db2.example.com master_user: jf_slave master_port: 3306 connect_retry: 60 master_log_file: mariadb-bin.000078 read_master_log_pos: 376 relay_log_file: db4-relay-bin.000044 relay_log_pos: 537 relay_master_log_file: mariadb-bin.000078 slave_io_running: yes slave_sql_running: yes replicate_do_db: replicate_ignore_db: replicate_do_table: replicate_ignore_table: replicate_wild_do_table: replicate_wild_ignore_table: last_errno: 0 last_error: skip_counter: 0 exec_master_log_pos: 376 relay_log_space: 1121 until_condition: none until_log_file: until_log_pos: 0 master_ssl_allowed: yes master_ssl_ca_file: /opt/mysql/ca.crt master_ssl_ca_path: master_ssl_cert: /opt/mysql/db4.example.com.crt master_ssl_cipher: master_ssl_key: /opt/mysql/db4.example.com.key seconds_behind_master: 0 master_ssl_verify_server_cert: no last_io_errno: 0 last_io_error: last_sql_errno: 0 last_sql_error: replicate_ignore_server_ids: master_server_id: 2 master_ssl_crl: /opt/mysql/ca.crt master_ssl_crlpath: using_gtid: no gtid_io_pos: 1 row in set (0.00 sec)
i seeing errors in mariadb logs on db4, they're no different errors i'm seeing on 1st 3 databases nagios user data replicated successfully.
151004 15:34:36 [note] error reading relay log event: slave sql thread killed 151004 15:34:36 [error] error reading packet server: lost connection mysql server during query ( server_errno=2013) 151004 15:34:36 [note] slave i/o thread killed while reading event 151004 15:34:36 [note] slave i/o thread exiting, read log 'mariadb-bin.000078', position 376 151004 15:36:47 [note] slave sql thread initialized, starting replication in log 'mariadb-bin.000078' @ position 376, relay log './db4-relay-bin.000042' position: 537 151004 15:36:47 [note] slave i/o thread: connected master 'jf_slave@db2.example.com:3306',replication started in log 'mariadb-bin.000078' @ position 376 151007 4:24:12 [note] error reading relay log event: slave sql thread killed 151007 4:24:12 [error] error reading packet server: lost connection mysql server during query ( server_errno=2013) 151007 4:24:12 [note] slave i/o thread killed while reading event 151007 4:24:12 [note] slave i/o thread exiting, read log 'mariadb-bin.000078', position 376 151007 4:28:20 [note] slave sql thread initialized, starting replication in log 'mariadb-bin.000078' @ position 376, relay log './db4-relay-bin.000043' position: 537 151007 4:28:20 [note] slave i/o thread: connected master 'jf_slave@db2.example.com:3306',replication started in log 'mariadb-bin.000078' @ position 376
so why there database inconsistency, when indicators of replication seem okay? why can't nagios user log db4 way can on 1st 3 db's?
thanks
because need set log_slave_updates in cnf file on each server.
Comments
Post a Comment