您的位置:首页 > 其它

Percona XtraDB Cluster 5.6安装配置

2015-07-14 14:26 911 查看
PXC简介
Percona XtraDB Cluster(简称PXC集群)提供了MySQL高可用的一种实现方法。
1.集群是有节点组成的,推荐配置至少3个节点,但是也可以运行在2个节点上。
2.每个节点都是普通的mysql/percona服务器,可以将现有的数据库服务器组成集群,反之,也可以将集群拆分成单独的服务器。
3.每个节点都包含完整的数据副本。
PXC集群主要由两部分组成:Percona Server with XtraDB和Write Set Replication patches(使用了Galera library,一个通用的用于事务型应用的同步、多主复制插件)。


环境介绍:
操作系统版本:Centos-6.5-X64
数据库版本:Percona-Server-5.6.15-rel63.0.tar
192.168.3.81 node1
192.168.3.82 node2
192.168.3.83 node3

1.安装 Percona mysql(所有节点安装)
安装源
rpm -ivh http:
//dl
.fedoraproject.org
/pub/epel/6/x86_64/epel-release-6-8
.noarch.rpm


安装Precona XtraDB Cluster所需要的扩展包
yum -y install cmake gcc gcc-c++ libaio libaio-devel automake autoconf bzr bisonlibtool ncurses5-devel boost

安装perl组件(xtrabackup需要的组件)
yum -y install perl-DBD-MySQL perl-DBI perl-Time-HiRes

安装socat (Socat是一个在两个独立数据的双向传输之间起到中继作用的软件)

 查看Cluster的状态:
mysql> show global status like 'wsrep%';
+------------------------------+--------------------------------------+
| Variable_name | Value |
+------------------------------+--------------------------------------+
| wsrep_local_state_uuid | fdfec3ab-d9e8-11e4-94aa-ae45256a81fb |
| wsrep_protocol_version | 7|
| wsrep_last_committed| 7|
| wsrep_replicated | 0|
| wsrep_replicated_bytes | 0|
| wsrep_repl_keys | 0|
| wsrep_repl_keys_bytes | 0|
| wsrep_repl_data_bytes | 0|
| wsrep_repl_other_bytes | 0|
| wsrep_received| 4|
| wsrep_received_bytes| 510 |
| wsrep_local_commits | 0|
| wsrep_local_cert_failures | 0|
| wsrep_local_replays | 0|
| wsrep_local_send_queue | 0|
| wsrep_local_send_queue_max| 1|
| wsrep_local_send_queue_min| 0|
| wsrep_local_send_queue_avg| 0.000000 |
| wsrep_local_recv_queue | 0|
| wsrep_local_recv_queue_max| 1|
| wsrep_local_recv_queue_min| 0|
| wsrep_local_recv_queue_avg| 0.000000 |
| wsrep_local_cached_downto | 7|
| wsrep_flow_control_paused_ns | 0|
| wsrep_flow_control_paused | 0.000000 |
| wsrep_flow_control_sent| 0|
| wsrep_flow_control_recv| 0|
| wsrep_cert_deps_distance | 1.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 | 3|
| wsrep_causal_reads | 0|
| wsrep_cert_interval | 0.000000 |
| wsrep_incoming_addresses | 192.168.3.82:3306,192.168.3.81:3306 |
| wsrep_evs_delayed| |
| wsrep_evs_evict_list| |
| wsrep_evs_repl_latency | 0/0/0/0/0 |
| wsrep_evs_state | OPERATIONAL |
| wsrep_gcomm_uuid | 16e598fb-dccb-11e4-9ca9-cb37e03eb618 |
| wsrep_cluster_conf_id | 2|
| wsrep_cluster_size | 2|
| wsrep_cluster_state_uuid | fdfec3ab-d9e8-11e4-94aa-ae45256a81fb |
| wsrep_cluster_status| Primary|
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0|
| wsrep_local_index| 0|
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 3.9(r93aca2d)|
| wsrep_ready| ON |
+------------------------------+--------------------------------------+
参数
"wsrep_cluster_size"
变为了 2。因为目前Cluster中已经有2个Node了。

测试Cluster功能
7.1模拟192.168.3.81节点1宕机
[root@M1905 ~]# service mysql stop
Shutting down MySQL (Percona XtraDB Cluster).... SUCCESS!
[root@M1905 ~]# netstat -tunlp
Proto Recv-Q Send-Q Local Address Foreign AddressState PID/Program name
tcp 00 0.0.0.0:22 0.0.0.0:* LISTEN809/sshd
tcp 00 127.0.0.1:250.0.0.0:* LISTEN898/master
//在任意其它节的查看cluster状态

8.感觉"Percona XtraDB cluster“的高可用增加删除节点很方便,自动切换故障,如果能配合atlas做读写分离就完美了,但是经过测试,cluster写性能真的不咋的,如果对写要求不高,还是不错的选择。
本文出自 “从心开始” 博客,请务必保留此出处http://hao360.blog.51cto.com/5820068/1674062
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: