Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql MariaDB Galera群集设置问题_Mysql_Mariadb_Galera - Fatal编程技术网

Mysql MariaDB Galera群集设置问题

Mysql MariaDB Galera群集设置问题,mysql,mariadb,galera,Mysql,Mariadb,Galera,我正试图让一个mariadb集群启动并运行,但它不适合我。现在我正在64位red hat ES6机器上使用MariaDB Galera 5.5.36。我通过本回购协议在此处安装了mariadb: [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5-galera/rhel6-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 在server

我正试图让一个mariadb集群启动并运行,但它不适合我。现在我正在64位red hat ES6机器上使用MariaDB Galera 5.5.36。我通过本回购协议在此处安装了mariadb:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5-galera/rhel6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
在server.conf中,我在服务器1中有以下内容:

[mariadb]
log_error=/var/log/mariadb.log
query_cache_size=0
query_cache_type=0
binlog_format=ROW
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://192.168.211.133
wsrep_cluster_name='cluster'
wsrep_node_address='192.168.211.132'
wsrep_node_name='cluster1'
wsrep_sst_method=rsync
在服务器2上,我有

[mariadb]
log_error=/var/log/mariadb.log
query_cache_size=0
query_cache_type=0
binlog_format=ROW
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://192.168.211.132
wsrep_cluster_name='cluster'
wsrep_node_address='192.168.211.133'
wsrep_node_name='cluster2'
wsrep_sst_method=rsync
当我使用以下命令启动服务器1:sudo service mysql start--wsrep new cluster时,它会正常启动,如果我打开mysql并检查wsrep的状态,它会说一切都已启动并正在运行,这很好,但当我尝试在第二台服务器上执行sudo service mysql start时,我会在错误日志中看到以下内容:

140609 14:47:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140609 14:47:56 mysqld_safe WSREP: Running position recovery with --log_error='/var/lib/mysql/wsrep_recovery.i5qfm2' --pid-file='/var/lib/mysql/localhost.localdomain-recover.pid'
140609 14:47:57 mysqld_safe WSREP: Recovered position 85448d73-ebe8-11e3-9c20-fbc1995fee11:0
140609 14:47:57 [Note] WSREP: wsrep_start_position var submitted: '85448d73-ebe8-11e3-9c20-fbc1995fee11:0'
140609 14:47:57 [Note] WSREP: Read nil XID from storage engines, skipping position init
140609 14:47:57 [Note] WSREP: wsrep_load(): loading provider library '/usr/lib64/galera/libgalera_smm.so'
140609 14:47:57 [Note] WSREP: wsrep_load(): Galera 25.3.2(r170) by Codership Oy <info@codership.com> loaded successfully.
140609 14:47:57 [Note] WSREP: CRC-32C: using hardware acceleration.
140609 14:47:57 [Note] WSREP: Found saved state: 85448d73-ebe8-11e3-9c20-fbc1995fee11:-1
140609 14:47:57 [Note] WSREP: Passing config to GCS: base_host = 192.168.211.133; base_port = 4567; cert.log_conflicts = no; gcache.dir = /var/lib/mysql/; gcache.keep_pages_size = 0; gcache.mem_size = 0; gcache.name = /var/lib/mysql//galera.cache; gcache.page_size = 128M; gcache.size = 128M; gcs.fc_debug = 0; gcs.fc_factor = 1; gcs.fc_limit = 16; gcs.fc_master_slave = NO; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = NO; repl.causal_read_timeout = PT30S; repl.commit_order = 3; repl.key_format = FLAT8; repl.proto_max = 5
140609 14:47:57 [Note] WSREP: Assign initial position for certification: 0, protocol version: -1
140609 14:47:57 [Note] WSREP: wsrep_sst_grab()
140609 14:47:57 [Note] WSREP: Start replication
140609 14:47:57 [Note] WSREP: Setting initial position to 85448d73-ebe8-11e3-9c20-fbc1995fee11:0
140609 14:47:57 [Note] WSREP: protonet asio version 0
140609 14:47:57 [Note] WSREP: Using CRC-32C (optimized) for message checksums.
140609 14:47:57 [Note] WSREP: backend: asio
140609 14:47:57 [Note] WSREP: GMCast version 0
140609 14:47:57 [Note] WSREP: (0c085f34-efe5-11e3-9f6b-8bfd1706e2a4, 'tcp://0.0.0.0:4567') listening at tcp://0.0.0.0:4567
140609 14:47:57 [Note] WSREP: (0c085f34-efe5-11e3-9f6b-8bfd1706e2a4, 'tcp://0.0.0.0:4567') multicast: , ttl: 1
140609 14:47:57 [Note] WSREP: EVS version 0
140609 14:47:57 [Note] WSREP: PC version 0
140609 14:47:57 [Note] WSREP: gcomm: connecting to group 'cluster', peer '192.168.211.132:,192.168.211.134:'
140609 14:48:00 [Warning] WSREP: no nodes coming from prim view, prim not possible
140609 14:48:00 [Note] WSREP: view(view_id(NON_PRIM,0c085f34-efe5-11e3-9f6b-8bfd1706e2a4,1) memb {
        0c085f34-efe5-11e3-9f6b-8bfd1706e2a4,0
} joined {
} left {
} partitioned {
})
140609 14:48:01 [Warning] WSREP: last inactive check more than PT1.5S ago (PT3.50775S), skipping check
140609 14:48:31 [Note] WSREP: view((empty))
140609 14:48:31 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)
         at gcomm/src/pc.cpp:connect():141
