我对MariaDB和Galera在RHEL6.4& 6.2 64位服务器上运行并让它们集群存在问题。我安装了Galera集群所需的RPM:
然后,在安装MariaDB及其所有组件之后,我检查了它通常保存文件、/var/lib/mysql/和/var/log/mysql/的目录,并执行了
chown -R mysql:mysql /var/lib/mysql/
chown -R mysql:mysql /var/log/mysql/我以独立模式启动了这两个服务器,并配置了一个复制用户:
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;这样的话,我就会有一个数据库的用户与之通信。然后,我在主节点和从节点上编辑了我的信任:
#
# 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]一旦信任到位,我确保防火墙允许流量通过,基本上是通过清除他们的iptables -F。然后,我使用以下方法初始化主服务器上的集群:
/etc/init.d/mysql start --wsrep_cluster_address=gcomm://进程出现在主节点上,在从节点上使用:
service mysql start然后,从节点连接一段时间,交换状态,然后退出,表示不允许进行操作。
这是/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我不知道我还应该做什么。我以前让这个集群工作过,但在完成OS基线之后,我立即恢复到快照。所以,在我看来,它应该以同样的方式工作,但实际上并非如此。我是否应该在与数据库用户相同的框上创建一个本地用户?
发布于 2013-09-11 13:39:55
如果您查看第18和第19行pastebin链接上的错误消息,就会看到以下引用:
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.我所做的是,当我创建我的配置文件时,我用手指捏造了一行:
log-slow-queries=/var/log/mysql-slow-queries.log一旦我编辑了这一行以反映:
log-slow-queries=/var/log/mysql/mysql-slow-queries.log星系团神奇地运转。我现在能够在数据库之间进行复制,并让它们发挥作用。我不太清楚为什么这一条线会阻止一切正常工作,但它做到了。
https://serverfault.com/questions/537553
复制相似问题