Database Replication, Perfect, Until....
Posted: Fri Jan 09, 2015 1:18 pm
Hi, I have a clustered setup as you can read in my signature that works fine. I decided recently to try out database replication to have a hot backup. ( I know about changing ip's in case of failure. ) I also wanted replication for when my server is hamming it down at 800+ channels running a big report does not hurt anything.
So I setup database replication, and have no issues, go to system settings tell all reports to use slave DB. Realtime Works, Export calls works like a charm and fast etc...
However, I noticed this morning when I went to reports --> Admin Utilities --> Reset Campaign Lists
Upon doing so, all the sudden I noticed all my agents waiting for calls for a long time. I was like? WTH?
So I went back into system settings, and told Vicidial to not use slave server. Once again real time report working fine, among all other reports.
I logged into slave db, logged into mysql run this command
mysql>SHOW SLAVE STATUS\G;
And this is the error it proudced.
Error 'Duplicate entry '113176' for key 1' on query. Default database: 'asterisk'. Query: 'INSERT INTO vicidial_admin_log set event_date='2015-01-09 08:21:40', user='admin', ip_address='73.99.154.223', event_section='CAMPAIGNS', event_type='RESET', record_id='1001', event_code='ADMIN RESET CAMPAIGN LISTS', event_sql="select list_id from vicidial_lists where campaign_id=\'1001\' and active=\'Y\' order by list_id asc|", event_notes='''
Here is the whole output of that command:
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.230
Master_User: replicate
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000008
Read_Master_Log_Pos: 146656667
Relay_Log_File: slave-relay-bin.000004
Relay_Log_Pos: 1060897629
Relay_Master_Log_File: mysql-bin.000007
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 '113176' for key 1' on query. Default database: 'asterisk'. Query: 'INSERT INTO vicidial_admin_log set event_date='2015-01-09 08:21:40', user='admin', ip_address='74.100.156.223', event_section='CAMPAIGNS', event_type='RESET', record_id='1001', event_code='ADMIN RESET CAMPAIGN LISTS', event_sql="select list_id from vicidial_lists where campaign_id=\'1001\' and active=\'Y\' order by list_id asc|", event_notes='''
Skip_Counter: 0
Exec_Master_Log_Pos: 1060897492
Relay_Log_Space: 1220399405
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
1 row in set (0.00 sec)
ERROR:
No query specified
Thanks in advance!!
Kind Regards
-Nef
So I setup database replication, and have no issues, go to system settings tell all reports to use slave DB. Realtime Works, Export calls works like a charm and fast etc...
However, I noticed this morning when I went to reports --> Admin Utilities --> Reset Campaign Lists
Upon doing so, all the sudden I noticed all my agents waiting for calls for a long time. I was like? WTH?
So I went back into system settings, and told Vicidial to not use slave server. Once again real time report working fine, among all other reports.
I logged into slave db, logged into mysql run this command
mysql>SHOW SLAVE STATUS\G;
And this is the error it proudced.
Error 'Duplicate entry '113176' for key 1' on query. Default database: 'asterisk'. Query: 'INSERT INTO vicidial_admin_log set event_date='2015-01-09 08:21:40', user='admin', ip_address='73.99.154.223', event_section='CAMPAIGNS', event_type='RESET', record_id='1001', event_code='ADMIN RESET CAMPAIGN LISTS', event_sql="select list_id from vicidial_lists where campaign_id=\'1001\' and active=\'Y\' order by list_id asc|", event_notes='''
Here is the whole output of that command:
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.230
Master_User: replicate
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000008
Read_Master_Log_Pos: 146656667
Relay_Log_File: slave-relay-bin.000004
Relay_Log_Pos: 1060897629
Relay_Master_Log_File: mysql-bin.000007
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 '113176' for key 1' on query. Default database: 'asterisk'. Query: 'INSERT INTO vicidial_admin_log set event_date='2015-01-09 08:21:40', user='admin', ip_address='74.100.156.223', event_section='CAMPAIGNS', event_type='RESET', record_id='1001', event_code='ADMIN RESET CAMPAIGN LISTS', event_sql="select list_id from vicidial_lists where campaign_id=\'1001\' and active=\'Y\' order by list_id asc|", event_notes='''
Skip_Counter: 0
Exec_Master_Log_Pos: 1060897492
Relay_Log_Space: 1220399405
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
1 row in set (0.00 sec)
ERROR:
No query specified
Thanks in advance!!
Kind Regards
-Nef