0

I am trying to set up a master-master MySQL replication (both active servers). As I'm doing this on Centos 7, I have to use MariaDB instead of MySQL, although it seems fairly similar.

So, before I set up the replication, I am trying to set auto-increment-increment to avoid primary key collisions. I set auto-increment-increment to 10 and set the offset to 8 (just random for now to check it works), restarted the entire server, then headed to PHPMyAdmin where I ran the following SQL:

INSERT INTO `table`(`rdm`) VALUES ('345');
INSERT INTO `table`(`rdm`) VALUES ('345');
INSERT INTO `table`(`rdm`) VALUES ('345');
INSERT INTO `table`(`rdm`) VALUES ('345');

However, the A_I key (id) was still only going up by 1 per each row. Is there another way you do A-I-I in MariaDB?

Here's my my.cnf file:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd


[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
# bind-address          = 127.0.0.1
server-id               = 1
# report_host           = master1
log_bin                 = /var/log/mysql/mariadb-bin
log_bin_index           = /var/log/mysql/mariadb-bin.index
relay_log               = /var/log/mysql/relay-bin
relay_log_index         = /var/log/mysql/relay-bin.index
# replicate-do-db       = testdb
auto-increment-increment = 10
auto-increment-offset    = 8
  • 1
    Please show the entire sequence of commands you executed, including the `CREATE TABLE`, and the resulting `SELECT` and what it output. – womble Aug 03 '15 at 22:28
  • I just used PHPMyAdmin to create the database and table, but other applications that have created databases also only increment by one – MyNameWouldGoHere Aug 04 '15 at 00:22
  • It seemed as though MariaDB was ignoring all the settings I put in that file, so I added them to a different config file inside `my.cnf.d` directory, but I'm getting the error "option not found" so I'm just going to instlal an older server version I think – MyNameWouldGoHere Aug 04 '15 at 00:46

1 Answers1

0

Well, in case anyone comes across this same error: I fixed it by installing a different version. Not too sure how I did it, but by using different yum repos, I managed to install a community version of MySQL, in which this works as expected