免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3830 | 回复: 3
打印 上一主题 下一主题

MariaDB多主复制问题。。。。。。。。。。。。。。。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-06-02 17:02 |只看该作者 |倒序浏览
别人的状态:MariaDB [(none)]> SHOW VARIABLES LIKE 'wsrep_cluster_address';
+-----------------------+----------+
| Variable_name         | Value    |
+-----------------------+----------+
| wsrep_cluster_address | gcomm:// |
+-----------------------+----------+
1 row in set (0.00 sec)
# 如果配置了指向集群地址,上面那个参数值,应该是你指定集群的IP地址
MariaDB [kz]> SHOW VARIABLES LIKE 'wsrep_cluster_address';
+-----------------------+----------------------------+
| Variable_name         | Value                      |
+-----------------------+----------------------------+
| wsrep_cluster_address | gcomm://192.168.1.139:4567 |
+-----------------------+----------------------------+
1 row in set (0.00 sec)
# 此参数查看是否开启
MariaDB [kz]> show status like 'wsrep_ready';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wsrep_ready   | ON    |
+---------------+-------+
1 row in set (0.00 sec)
# 这个查看wsrep的相关参数
MariaDB [terry]> show status like 'wsrep%';
+----------------------------+--------------------------------------+
| Variable_name              | Value                                |
+----------------------------+--------------------------------------+
| wsrep_local_state_uuid     | bb5b9e17-66c8-11e3-86ba-96854521d205 | uuid 集群唯一标记
| wsrep_protocol_version     | 4                                    |
| wsrep_last_committed       | 16                                   | sql 提交记录
| wsrep_replicated               | 4                                     | 随着复制发出的次数
| wsrep_replicated_bytes      | 692                                  | 数据复制发出的字节数
| wsrep_received                 | 18                                    | 数据复制接收次数
| wsrep_received_bytes        | 3070                                 | 数据复制接收的字节数
| wsrep_local_commits         | 4                                      | 本地执行的 sql
| wsrep_local_cert_failures    | 0                                      | 本地失败事务
| wsrep_local_bf_aborts        | 0                                      |从执行事务过程被本地中断
| wsrep_local_replays           | 0                                      |
| wsrep_local_send_queue     | 0                                     | 本地发出的队列
| wsrep_local_send_queue_avg | 0.142857                       | 队列平均时间间隔
| wsrep_local_recv_queue     | 0                                      | 本地接收队列
| wsrep_local_recv_queue_avg | 0.000000                        | 本地接收时间间隔
| wsrep_flow_control_paused  | 0.000000                         |
| wsrep_flow_control_sent    | 0                                      |
| wsrep_flow_control_recv    | 0                                    |
| wsrep_cert_deps_distance   | 0.000000                          | 并发数量
| wsrep_apply_oooe           | 0.000000                             |
| wsrep_apply_oool           | 0.000000                             |
| wsrep_apply_window         | 1.000000                             |
| wsrep_commit_oooe          | 0.000000                             |
| wsrep_commit_oool          | 0.000000                             |
| wsrep_commit_window        | 1.000000                             |
| wsrep_local_state          | 4                                    |
| wsrep_local_state_comment  | Synced                               |
| wsrep_cert_index_size      | 0                                    |
| wsrep_causal_reads         | 0                                    |
| wsrep_incoming_addresses   | 192.168.1.137:3306    | 连接中的数据库
| wsrep_cluster_conf_id      | 18                                   |
| wsrep_cluster_size         | 2                                    | 集群成员个数
| wsrep_cluster_state_uuid   | bb5b9e17-66c8-11e3-86ba-96854521d205 | 集群 ID
| wsrep_cluster_status       | Primary                              | 主服务器
| wsrep_connected            | ON                                   | 当前是否连接中
| wsrep_local_index          | 1                                    |
| wsrep_provider_name        | Galera                               |
| wsrep_provider_vendor      | Codership Oy     |
| wsrep_provider_version     | 2.7(rXXXX)                           |
| wsrep_ready                | ON                                   | 插件是否应用中
+----------------------------+--------------------------------------+
40 rows in set (0.05 sec)













我的状态:
MariaDB [(none)]> SHOW VARIABLES LIKE 'wsrep_cluster_address';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| wsrep_cluster_address |       |
+-----------------------+-------+
1 row in set (0.00 sec)

MariaDB [(none)]> show status like 'wsrep_ready';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wsrep_ready   | ON    |
+---------------+-------+
1 row in set (0.00 sec)

MariaDB [(none)]> show status like 'wsrep%';
+--------------------------+----------------------+
| Variable_name            | Value                |
+--------------------------+----------------------+
| wsrep_cluster_conf_id    | 18446744073709551615 |
| wsrep_cluster_size       | 0                    |
| wsrep_cluster_state_uuid |                      |
| wsrep_cluster_status     | Disconnected         |
| wsrep_connected          | OFF                  |
| wsrep_local_bf_aborts    | 0                    |
| wsrep_local_index        | 18446744073709551615 |
| wsrep_provider_name      |                      |
| wsrep_provider_vendor    |                      |
| wsrep_provider_version   |                      |
| wsrep_ready              | ON                   |
| wsrep_thread_count       | 0                    |
+--------------------------+----------------------+
12 rows in set (0.00 sec)



照着做的为什么会出现这样!!!中途没报错!!!!

论坛徽章:
0
2 [报告]
发表于 2015-06-02 17:03 |只看该作者
[root@client137 ~]# yum -y install MariaDB-Galera-server galera MariaDB-client
[root@client138 ~]# yum -y install MariaDB-Galera-server galera MariaDB-client
[root@client139 ~]# yum -y install MariaDB-Galera-server galera MariaDB-client
4.编辑每台机器的hosts文件,添加如下内容

[root@client137 ~]# vim /etc/hosts
192.168.1.137 client137.kongzhong.com  client137
192.168.1.138 client138.kongzhong.com  client138
192.168.1.139 client139.kongzhong.com  client139
# 启动测试一下
[root@client137 ~]# /etc/init.d/mysql start
Starting MySQL.... SUCCESS!
[root@client137 ~]# chkconfig mysql on
5.设置MariaDB的root密码,并做安全加固

[root@client137 ~]#  /usr/bin/mysql_secure_installation
[root@client137 ~]#  /usr/bin/mysql_secure_installation
# 登陆数据库,授权用于集群同步的用户和密码
[root@client137 ~]# mysql -uroot -pkongzhong
mysql> GRANT USAGE ON *.* to sst@'%' IDENTIFIED BY 'sstpass123';
mysql> GRANT ALL PRIVILEGES on *.* to sst@'%';
mysql> FLUSH PRIVILEGES;
mysql> quit
# 创建并配置wsrep.cnf文件
[root@client137 ~]# cp /usr/share/mysql/wsrep.cnf  /etc/my.cnf.d/
[root@client137 ~]# vim /etc/my.cnf.d/wsrep.cnf
# 只需要修改如下4行:
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://"
wsrep_sst_auth=sst:sstpass123
wsrep_sst_method=rsync
# 注意:
#    "gcomm://" 是特殊的地址,仅仅是Galera cluster初始化启动时候使用。
#    如果集群启动以后,我们关闭了第一个节点,那么再次启动的时候必须先修改,"gcomm://"为其他节点的集群地址,例如wsrep_cluster_address="gcomm://192.168.1.138:4567"

论坛徽章:
0
3 [报告]
发表于 2015-06-02 17:22 |只看该作者
我用的是两台本机的虚拟机!且防火墙时关闭的!

论坛徽章:
0
4 [报告]
发表于 2015-06-02 17:28 |只看该作者
4567端口没起来
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP