易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 1518|回复: 2
收起左侧

ubuntu 14.0安装galera集群

[复制链接]
发表于 2022-1-18 17:17:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
下面就是最实用的安装过程,亲测有效!
8 N, K5 g3 ?0 x$ |, L7 |1.安装需要的源# g6 T: }+ }( o( ~1 ]8 R
apt-get install software-properties-common2 F1 g% {  ?  b% B
apt-key adv --keyserver keyserver.ubuntu.com --recv BC19DDBA# U2 ]% I' r- n0 b% I; c; E

0 Q& @: n$ S% ~% }  R! `' y然后创建创建一个文件,/etc/apt/sources.list.d/galera.list,galera.list里面的内容为:$ I* c& P5 x$ e; h% p8 U$ H
deb http://releases.galeracluster.com/ubuntu trusty main$ B- M) I3 M- s

6 @) G) t1 X( f. X3 ]& }- S接下来就更新一下:: p8 V2 w, x8 e/ h1 c6 G
apt-get update
" k4 \# V, `* n7 U6 I! k9 L. b( }8 w1 d! S
源配置好了之后,接下来就该安装文件了,执行:# R0 @7 V' w+ N
apt-get install galera-3 galera-arbitrator-3 mysql-wsrep-5.6
; d) x" D( s  z1 \# U/ U9 j, g
* r3 j; s& R( s: C# n安装完成之后,在每一个节点上启动Mysql:1 h; L9 h7 ^- M* L" E, g2 a+ {' [* p
service mysql start/ {% v9 v8 D$ j' h( \
& \. a# {# X8 Z: n
然后,验证节点之间是否能互相ping通:
3 `' P! ]3 @! R5 t% H  e. ?2 J
8 G) s  c- @0 _9 S3 n/ N' s: j+ M. E4 S, W
安装好了,那么下面要来修改Mysql的配置文件了,打开/etc/mysql/my.cnf,修改bind-address 192.168.13.155为:
+ k2 {) ?3 D6 M, j) Hbind-address = 192.168.13.155( D4 R- N5 g) B

, t0 j# b0 T; ^+ }' x( J表示任何主机可以访问。重启Mysql:4 W. B9 F- \! x
service mysql restart! a. d' J: K2 R- R
( K3 ?5 x; f& K6 X* X
接下来,试着在任何一个节点登录其他节点,比如Node1上执行:
8 A, u! j! |" Y# Emysql -h 192.168.13.155 -u root -p
0 {/ ?4 Q% k& Q
2 I' J' n" [; f5 W- z: H此时会让你输入Mysql密码,说明Node2上的Mysql服务器是在监听的,但此时输入密码是登录不成功的,后面会解决这个!9 e8 V1 q/ I! L. O+ x
接下来,我们还要对Mysql配置文件进一步配置:
# w  |* t& @2 Q" l# J, X在 Node1 上的/etc/mysql/my.cnf里面的[mysql]下面添加上:+ j& ^, {+ V1 ~: c
binlog_format=ROW
# j( G! r8 z4 Z2 B* A! jdefault-storage-engine=innodb
& I% r( U. Q# B9 r1 ]/ |4 V/ p% [/ Z- Winnodb_autoinc_lock_mode=2$ k* W- h/ P, v# H5 Z# H
wsrep_provider=/usr/lib/libgalera_smm.so
% l4 j' Q% F: qwsrep_provider_options="gcache.size=300M; gcache.page_size=1G"$ s: y) M3 y" j' e4 m
wsrep_cluster_name="galeracluster"
' D/ @3 ?% Z4 Q1 vwsrep_cluster_address="gcomm://"! `" g  Z7 J+ C& ~9 {% M
wsrep_sst_method=rsync! G% ]" T; W. H0 J% {& h9 }
wsrep_sst_auth=wsrep:password
* o+ ~- e( k% T$ K
& x* b. g. N4 _9 M在 Node2 上的/etc/mysql/my.cnf里面的[mysql]下面添加上:( G5 \+ |% `. f. L# T
binlog_format=ROW0 ?1 }; b7 [$ G2 l
default-storage-engine=innodb
) [( f) E( A9 d) T0 Linnodb_autoinc_lock_mode=2
$ e* `) P8 ]4 L  E2 nwsrep_provider=/usr/lib/libgalera_smm.so
8 O) G+ s* K& n; {5 m. I# K) awsrep_provider_options="gcache.size=300M; gcache.page_size=1G"
2 @* r: P4 Y1 B3 ?! v" _" S% cwsrep_cluster_name="galeracluster"
3 |# i$ }. `7 l8 S4 Mwsrep_cluster_address="gcomm://192.168.13.155"
2 x9 z" d; V- g" |wsrep_sst_method=rsync
% T. y$ e* y* W  E$ a% |" q3 h# Rwsrep_sst_auth=wsrep:password
- M+ D* |4 e3 F
% s. w" Q# \$ _! g在 Node3 上的/etc/mysql/my.cnf里面的[mysql]下面添加上:
# j% I. i2 E3 e. r6 Tbinlog_format=ROW
; C: g' ~$ h# s, f. I3 j' E' }7 Ddefault-storage-engine=innodb% M8 D/ q. a8 ]9 w0 F, t- q! _
innodb_autoinc_lock_mode=2
8 x6 z4 [4 D! k1 K/ {! ?wsrep_provider=/usr/lib/libgalera_smm.so
- a$ N/ i2 U2 Y. Q: x5 ~wsrep_provider_options="gcache.size=300M; gcache.page_size=1G"0 b. S, X+ p  e8 L) y5 X. {
wsrep_cluster_name="galeracluster"( d: X: W# y3 U
wsrep_cluster_address="gcomm://192.168.13.155"6 s8 h) ?% [3 h& K! `- ?5 ?( r
wsrep_sst_method=rsync5 t! k9 ]0 _( E8 o5 U
wsrep_sst_auth=wsrep:password4 W8 n2 p8 S+ ^+ X0 i
- F( H- c) I0 E" i7 d8 X
以上三个节点的配置注意以下几点:& M+ s9 D: M. H" c
1. default_storage_engine这一行是必须的,因为Galera只能复制innodb的数据库
, m( U7 Y  y: ~* \- d: y2. wsrep_cluster_name这一行指定了集群的名称,集群中的每个节点上都必须设置为一样% V/ U& O, ~$ e5 _
3. 作为集群中第一个启动的节点Node1,wsrep_cluster_address必须设置为空,即"gcomm://",其他节点则要指定0 @" I; @( j8 W7 w
4. 最后一行的用户名和密码在所有节点上都必须一样(此处用户名为wsrep,后面马上会创建该用户,密码为password)+ c- n$ x* p: U% W8 e7 u, o
下面,在每个节点上创建用户及实现远程数据库可以登录(解决前文说到的无法访问):& l* p! B2 }% S. R
mysql –u root –p' ]+ H7 a& G+ y4 ]  A9 l
CREATE USER ‘wsrep’@’%’ IDENTIFIED BY ‘password’;
! M/ q0 Q' L0 C+ n( d9 KCREATE USER ‘root’@’%’ IDENTIFIED BY ‘password’;! b9 {# D  |7 z
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
" z# y7 M& P9 Z8 M& t+ RFLUSH PRIVILEGES;) Z$ ]' V$ g& C( b  \3 a0 V

# X- r/ w! L" v6 m3 n重启数据库,然后可以试试前面提到的从Node1登录到Node2是否能成功!
% z4 v8 |+ N1 G. A( S, o接下来,Ubuntu有一个特别的用户叫debian-sys-maint会来维持Mysql的运行任务,由于数据库的复制,这个维护的运行只会在第一个节点成功进行,在其他节点上则会失败,所以要将启动节点上的/etc/mysql/debian.cnf文件拷贝到其他节点上,执行如下命令:
4 x7 D5 l: O/ o+ u  W) R( }% escp /etc/mysql/debian.cnf root@192.168.13.155:/etc/mysql/( @3 y' i3 \# O: ~& t- K
scp /etc/mysql/debian.cnf root@192.168.13.155:/etc/mysql/  A, |9 I  h, f% K' p% y% M

; r/ l. D9 J; C- c; Y1 [# t
3 e# P) X# ~9 Q- g( Q执行过程中可能会失败,这个问题是因为在/etc/mysql/my.cnf文件中有一行要改为:. M+ H9 G; q$ d
PermitRootLogin yes2 V- ~$ L. g! S# d: d
- w" y, q& V; b! Z0 i( o4 l) \6 w9 o
这样就会成功了!% O% a# M4 P9 X+ r* T! R3 B
当以上步骤都完成了之后,可以准备开始启动集群了!3 O7 Q6 _7 `1 B1 t$ Y
启动集群# D5 P0 i$ b- r8 y, Z2 y
在Node1上将mysql服务先停掉然后重启,注意一定要在前面提到的wsrep_cluster_address="gcomm://"的节点上(本例中就是Node1)执行最开始的启动程序:% y# d' |! ^6 f  {& @
service mysql stop
3 I' `' Z3 Y% R2 k$ ^9 ~( \% Tservice mysql start --wsrep-new-cluster
: z$ i! U* R- \4 u' l/ B5 ~: }1 K/ ?
在其他节点上执行:
0 r: u$ W: a6 D9 b/ tservice mysql restart7 m$ w0 E9 |% P4 U; s

$ A" H# i& X+ @验证是否成功
3 D$ a4 ?+ v) J' U4 ]- ?) f查看数据表
( M5 i" ]$ ^! C& ]# f' U; X登录Node1:
% `/ I1 N5 Y1 m0 ]0 [. Tmysql -u root -p
! s( ?" S" V7 _$ d+ L3 G* XEnter password:, a" ]) x8 k+ s3 A% v
mysql> SHOW STATUS LIKE 'wsrep%';
+ N+ {' a! j% ?' S4 L# ^
2 P; G# k& `. n' [6 d5 S重点关注的是下面这几行:& a# U* T3 F4 v- ^# d# D
wsrep_ready     |     ON
* z- o6 V$ i: E6 G. I$ `2 c
3 s& [5 }* q' ]$ q如果状态是 ON,那么就要看:6 D, X' Y4 C& u" H; C
wsrep_cluster_size    |   3
) n' G/ s$ x! I3 a* j3 o
- q3 n: w* x6 l; a. {) ^* X, ~如果是3,那么是成功的,否则是不成功的!
  G/ K& _2 `5 |  ~& J  I数据库复制测试$ @! p" n1 m2 z' K5 P6 p9 r3 C, ~
在Node1上创建一个表:$ w8 R# z/ S( e5 X: `) c0 }5 \; A
CREATE database test;( \0 T) P' H4 d1 O! }

6 n; z. }* Z" v) J# g9 J/ h8 b立刻到Node2和Node3节点上使用 show databases; 查看是否也有了test这个数据库,如果有则成功!
% x; t" e. x  c% k& Y3 X. r: l
" v+ L* `" z$ a! E3 i! v
 楼主| 发表于 2022-1-18 17:34:15 | 显示全部楼层
Adding Repositories and Packages
Now we will start by adding the repository for Ubuntu so, first add the key files for the MariaDB repository to build the trust between the maintainers of repositories and that we can install the required packages.
Installing the GPG key
Run the following command of all the three hosts to install its GPG key as follow.
root@ubuntu-node1:~# apt-get install python-software-propertiesroot@ubuntu-node2:~# apt-get install python-software-propertiesroot@ubuntu-node3:~# apt-get install python-software-properties

# g4 ~( I2 E) C% A) L$ J: E* F                               
登录/注册后可看大图
Adding APT Repository
Now to add its APT repository have to execute the below commands.
root@ubuntu-node1:~# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943dbroot@ubuntu-node2:~# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943dbroot@ubuntu-node3:~# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db

  R" h* |+ k, @6 p, ]$ [- U                               
登录/注册后可看大图
Adding Ubuntu Repository
Now can add the Ubuntu repository as per required whether to use its repository as we have the trusted key in the database, let’s add the actual repository using following command on all the nodes.
root@ubuntu-node1:~# add-apt-repository 'deb http://mirror.jmu.edu/pub/mariadb/repo/5.6/ubuntu trusty main'root@ubuntu-node2:~# add-apt-repository 'deb http://mirror.jmu.edu/pub/mariadb/repo/5.6/ubuntu trusty main'root@ubuntu-node3:~# add-apt-repository 'deb http://mirror.jmu.edu/pub/mariadb/repo/5.6/ubuntu trusty main'Update OS with Latest Repo
To get the latest repositories run the update command on the three nodes we are working on.
root@ubuntu-node1:~# apt-get updateroot@ubuntu-node2:~# apt-get updateroot@ubuntu-node3:~# apt-get updateInstalling MariaDB Cluster, Galera and Rsync
Let’s install the MariaDB and its related packages on each of the node with following command as:
root@ubuntu-node1:~# apt-get install -y galera  mariadb-galera-server-5.5 mariadb-client-5.5 libmariadbclient18 mariadb-client-core-5.5 rsync netcat-openbsdroot@ubuntu-node2:~# apt-get install -y galera  mariadb-galera-server-5.5 mariadb-client-5.5 libmariadbclient18 mariadb-client-core-5.5 rsync netcat-openbsdroot@ubuntu-node3:~# apt-get install -y galera  mariadb-galera-server-5.5 mariadb-client-5.5 libmariadbclient18 mariadb-client-core-5.5 rsync netcat-openbsd
. n5 \1 R# D/ l: k- K# Z2 K
                               
登录/注册后可看大图
During the installation process you will be asked to configure the root password for the MariaDB, so make sure that you configured the same root password on all the three nodes.

3 N" u6 ^$ b- J# k                               
登录/注册后可看大图
Once the installations of these packages are done, you will get a MariaDB server on each one of your three nodes but they aren’t yet configured.
Configuring MariaDB Cluster
Let’s proceed with the configurations changes for the MariaDB Galera Cluster setup.
MySQL Settings
First of all open the my.cnf file and comment the following lines on all the three nodes.
root@ubuntu-nodeX:~# vim /etc/mysql/my.cnf#bind-address           = 127.0.0.1#default_storage_engine = InnoDB#query_cache_limit              = 128K#query_cache_size               = 64MMariaDB Settings
Now add following lines for wsrep configuration options in my.cnf file under [mysqld] directive as shown below.
root@ubuntu-nodeX:~# vim /etc/mysql/my.cnf[mysqld]binlog_format=ROWdefault_storage_engine=innodbinnodb_autoinc_lock_mode=2innodb_locks_unsafe_for_binlog=1innodb_doublewrite=1VSRep Providers Configurations
Here we will configure the vsrep configurations on each node under the [mysqld] directory by adding the following lines in /etc/mysql/my.cnf file on each node with their specific hostnames, root password and IP address.
Configurations for ubuntu-node1[mysqld]wsrep_provider=/usr/lib/galera/libgalera_smm.sowsrep_provider_options="gcache.size=256M; gcache.page_size=128M"wsrep_cluster_address=gcomm://ubuntu-node1wsrep_cluster_name="MariaDB_Cluster"wsrep_node_address="ubuntu-node1"wsrep_node_name="ubuntu-node1"wsrep_sst_auth="root:root123"wsrep_node_incoming_address=172.25.10.21wsrep_sst_receive_address=172.25.10.21wsrep_slave_threads=16Configurations For ubuntu-node2[mysqld]wsrep_provider=/usr/lib/galera/libgalera_smm.sowsrep_provider_options="gcache.size=256M; gcache.page_size=128M"wsrep_cluster_address=gcomm://ubuntu-node1wsrep_cluster_name="MariaDB_Cluster"wsrep_node_address="ubuntu-node2"wsrep_node_name="ubuntu-node2"wsrep_sst_auth="root:root123"wsrep_node_incoming_address=172.25.10.22wsrep_sst_receive_address=172.25.10.22wsrep_slave_threads=16Configurations For ubuntu-node3[mysqld]wsrep_provider=/usr/lib/galera/libgalera_smm.sowsrep_provider_options="gcache.size=256M; gcache.page_size=128M"wsrep_cluster_address=gcomm://ubuntu-node1wsrep_cluster_name="MariaDB_Cluster"wsrep_node_address="ubuntu-node3"wsrep_node_name="ubuntu-node3"wsrep_sst_auth="root:root123"wsrep_node_incoming_address=172.25.10.23wsrep_sst_receive_address=172.25.10.23wsrep_slave_threads=16Restart MySQL Services
After configuring the mysql and wsrep parameters we need to restart its service on all the node.
root@ubuntu-node1:~# service mysql restartroot@ubuntu-node2:~# service mysql restartroot@ubuntu-node3:~# service mysql restart

  G* G6 Y5 G( g& A: Z                               
登录/注册后可看大图
Testing MariaDB Galera Cluster
To confirm the status of MariaDB cluster VSRep, let’s login to the MariaDB console and execute the following command to check the output of give command.
root@ubuntu-node1:~# mysql -u root –pMariaDB [(none)]> show status like 'wsrep_%';
$ R. Y1 i% d+ {
                               
登录/注册后可看大图
You can also confirm the status of your running cluster and its replication by running the below command on each of your node. You will see the cluster size in response to the output of that command.
root@ubuntu-node1:~# mysql -u root -p -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"'root@ubuntu-node2:~# mysql -u root -p -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"'root@ubuntu-node3:~# mysql -u root -p -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"'
* r1 B8 E, h- C8 f
                               
登录/注册后可看大图
Congratulations, the output on each of the node shows that you have successfully configured a MariaDB cluster with Galera.
 楼主| 发表于 2022-1-19 11:30:03 | 显示全部楼层
其次要禁用SElinux、防火牆配置、禁用AppArmor,不過這些在Ubuntu14.04下都是不用配置的,所以就不詳細說明配置步驟。
開始安裝$ W4 u* |& ?5 H
下面就是最實用的安裝過程,親測有效!
3 {! i5 ^! ?: J% R1.安裝需要的源
apt-get install software-properties-commonapt-key adv --keyserver keyserver.ubuntu.com --recv BC19DDBA
  W. y6 N7 x% L3 O9 w" y
然後建立建立一個檔案,/etc/apt/sources.list.d/galera.list,galera.list裡面的內容為:
deb http://releases.galeracluster.com/ubuntu trusty main/ B! E2 i; {# a  f$ Q
接下來就更新一下:
apt-get update
" d' `5 p+ z/ Z0 I9 W& G
源配置好了之後,接下來就該安裝檔案了,執行:
apt-get install galera-3 galera-arbitrator-3 mysql-wsrep-5.6
: w  W! G/ g, z$ `) {
安裝完成之後,在每一個節點上啟動Mysql:
service mysql start
" x( d& S+ g3 o* t1 X
然後,驗證節點之間是否能互相ping通:
root@node1:~#ping 192.168.1.175root@node1:~#ping 192.168.1.176root@node2:~#ping 192.168.1.174root@node2:~#ping 192.168.1.176root@node3:~#ping 192.168.1.174root@node3:~#ping 192.168.1.175
$ B7 l# [! C, H. F
安裝好了,那麼下面要來修改Mysql的配置檔案了,開啟/etc/mysql/my.cnf,修改bind-address 127.0.0.1為:
bind-address = 0.0.0.08 t2 t: T7 j% T3 t& b8 o
表示任何主機可以訪問。重啟Mysql:
service mysql restart
- d# \* L" E# s: j7 U0 q
接下來,試著在任何一個節點登入其他節點,比如Node1上執行:
mysql -h 192.168.1.175 -u root -p
  Z- h  X- l) `' \; x
此時會讓你輸入Mysql密碼,說明Node2上的Mysql伺服器是在監聽的,但此時輸入密碼是登入不成功的,後面會解決這個!
* k+ c" f% w0 ~4 N5 F. k接下來,我們還要對Mysql配置檔案進一步配置:
在 Node1 上的/etc/mysql/my.cnf裡面的[mysql]下面新增上:binlog_format=ROWdefault-storage-engine=innodbinnodb_autoinc_lock_mode=2wsrep_provider=/usr/lib/libgalera_smm.sowsrep_provider_options="gcache.size=300M; gcache.page_size=1G"wsrep_cluster_name="galeracluster"wsrep_cluster_address="gcomm://"wsrep_sst_method=rsyncwsrep_sst_auth=wsrep:password 在 Node2 上的/etc/mysql/my.cnf裡面的[mysql]下面新增上:binlog_format=ROWdefault-storage-engine=innodbinnodb_autoinc_lock_mode=2wsrep_provider=/usr/lib/libgalera_smm.sowsrep_provider_options="gcache.size=300M; gcache.page_size=1G"wsrep_cluster_name="galeracluster"wsrep_cluster_address="gcomm://192.168.1.174"wsrep_sst_method=rsyncwsrep_sst_auth=wsrep:password 在 Node3 上的/etc/mysql/my.cnf裡面的[mysql]下面新增上:binlog_format=ROWdefault-storage-engine=innodbinnodb_autoinc_lock_mode=2wsrep_provider=/usr/lib/libgalera_smm.sowsrep_provider_options="gcache.size=300M; gcache.page_size=1G"wsrep_cluster_name="galeracluster"wsrep_cluster_address="gcomm://192.168.1.174"wsrep_sst_method=rsyncwsrep_sst_auth=wsrep:password
3 \; B: z; R8 M' \
以上三個節點的配置注意以下幾點:/ b- p/ y4 I9 a1 z1 q; z2 Q
1. default_storage_engine這一行是必須的,因為Galera只能複製innodb的資料庫/ x0 x3 q8 ?- Q) g- }/ `
2. wsrep_cluster_name這一行指定了叢集的名稱,叢集中的每個節點上都必須設定為一樣
6 O9 U- Z. H( e* [; D# \% y3. 作為叢集中第一個啟動的節點Node1,wsrep_cluster_address必須設定為空,即"gcomm://",其他節點則要指定, {) k+ [+ J* o. H+ ^3 B
4. 最後一行的使用者名稱和密碼在所有節點上都必須一樣(此處使用者名稱為wsrep,後面馬上會建立該使用者,密碼為password)
下面,在每個節點上建立使用者及實現遠端資料庫可以登入(解決前文說到的無法訪問):
mysql –u root –pCREATE USER ‘wsrep’@’%’ IDENTIFIED BY ‘password’;CREATE USER ‘root’@’%’ IDENTIFIED BY ‘password’;GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES;, t* Z! w6 N0 o) d7 E2 `- x
重啟資料庫,然後可以試試前面提到的從Node1登入到Node2是否能成功!
接下來,Ubuntu有一個特別的使用者叫debian-sys-maint會來維持Mysql的執行任務,由於資料庫的複製,這個維護的執行只會在第一個節點成功進行,在其他節點上則會失敗,所以要將啟動節點上的/etc/mysql/debian.cnf檔案拷貝到其他節點上,執行如下命令:
scp /etc/mysql/debian.cnf root@192.168.1.175:/etc/mysql/scp /etc/mysql/debian.cnf root@192.168.1.176:/etc/mysql/+ U0 d' U" ~) c1 m7 F& }1 r4 k( V
執行過程中可能會失敗,這個問題是因為在/etc/mysql/my.cnf檔案中有一行要改為:
PermitRootLogin yes
8 l( h9 E- d/ ]& w9 Y$ t' q
這樣就會成功了!
當以上步驟都完成了之後,可以準備開始啟動叢集了!
啟動叢集
) G  a: d' \) r. z! n1 {, I# C
在Node1上將mysql服務先停掉然後重啟,注意一定要在前面提到的wsrep_cluster_address="gcomm://"的節點上(本例中就是Node1)執行最開始的啟動程式:
service mysql stopservice mysql start --wsrep-new-cluster! k: q: \- z$ b: U7 a4 k2 M
在其他節點上執行:
service mysql restart 驗證是否成功 檢視資料表
. c5 B4 o5 b. W" {
登入Node1:
mysql -u root -pEnter password:mysql> SHOW STATUS LIKE 'wsrep%';4 F6 z1 M' V- h' t& x- }# u
重點關注的是下面這幾行:
wsrep_ready | ON& y6 b7 U1 F' e2 H
如果狀態是 ON,那麼就要看:
wsrep_cluster_size | 35 C6 g. p( B, y" p+ [
如果是3,那麼是成功的,否則是不成功的!
資料庫複製測試
. F# Y' R, P; i4 S; T
在Node1上建立一個表:
CREATE database test;( N. ^) ]2 y6 `- ]* e+ w3 _1 q
立刻到Node2和Node3節點上使用 show databases; 檢視是否也有了test這個資料庫,如果有則成功!
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 20:23 , Processed in 0.057965 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表