mysql db replication issues

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
uaslam
Posts: 21
Joined: Fri Jun 14, 2013 10:38 am

mysql db replication issues

Post by uaslam »

I'm having trouble getting mysql replication to work properly.
I've followed this doc here http://community.nagios.org/2010/01/16/ ... tallation/
I've taken fresh DB dumps and started replication but it keeps complaining about duplicate entries. Here is a sample output for slave status.

Code: Select all

mysql> show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.20.120.74
                  Master_User: slave_user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: nagios-bin.000008
          Read_Master_Log_Pos: 14417469
               Relay_Log_File: mysqld-relay-bin.000003
                Relay_Log_Pos: 13713140
        Relay_Master_Log_File: nagios-bin.000008
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 1062
                   Last_Error: Error 'Duplicate entry '199' for key 'object_id'' on query. Default database: 'nagios'. Query: 'INSERT INTO nagios_hoststatus SET instance_id='1', host_object_id='199', status_update_time=FROM_UNIXTIME(1375206655), output='OK - 10\.20\.103\.2: rta 5\.459ms, lost 0%', long_output='', perfdata='rta=5\.459ms;3000\.000;5000\.000;0; pl=0%;80;100;;', current_state='0', has_been_checked='1', should_be_scheduled='1', current_check_attempt='1', max_check_attempts='5', last_check=FROM_UNIXTIME(1375206646), next_check=FROM_UNIXTIME(1375206955), check_type='0', last_state_change=FROM_UNIXTIME(1373976463), last_hard_state_change=FROM_UNIXTIME(1372645237), last_hard_state='0', last_time_up=FROM_UNIXTIME(1375206655), last_time_down=FROM_UNIXTIME(1373976393), last_time_unreachable=FROM_UNIXTIME(0), state_type='1', last_notification=FROM_UNIXTIME(0), next_notification=FROM_UNIXTIME(0), no_more_notifications='0', notifications_enabled='1', problem_has_been_acknowledged='0', acknowledgement_type='0', current_notification_numbe
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 13712994
              Relay_Log_Space: 14417917
              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: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1062
               Last_SQL_Error: Error 'Duplicate entry '199' for key 'object_id'' on query. Default database: 'nagios'. Query: 'INSERT INTO nagios_hoststatus SET instance_id='1', host_object_id='199', status_update_time=FROM_UNIXTIME(1375206655), output='OK - 10\.20\.103\.2: rta 5\.459ms, lost 0%', long_output='', perfdata='rta=5\.459ms;3000\.000;5000\.000;0; pl=0%;80;100;;', current_state='0', has_been_checked='1', should_be_scheduled='1', current_check_attempt='1', max_check_attempts='5', last_check=FROM_UNIXTIME(1375206646), next_check=FROM_UNIXTIME(1375206955), check_type='0', last_state_change=FROM_UNIXTIME(1373976463), last_hard_state_change=FROM_UNIXTIME(1372645237), last_hard_state='0', last_time_up=FROM_UNIXTIME(1375206655), last_time_down=FROM_UNIXTIME(1373976393), last_time_unreachable=FROM_UNIXTIME(0), state_type='1', last_notification=FROM_UNIXTIME(0), next_notification=FROM_UNIXTIME(0), no_more_notifications='0', notifications_enabled='1', problem_has_been_acknowledged='0', acknowledgement_type='0', current_notification_numbe
1 row in set (0.00 sec)
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: mysql db replication issues

Post by lmiltchev »

This is NOT an official nagios documentation, so we cannot guarantee how (or if) it is going to work. It's also quite old (January 16, 2010).
Having said that, I found this link - not sure if it will help, but it's worth checking it out:

http://forums.mysql.com/read.php?26,507 ... msg-507739
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked