原址如下:
http://xianglinhu.blog.51cto.com/5787032/1676039
mariadb galera集群配置
1
2
3
4
5
|
[mariadb]
name = MariaDB
baseurl = http:
//yum
.mariadb.org
/10
.0.20
/centos6-amd64
gpgkey=https:
//yum
.mariadb.org
/RPM-GPG-KEY-MariaDB
gpgcheck=1
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@test3 my.cnf.d]
# tail -15 /etc/yum.repos.d/Centos-Local.repo
name=CentOS-6 - Local
baseurl=http:
//192
.168.1.160
/base/
gpgcheck=0
enabled=1
failovermethod=priority
[c6-epel]
name=CentOS-6 - Local
baseurl=http:
//192
.168.1.160
/epel/
$basearch/
gpgcheck=0
enabled=1
[mariadb]
name=mariadb_galera
baseurl=http:
//192
.168.1.160
/mariadb_galera/centos6X86_64/
gpgcheck=0
enabled=1
|
1
|
yum -y
install
MariaDB-Galera-server MariaDB-client
rsync
galera
|
1
2
|
grant all privileges on *.* to
'wsrep_sst-user'
@
'192.168.1.%'
identified by
'password'
;
flush privileges;
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
[root@test2 ~]
# cat /etc/my.cnf.d/galera.cnf
[server]
query_cache_size=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.1.162,192.168.1.163,192.168.1.164"
wsrep_cluster_address=gcomm:
//
wsrep_cluster_name=
'example_cluster'
wsrep_node_address=
'192.168.1.161'
wsrep_node_name=
'nd1'
wsrep_sst_method=
rsync
#wsrep_sst_method=xtrabackup
wsrep_sst_auth=wsrep_sst-user:password
|
1
2
|
iptables -A INPUT -i eth0 -p tcp --dport 3306 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 4567 -j ACCEPT
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
MariaDB [(none)]> show global status like
'wsrep%'
;
+------------------------------+-----------------------------------------------------------------------------+
| Variable_name | Value |
+------------------------------+-----------------------------------------------------------------------------+
| wsrep_local_state_uuid | 0381ab0f-a3aa-11e4-9737-be607495053f |
| wsrep_protocol_version | 7 |
| wsrep_last_committed | 2 |
| 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 | 948 |
| 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 | 18446744073709551615 |
| 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 | 0.000000 |
| wsrep_apply_oooe | 0.000000 |
| wsrep_apply_oool | 0.000000 |
| wsrep_apply_window | 0.000000 |
| wsrep_commit_oooe | 0.000000 |
| wsrep_commit_oool | 0.000000 |
| wsrep_commit_window | 0.000000 |
| wsrep_local_state | 4 |
| wsrep_local_state_comment | Synced |
| wsrep_cert_index_size | 0 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0.000000 |
| wsrep_incoming_addresses | 192.168.1.164:3306,192.168.1.162:3306,192.168.1.161:3306,192.168.1.163:3306 |
| wsrep_evs_delayed | |
| wsrep_evs_evict_list | |
| wsrep_evs_repl_latency | 0
/0/0/0/0
|
| wsrep_evs_state | OPERATIONAL |
| wsrep_gcomm_uuid | c009d89b-a3b6-11e4-9e41-a2518f032b8a |
| wsrep_cluster_conf_id | 6 |
| wsrep_cluster_size | 4 |
| wsrep_cluster_state_uuid | 0381ab0f-a3aa-11e4-9737-be607495053f |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 2 |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <[email protected]> |
| wsrep_provider_version | 25.3.9(r3385) |
| wsrep_ready | ON |
| wsrep_thread_count | 2 |
+------------------------------+-----------------------------------------------------------------------------+
57 rows
in
set
(0.00 sec)
|
1
2
3
4
5
6
7
8
9
10
11
12
|
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
|
test
|
+--------------------+
4 rows
in
set
(0.01 sec)
MariaDB [(none)]> create database huxianglin;
Query OK, 1 row affected (0.00 sec)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
|
test
|
+--------------------+
4 rows
in
set
(0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| huxianglin |
| information_schema |
| mysql |
| performance_schema |
|
test
|
+--------------------+
5 rows
in
set
(0.00 sec)
|