Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having issues with MariaDB and Galera running on RHEL 6.4 & 6.2 64bit servers and getting them to cluster. I installed the required RPM's for Galera clustering:

  • MariaDB-Galera-server
  • MariaDB-client
  • MariaDB-compat
  • MariaDB-common
  • MariaDB-shared
  • MariaDB-test
  • galera

Then after installing MariaDB and all of its components, I checked the directories where it normally keeps its files, /var/lib/mysql/ and /var/log/mysql/ and performed a

chown -R mysql:mysql /var/lib/mysql/
chown -R mysql:mysql /var/log/mysql/

I started both servers in standalone mode and configured a replication user:

grant all privileges on *.* to 'mariadb-user'@'localhost' identified by 'password' with grant option;
grant all privileges on *.* to 'mariadb-user'@'%' identified by 'password' with grant option;

That way, I would have a user for the databases to communicate with. Then I edited my configs on both the Master and Slave nodes:

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]
general_log_file=/var/log/mysql/mysqld.log
general_log=1
log_warning=2
log-error=/var/log/mysql/error.log
#log-bin=/var/log/mysql-bin.log
log-slow-queries=/var/log/mysql-slow-queries.log
# this is only for the mysqld standalone daemon
[mysqld]

# this is only for embedded server
[embedded]

# This group is only read by MariaDB-5.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mysqld-5.5]

# These two groups are only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
wsrep_cluster_address=gcomm://mariadb-master.net,mariadb-slave.net
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1
wsrep_cluster_name=corp-zabbix-server
wsrep_debug=on
wsrep_sst_auth=mariadb-user:cerner
##wsrep_sst_auth=root:
wsrep_sst_method=mysqldump
##wsrep_sst_method=xtrabackup
[mariadb-5.5]

Once the configs were in place, I made sure that the firewalls allowed the traffic to go through, basically by just wiping them out iptables -F. Then I initialized the cluster on the master using:

/etc/init.d/mysql start --wsrep_cluster_address=gcomm://

The Process comes up on the Master node, and on the Slave node using:

service mysql start

The slave node then connects for a bit, exchanges states, and exits saying that the operation is not permitted.

MariaDB_Error_Log at Pastebin.com

This is the output from /var/log/mysql/mysql.log:

/usr/sbin/mysqld, Version: 5.5.32-MariaDB-log (MariaDB Server, wsrep_23.7.5.rXXXX). started with:
Tcp port: 0  Unix socket: (null)
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.32-MariaDB-log (MariaDB Server, wsrep_23.7.5.rXXXX). started with:
Tcp port: 0  Unix socket: (null)
Time                 Id Command    Argument
130910  8:18:48     3 Connect   mariadb-user@mariadb-master.net as anonymous on
                    3 Query     select @@version_comment limit 1
                    3 Query     SET wsrep_on=OFF
                    3 Query     SELECT @@GENERAL_LOG
                    3 Quit
                    4 Connect   mariadb-user@mariadb-master.net as anonymous on
                    4 Query     select @@version_comment limit 1
                    4 Query     SET wsrep_on=OFF
                    4 Query     SELECT @@SLOW_QUERY_LOG
                    4 Quit
                    5 Connect   mariadb-user@mariadb-master.net as anonymous on
                    5 Query     select @@version_comment limit 1
                    5 Query     SET wsrep_on=OFF
                    5 Query     SET GLOBAL GENERAL_LOG=OFF
/usr/sbin/mysqld, Version: 5.5.32-MariaDB-log (MariaDB Server, wsrep_23.7.5.rXXXX). started with:
Tcp port: 3306  Unix socket: /var/lib/mysql/mysql.sock
Time                 Id Command    Argument
130910  8:18:50     7 Query     SET GLOBAL SLOW_QUERY_LOG=1
                    7 Quit
130910  8:18:51     8 Connect   mariadb-user@mariadb-master.net as anonymous on
                    8 Query     select @@version_comment limit 1
                    8 Query     SET wsrep_on=OFF
                    8 Query     SELECT @@GENERAL_LOG
                    8 Quit
                    9 Connect   mariadb-user@mariadb-master.net as anonymous on
                    9 Query     select @@version_comment limit 1
                    9 Query     SET wsrep_on=OFF
                    9 Query     SELECT @@SLOW_QUERY_LOG
                    9 Quit
                   10 Connect   mariadb-user@mariadb-master.net as anonymous on
                   10 Query     select @@version_comment limit 1
                   10 Query     SET wsrep_on=OFF
                   10 Query     SET GLOBAL GENERAL_LOG=OFF
/usr/sbin/mysqld, Version: 5.5.32-MariaDB-log (MariaDB Server, wsrep_23.7.5.rXXXX). started with:
Tcp port: 3306  Unix socket: /var/lib/mysql/mysql.sock
Time                 Id Command    Argument
130910  8:18:52    12 Query     SET GLOBAL SLOW_QUERY_LOG=1
                   12 Quit
130910  8:18:53    13 Connect   mariadb-user@mariadb-master.net as anonymous on
                   13 Query     select @@version_comment limit 1
                   13 Query     SET wsrep_on=OFF
                   13 Query     SELECT @@GENERAL_LOG
                   13 Quit
                   14 Connect   mariadb-user@mariadb-master.net as anonymous on
                   14 Query     select @@version_comment limit 1
                   14 Query     SET wsrep_on=OFF
                   14 Query     SELECT @@SLOW_QUERY_LOG
                   14 Quit
                   15 Connect   mariadb-user@mariadb-master.net as anonymous on
                   15 Query     select @@version_comment limit 1
                   15 Query     SET wsrep_on=OFF
                   15 Query     SET GLOBAL GENERAL_LOG=OFF
/usr/sbin/mysqld, Version: 5.5.32-MariaDB-log (MariaDB Server, wsrep_23.7.5.rXXXX). started with:
Tcp port: 3306  Unix socket: /var/lib/mysql/mysql.sock
Time                 Id Command    Argument
130910  8:18:55    17 Query     SET GLOBAL SLOW_QUERY_LOG=1
                   17 Quit

I'm not sure what else I should do. I had this cluster working before, but I reverted to the snapshot right after I had the OS baseline completed. So, in my mind, it should have worked the same way, but it didn't. Should I create a local user on the boxes themselves named the same as the database user?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If you look at the error messages on the pastebin link, on line 18 and 19, there is a reference to this:

130906 12:47:32 [ERROR] mysqld: File '/var/log/mysql-slow-queries.log' not found (Errcode: 13)
130906 12:47:32 [ERROR] Could not use /var/log/mysql-slow-queries.log for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.

What I had done is when I made my config file, I finger fudged a line:

log-slow-queries=/var/log/mysql-slow-queries.log

Once I edited this line to reflect:

log-slow-queries=/var/log/mysql/mysql-slow-queries.log

The cluster magically worked. I am able to replicate between databases and have them function now. I'm not exactly sure why that one line would prevent everything from working, but it did.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.