140609 14:48:31 [ERROR] WSREP: gcs/src/gcs_core.c:gcs_core_open():196: Failed to open backend connection: -110 (Connection timed out)
140609 14:48:31 [ERROR] WSREP: gcs/src/gcs.c:gcs_open():1291: Failed to open channel 'cluster' at 'gcomm://192.168.211.132,192.168.211.134': -110 (Connection timed out)
140609 14:48:31 [ERROR] WSREP: gcs connect failed: Connection timed out
140609 14:48:31 [ERROR] WSREP: wsrep::connect() failed: 7
140609 14:48:31 [ERROR] Aborting

140609 14:48:31 [Note] WSREP: Service disconnected.
140609 14:48:32 [Note] WSREP: Some threads may fail to exit.
140609 14:48:32 [Note] /usr/sbin/mysqld: Shutdown complete

140609 14:48:32 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
140609 14:47:55 mysqld_使用/var/lib/mysql中的数据库安全启动mysqld守护程序
140609 14:47:56 mysqld_safe WSREP:运行位置恢复时使用--log_error='/var/lib/mysql/WSREP_recovery.i5qfm2'-pid file='/var/lib/mysql/localhost.localdomain recover.pid'
140609 14:47:57 mysqld_safe WSREP:恢复位置85448d73-ebe8-11e3-9c20-fbc1995fee11:0
140609 14:47:57[注]WSREP:WSREP_start_position变量已提交:“85448d73-ebe8-11e3-9c20-fbc1995fee11:0”
140609 14:47:57[注意]WSREP:从存储引擎读取nil XID,跳过位置init
140609 14:47:57[注意]WSREP:WSREP_load():加载提供程序库'/usr/lib64/galera/libgalera_smm.so'
140609 14:47:57[注]WSREP:WSREP_load():Galera 25.3.2(r170)通过Codership Oy成功加载。
140609 14:47:57[注]WSREP:CRC-32C:使用硬件加速。
140609 14:47:57[注意]WSREP:找到保存状态:85448d73-ebe8-11e3-9c20-fbc1995fee11:-1
140609 14:47:57[注]WSREP:Passing config to GCS:base_host=192.168.211.133;基本端口=4567;cert.log_冲突=否;gcache.dir=/var/lib/mysql/;gcache.keep_pages_size=0;gcache.mem_size=0;gcache.name=/var/lib/mysql//galera.cache;gcache.page_尺寸=128M;gcache.size=128M;gcs.fc_调试=0;gcs.fc_系数=1;gcs.fc_限值=16;gcs.fc_master_slave=否;gcs.max_数据包大小=64500;gcs.max_油门=0.25;gcs.recv_q_hard_limit=9223372036854775807;gcs.recv_q_软限制=0.25;gcs.sync_捐赠者=否;repl.consular_read_timeout=PT30S;repl.commit_order=3;repl.key_格式=FLAT8;repl.proto_max=5
140609 14:47:57[注]WSREP:为认证分配初始位置:0,协议版本:-1
140609 14:47:57[注]WSREP:WSREP_sst_grab()
140609 14:47:57[注意]WSREP:开始复制
140609 14:47:57[注]WSREP:将初始位置设置为85448d73-ebe8-11e3-9c20-fbc1995fee11:0
140609 14:47:57[注]WSREP:protonet asio版本0
140609 14:47:57[注]WSREP:使用CRC-32C(优化)进行消息校验和。
140609 14:47:57[注]WSREP:backend:asio
140609 14:47:57[注]WSREP:GMCast版本0
140609 14:47:57[注]WSREP:(0c085f34-efe5-11e3-9f6b-8bfd1706e2a4,'tcp://0.0.0.0:4567")听tcp://0.0.0.0:4567
140609 14:47:57[注]WSREP:(0c085f34-efe5-11e3-9f6b-8bfd1706e2a4,'tcp://0.0.0.0:4567“)多播:,ttl:1
140609 14:47:57[注]WSREP:EVS版本0
140609 14:47:57[注]WSREP:PC版本0
140609 14:47:57[注]WSREP:gcomm:连接到组“集群”,对等方“192.168.211.132:,192.168.211.134:”
140609 14:48:00[警告]WSREP:没有来自prim视图的节点,prim不可能
140609 14:48:00[注]WSREP:view(视图id(非原始,0c085f34-efe5-11e3-9f6b-8bfd1706e2a4,1)memb{
0c085f34-efe5-11e3-9f6b-8bfd1706e2a4,0
}加入{
}左{
}分隔{
})
140609 14:48:01[警告]WSREP:上次非活动检查时间超过PT1.5S(PT3.50775S),跳过检查
140609 14:48:31[注]WSREP:view((空))
140609 14:48:31[错误]WSREP:无法打开gcomm后端连接:110:无法访问主视图:110(连接超时)
在gcomm/src/pc.cpp:connect():141处
140609 14:48:31[错误]WSREP:gcs/src/gcs_core.c:gcs_core_open():196:无法打开后端连接:-110(连接超时)
140609 14:48:31[错误]WSREP:gcs/src/gcs.c:gcs_open():1291:无法在以下位置打开通道“群集”gcomm://192.168.211.132,192.168.211.134':-110(连接超时)
140609 14:48:31[错误]WSREP:gcs连接失败:连接超时
140609 14:48:31[错误]WSREP:WSREP::connect()失败:7
140609 14:48:31[错误]正在中止
140609 14:48:31[注意]WSREP:服务已断开。
140609 14:48:32[注意]WSREP:某些线程可能无法退出。
140609 14:48:32[注意]/usr/sbin/mysqld:关闭完成
140609 14:48:32 pid文件/var/lib/mysql/localhost.localdomain.pid中的mysqld_safe mysqld结束

我不明白为什么第二台服务器无法检测到集群正在启动和运行。这些机器可以很好地相互通信,我可以用SSH从一个机器到另一个机器,它们可以相互ping。我尝试删除galera缓存,尝试降级我的mariadb galera版本,尝试禁用SELinux,尝试以其他用户身份运行mysql服务,验证是否打开了正确的端口,尝试在具有不同IP地址的不同计算机上的两个虚拟机上运行它们,等等。有人知道这里发生了什么吗?因为我已经搜索了3天试图解决这个问题,但似乎没有解决方案。我相信您需要列出wsrep_cluster_address参数中的所有IP

wsrep_集群_地址=gcomm://192.168.211.132,192.168.211.133


这应该在两台主机上都执行。顺便说一句,您可能需要三个节点而不是两个节点,以避免出现大脑分裂的情况。

以下是我如何解决类似问题的

CentOS 7 w/MariaDB Galera 10.1

Node2我看到了:

016-12-27 15:40:38 140703512762624 [Warning] WSREP: no nodes coming from prim view, prim not possible
读了几遍之后,我试着在node1上运行这个

service mysql start --wsrep-new-cluster
但这失败了,在日志中,我发现了这个

2016-12-27 15:44:08 140438853814528 [ERROR] WSREP: It may not be safe to bootstrap the cluster from this node. It was not the last one to leave the cluster and may not contain all the updates. To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 .
因此我编辑了文件
/var/lib/mysql/grastate.dat
,将
safe\u改为\u bootstrap
改为
1

然后,我可以使用以下命令启动主节点:

service mysql start --wsrep-new-cluster
然后在其他人身上,我只是用了

service mysql start
注意:这是在演示预生产环境中进行的。我很快就把它弄坏了
mysqld_safe --wsrep-recover
galera_new_cluster