1

Topic: Error : Master - Master replication with MariaDB

============ Required information ====
- iRedMail version (check /etc/iredmail-release):  iRedMail-0.9.4
- Linux/BSD distribution name and version: Centos 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:

#MariaDB#
#show slave status\G;
Last_Errno: 1062
Last_Error: Error 'Duplicate entry '@.-213.165.64.0/23' for key 'account'' on query. Default database: 'iredapd'. Query: 'INSERT INTO greylisting_whitelists (comment, account, sender) VALUES ('AUTO-UPDATE: gmx.com', '@.', '213.165.64.0/23')'

*#testing, HA with 2 server#*
====


Hi,I have succeeded installing  Glusterfs for maildata, n i need to replicate data : amavisd,iredadmin,iredapd,roundcubemail,sogo

how do i replicate  amavisd,iredadmin,iredapd,roundcubemail,sogo ?
got an error :   'Duplicate entry '


#### SERVER 1 #####  /etc/my.cnf
server-id               = 1
log_bin                  = /var/log/mariadb/mariadb-bin.log
log-slave-updates
log-bin-index             = /var/log/mariadb/log-bin.index
log-error                 = /var/log/mariadb/error.log
relay-log                 = /var/log/mariadb/relay.log
relay-log-info-file             = /var/log/mariadb/relay-log.info
relay-log-index         = /var/log/mariadb/relay-log.index
auto_increment_increment = 10
auto_increment_offset = 1
binlog_do_db            = amavisd
binlog_do_db            = iredadmin
binlog_do_db            = iredapd
binlog_do_db            = roundcubemail
binlog_do_db            = sogo
binlog-ignore-db=test
binlog-ignore-db=information_schema
binlog-ignore-db=mysql
log-slave-updates
replicate-ignore-db=test
replicate-ignore-db=information_schema
replicate-ignore-db=mysql


#### SERVER 2 #####  /etc/my.cnf
server-id               = 2
log_bin                 = /var/log/mariadb/mariadb-bin.log
log-slave-updates
log-bin-index             = /var/log/mariadb/log-bin.index
log-error                 = /var/log/mariadb/error.log
relay-log                 = /var/log/mariadb/relay.log
relay-log-info-file             = /var/log/mariadb/relay-log.info
relay-log-index         = /var/log/mariadb/relay-log.index
auto_increment_increment = 10
auto_increment_offset = 2
binlog_do_db            = amavisd
binlog_do_db            = iredadmin
binlog_do_db            = iredapd
binlog_do_db            = roundcubemail
binlog_do_db            = sogo
binlog-ignore-db=test
binlog-ignore-db=information_schema
binlog-ignore-db=mysql
log-slave-updates
replicate-ignore-db=test
replicate-ignore-db=information_schema
replicate-ignore-db=mysql

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Error : Master - Master replication with MariaDB

t10 wrote:

Last_Error: Error 'Duplicate entry '@.-213.165.64.0/23' for key 'account'' on query. Default database: 'iredapd'. Query: 'INSERT INTO greylisting_whitelists (comment, account, sender) VALUES ('AUTO-UPDATE: gmx.com', '@.', '213.165.64.0/23')'

Both your servers update "iredapd" database with a cron job ("/opt/iredapd/tools/spf_to_greylist_whitelists.py"), so this duplicate issue may happen.

To avoid this issue, you can just run the job on one server.

For iredapd database, duplicate is not an issue, it's safe to ignore.

3 (edited by t10 2016-03-12 00:29:45)

Re: Error : Master - Master replication with MariaDB

ZhangHuangbin wrote:
t10 wrote:

Last_Error: Error 'Duplicate entry '@.-213.165.64.0/23' for key 'account'' on query. Default database: 'iredapd'. Query: 'INSERT INTO greylisting_whitelists (comment, account, sender) VALUES ('AUTO-UPDATE: gmx.com', '@.', '213.165.64.0/23')'

Both your servers update "iredapd" database with a cron job ("/opt/iredapd/tools/spf_to_greylist_whitelists.py"), so this duplicate issue may happen.

To avoid this issue, you can just run the job on one server.

For iredapd database, duplicate is not an issue, it's safe to ignore.

Thanks Zhang, problem is solved!

Btw, can i create new topic to share how to create HA iRedMail LDAP(sync) using glusterfs,HAProxy+KeepAlived, dbReplica ?
so i can see if there is a mistake.

4

Re: Error : Master - Master replication with MariaDB

t10 wrote:

Btw, can i create new topic to share how to create HA iRedMail LDAP(sync) using glusterfs,HAProxy+KeepAlived, dbReplica ?

Sure, sharing is always welcome. big_smile