MySQL Galera Cluster部署與使用
MySQL Galera Cluster 是一個(gè)高可用、同步復(fù)制的數(shù)據(jù)庫(kù)解決方案,基于 Galera Library 和 MySQL 數(shù)據(jù)庫(kù)。它設(shè)計(jì)用于提供高可用性、負(fù)載均衡和數(shù)據(jù)一致性,特別適合需要高寫入負(fù)載和多主節(jié)點(diǎn)支持的場(chǎng)景。
主要特點(diǎn)
同步復(fù)制:
- 所有的寫操作(包括插入、更新、刪除)在集群中的所有節(jié)點(diǎn)上都是同步的。這意味著每個(gè)節(jié)點(diǎn)上的數(shù)據(jù)是完全一致的。
多主節(jié)點(diǎn)(Multi-Master):
- 集群中的每個(gè)節(jié)點(diǎn)都是主節(jié)點(diǎn)。所有節(jié)點(diǎn)都可以處理讀寫請(qǐng)求,從而實(shí)現(xiàn)負(fù)載均衡和高可用性。
自動(dòng)故障轉(zhuǎn)移:
- 如果一個(gè)節(jié)點(diǎn)發(fā)生故障,其他節(jié)點(diǎn)會(huì)自動(dòng)接管,確保系統(tǒng)持續(xù)可用。
自動(dòng)節(jié)點(diǎn)加入:
- 新節(jié)點(diǎn)可以自動(dòng)加入集群,并同步到當(dāng)前集群狀態(tài)。
數(shù)據(jù)一致性:
- 使用基于事務(wù)的復(fù)制保證數(shù)據(jù)一致性,所有事務(wù)在所有節(jié)點(diǎn)上以相同的順序執(zhí)行。
容錯(cuò)性:
- 集群能夠處理網(wǎng)絡(luò)分區(qū)和節(jié)點(diǎn)故障,確保集群的健壯性。
組件
Galera Library:
- 提供了同步復(fù)制功能和事務(wù)一致性。Galera Library 負(fù)責(zé)復(fù)制和應(yīng)用事務(wù)。
MySQL 數(shù)據(jù)庫(kù):
- 提供數(shù)據(jù)庫(kù)管理功能,包括 SQL 支持、查詢優(yōu)化等。
State Snapshot Transfer (SST) 和 Incremental State Transfer (IST):
- SST 用于將新節(jié)點(diǎn)與集群中的現(xiàn)有數(shù)據(jù)進(jìn)行同步,IST 用于在集群中節(jié)點(diǎn)之間進(jìn)行增量數(shù)據(jù)傳輸。
一. 環(huán)境準(zhǔn)備
主機(jī)名 | IP | 系統(tǒng) | 軟件版本 | 配置信息 |
galera1 | 192.168.226.31 | Rocky_linux9.4 | mysql-wsrep-8.0 galera-26.4.14-1 | 2核4G |
galera2 | 192.168.226.32 | Rocky_linux9.4 | mysql-wsrep-8.0 galera-26.4.14-1 | 2核4G |
galera3 | 192.168.226.33 | Rocky_linux9.4 | mysql-wsrep-8.0 galera-26.4.14-1 | 2核4G |
galera4 | 192.168.226.34 | Rocky_linux9.4 | mysql-wsrep-8.0 galera-26.4.14-1 | 2核4G |
同意關(guān)閉防火墻和selinux,進(jìn)行時(shí)間同步。
主機(jī)解析:
[root@galera1 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.226.32 galera2 192.168.226.33 galera3 192.168.226.34 galera4
[root@galera2 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.226.31 galera1 192.168.226.33 galera3 192.168.226.34 galera4
[root@galera3 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.226.32 galera2 192.168.226.31 galera1 192.168.226.34 galera4
[root@galera4 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.226.32 galera2 192.168.226.33 galera3 192.168.226.31 galera1
四臺(tái)虛擬機(jī)都導(dǎo)入創(chuàng)建該服務(wù)的yum源
[root@galera1 ~]# cat /etc/yum.repos.d/mysql-wsrep.repo [galera] name=galera baseurl=http://releases.galeracluster.com/mysql-wsrep-8.0/redhat/9/x86_64/ enabled=1 gpgcheck=0
[root@galera1 ~]# yum clean all
四臺(tái)虛擬機(jī)都下載mysql-wsrep-8.0和galera
[root@galera1 ~]# yum install -y mysql-wsrep-8.0 galera
mysql-wsrep-8.0
:
mysql-wsrep-8.0
是 MySQL 8.0 版本的一個(gè)變體,集成了 WSREP(Write Set Replication)協(xié)議。這是一個(gè)用于數(shù)據(jù)庫(kù)集群的復(fù)制協(xié)議,允許 MySQL 數(shù)據(jù)庫(kù)節(jié)點(diǎn)之間的同步復(fù)制。- 這個(gè)版本的 MySQL 是通過 WSREP 協(xié)議來實(shí)現(xiàn)數(shù)據(jù)的一致性和高可用性。WSREP 協(xié)議確保了所有節(jié)點(diǎn)的數(shù)據(jù)庫(kù)狀態(tài)保持一致,支持事務(wù)的自動(dòng)同步和沖突解決。
- 通常,這種版本的 MySQL 是在集群配置中使用的,旨在提高系統(tǒng)的容錯(cuò)能力和可擴(kuò)展性。
Galera:
- Galera 是一個(gè)用于 MySQL 數(shù)據(jù)庫(kù)的同步復(fù)制插件,它實(shí)現(xiàn)了 WSREP 協(xié)議。Galera 提供了一個(gè)多主節(jié)點(diǎn)的數(shù)據(jù)庫(kù)集群方案,允許所有節(jié)點(diǎn)同時(shí)進(jìn)行讀寫操作,并且確保數(shù)據(jù)在所有節(jié)點(diǎn)之間保持一致。
- 它主要用于提高數(shù)據(jù)庫(kù)的可用性、容錯(cuò)性和擴(kuò)展性。Galera 使得所有節(jié)點(diǎn)都能夠同時(shí)處理讀寫請(qǐng)求,這比傳統(tǒng)的主從復(fù)制模式更具靈活性。
- Galera 可以與 MySQL 以及 MariaDB 配合使用,它的主要特點(diǎn)包括全同步復(fù)制、自動(dòng)節(jié)點(diǎn)加入、沖突檢測(cè)和解決等。
二. 配置
四臺(tái)虛擬器都啟動(dòng)服務(wù),并改個(gè)密碼
[root@galera1 ~]# systemctl start mysqld
# 獲取數(shù)據(jù)庫(kù)初始化密碼的步驟 [root@galera1 ~]# password=$(grep "temporary password" /var/log/mysqld.log | awk -F': ' '{print $2}') [root@galera1 ~]# echo $password D.s#wfreZ8L% #改密碼 [root@galera1 ~]# mysqladmin -p"$password" password "Qaz123456+"
四臺(tái)服務(wù)都配置一個(gè)遠(yuǎn)程用戶并授權(quán),采用腳本方式執(zhí)行
[root@galera1 ~]# vim user.sh #每臺(tái)都要執(zhí)行一次,用來創(chuàng)建遠(yuǎn)程用戶并授權(quán) #!/bin/bash # MySQL 連接參數(shù) MYSQL_USER="root" MYSQL_PASS="Qaz123456+" # 替換為實(shí)際的 root 密碼 MYSQL_HOST="localhost" # 或者使用 IP 地址 # 創(chuàng)建遠(yuǎn)程用戶和授予權(quán)限的 SQL 命令 SQL_COMMANDS=" CREATE USER 'syncuser'@'%' IDENTIFIED BY 'Qaz123456+'; GRANT ALL PRIVILEGES ON *.* TO 'syncuser'@'%'; FLUSH PRIVILEGES; " # 執(zhí)行 SQL 命令 mysql -u "$MYSQL_USER" -p"$MYSQL_PASS" -h "$MYSQL_HOST" -e "$SQL_COMMANDS"
[root@galera1 ~]# sh user.sh
四臺(tái)虛擬機(jī)服務(wù)都先停止
[root@galera1 ~]# systemctl stop mysqld
1. 配置 galera1 主機(jī)的my.cnf的文件
[root@galera1 ~]# vim /etc/my.cnf #在最后行增加即可 server-id=1 # 服務(wù)器 ID,用于唯一標(biāo)識(shí) MySQL 服務(wù)器 binlog_format=row # 二進(jìn)制日志格式,行級(jí)別 innodb_file_per_table=1 # 為每個(gè) InnoDB 表使用一個(gè)獨(dú)立的表空間文件 innodb_autoinc_lock_mode=2 # 自增鎖模式,2表示更高效的鎖模式 wsrep_on=ON # 啟用 Galera 集群 wsrep_provider=/usr/lib64/galera/libgalera_smm.so # Galera 提供者庫(kù)的路徑 wsrep_cluster_name='galera' # Galera 集群的名稱 wsrep_cluster_address='gcomm://' # Galera 集群的地址,通常為 `gcomm://` 表示集群初始節(jié)點(diǎn) wsrep_node_name='galera1' # 當(dāng)前節(jié)點(diǎn)的名稱 wsrep_node_address='192.168.226.31' # 當(dāng)前節(jié)點(diǎn)的 IP 地址 wsrep_sst_auth=syncuser:'Qaz123456+' # SST(狀態(tài)快照傳輸)認(rèn)證信息 wsrep_sst_method=rsync # SST 方法,使用 rsync 進(jìn)行狀態(tài)快照傳輸
啟動(dòng)galera1主機(jī)的mysql
[root@galera1 ~]# systemctl start mysqld
[root@galera1 ~]# ss -tnlp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 4096 0.0.0.0:4567 0.0.0.0:* users:(("mysqld",pid=5145,fd=9)) LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=819,fd=3)) LISTEN 0 70 *:33060 *:* users:(("mysqld",pid=5145,fd=33)) LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=819,fd=4)) LISTEN 0 151 *:3306 *:* users:(("mysqld",pid=5145,fd=35)) 4567: 用于 Galera 集群的內(nèi)部通信。這是 MySQL 數(shù)據(jù)庫(kù)的默認(rèn)端口,用于客戶端連接 MySQL 數(shù)據(jù)庫(kù)。所有的 SQL 查詢和數(shù)據(jù)庫(kù)操作通過這個(gè)端口進(jìn)行。 33060: 用于 MySQL X Protocol。這是 MySQL 的 X Plugin 端口,主要用于 MySQL 的 X Protocol (MySQL Shell、MySQL Router 和其他 MySQL X API 客戶端) 的連接。 3306: 用于 MySQL 數(shù)據(jù)庫(kù)客戶端連接。這是 MySQL 數(shù)據(jù)庫(kù)的默認(rèn)端口,用于客戶端連接 MySQL 數(shù)據(jù)庫(kù)。所有的 SQL 查詢和數(shù)據(jù)庫(kù)操作通過這個(gè)端口進(jìn)行。
2. 配置 galera2 主機(jī)的my.cnf的文件
[root@galera2 ~]# systemctl start mysqld server-id=2 binlog_format=row innodb_file_per_table=1 innodb_autoinc_lock_mode=2 wsrep_on=ON wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_name='galera' wsrep_cluster_address='gcomm://galera1,galera3,galera4' wsrep_node_name='galera2' wsrep_node_address='192.168.226.32' wsrep_sst_auth=syncuser:'Qaz123456+' wsrep_sst_method=rsync
啟動(dòng)galera2主機(jī)的mysql
[root@galera2 ~]# systemctl start mysqld
3. 配置 galera3 主機(jī)的my.cnf的文件
[root@galera3 ~]# vim /etc/my.cnf server-id=3 binlog_format=row innodb_file_per_table=1 innodb_autoinc_lock_mode=2 wsrep_on=ON wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_name='galera' wsrep_cluster_address='gcomm://galera1,galera3,galera4' wsrep_node_name='galera2' wsrep_node_address='192.168.226.33' wsrep_sst_auth=syncuser:'Qaz123456+' wsrep_sst_method=rsync
啟動(dòng)galera3主機(jī)的mysql
[root@galera3 ~]# systemctl start mysqld
4. 在給galera1 主機(jī)的my.cnf的文件增加節(jié)點(diǎn)
[root@galera1 ~]# vim /etc/my.cnf #增加上節(jié)點(diǎn),即修改這行內(nèi)容如下,或見下圖所示: wsrep_cluster_address='gcomm://galera2,galera3,galera4' # Galera 集群的地址,通常為 `gcomm://` 表示集群初始節(jié)點(diǎn)
重啟動(dòng)galera1主機(jī)的mysql
[root@galera1 ~]# systemctl restart mysqld
5. 寫入數(shù)據(jù)驗(yàn)證同步
在 galera1主機(jī)寫入數(shù)據(jù),創(chuàng)建一個(gè)庫(kù)
[root@galera1 ~]# mysql -uroot -p"Qaz123456+" mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.37 Galera Cluster for MySQL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE DATABASE database_name; Query OK, 1 row affected (0.00 sec)
在 galera2和galera3主機(jī)查看
[root@galera2 ~]# mysql -uroot -p"Qaz123456+" mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 8.0.37 Galera Cluster for MySQL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | database_name | | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec)
[root@galera3 ~]# mysql -uroot -p"Qaz123456+" mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 8.0.37 Galera Cluster for MySQL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | database_name | | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec)
可以看到在 galera1主機(jī)創(chuàng)建的庫(kù),同步寫入到了其他節(jié)點(diǎn)的mysql中。
6. 配置 galera4 主機(jī)的my.cnf的文件
[root@galera4 ~]# vim /etc/my.cnf server-id=4 binlog_format=row innodb_file_per_table=1 innodb_autoinc_lock_mode=2 wsrep_on=ON wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_name='galera' wsrep_cluster_address='gcomm://galera1,galera2,galera3' wsrep_node_name='galera1' wsrep_node_address='192.168.226.34' wsrep_sst_auth=syncuser:'Qaz123456+' wsrep_sst_method=rsync
啟動(dòng)galera4主機(jī)的mysql
[root@galera4 ~]# systemctl start mysqld
登錄數(shù)據(jù)庫(kù)查看數(shù)據(jù)
[root@galera4 ~]# mysql -uroot -p"Qaz123456+" mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.37 Galera Cluster for MySQL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | database_name | | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec)
如此驗(yàn)證成功,新啟動(dòng)的mysq即為新加入集群的msyql,啟動(dòng)即發(fā)現(xiàn),并完成同步數(shù)據(jù)。
MySQL Galera Cluster 和傳統(tǒng)My SQL的區(qū)別
1. 集群架構(gòu)
傳統(tǒng) MySQL:
- 主從復(fù)制:傳統(tǒng)的 MySQL 配置通常包括一個(gè)主服務(wù)器和多個(gè)從服務(wù)器。從服務(wù)器從主服務(wù)器接收數(shù)據(jù)更新。這是一種異步復(fù)制方式,意味著從服務(wù)器可能會(huì)滯后于主服務(wù)器。
- 主主復(fù)制:一些系統(tǒng)配置多個(gè)主節(jié)點(diǎn)進(jìn)行主主復(fù)制,但仍存在潛在的數(shù)據(jù)一致性問題。
MySQL Galera Cluster:
- 多主復(fù)制:Galera Cluster 是一個(gè)同步復(fù)制系統(tǒng),每個(gè)節(jié)點(diǎn)都可以充當(dāng)主節(jié)點(diǎn)。所有節(jié)點(diǎn)都可以讀寫操作,確保數(shù)據(jù)在所有節(jié)點(diǎn)之間保持一致。
- 同步復(fù)制:數(shù)據(jù)更改會(huì)在所有節(jié)點(diǎn)之間同步,這意味著所有節(jié)點(diǎn)的數(shù)據(jù)是一致的,沒有主從的延遲。
2. 一致性和容錯(cuò)
傳統(tǒng) MySQL:
- 最終一致性:在主從復(fù)制中,從節(jié)點(diǎn)的數(shù)據(jù)更新可能會(huì)有延遲,直到從節(jié)點(diǎn)追上主節(jié)點(diǎn)。數(shù)據(jù)一致性在主從復(fù)制中不是實(shí)時(shí)保證的。
- 容錯(cuò)性:?jiǎn)蝹€(gè)主節(jié)點(diǎn)的故障可能會(huì)導(dǎo)致整個(gè)系統(tǒng)停機(jī),盡管從節(jié)點(diǎn)可以作為備用,但恢復(fù)時(shí)間可能會(huì)較長(zhǎng)。
MySQL Galera Cluster:
- 強(qiáng)一致性:Galera Cluster 提供強(qiáng)一致性,即所有節(jié)點(diǎn)都在數(shù)據(jù)更新時(shí)保持一致。每個(gè)事務(wù)都需要在集群中的所有節(jié)點(diǎn)上成功提交才能被認(rèn)為是成功的。
- 高可用性:集群中的任何節(jié)點(diǎn)都可以提供服務(wù),并且集群能夠在節(jié)點(diǎn)失效時(shí)繼續(xù)運(yùn)行,只要集群中有足夠的節(jié)點(diǎn)來維持“法定人數(shù)”(quorum)。
3. 復(fù)制機(jī)制
傳統(tǒng) MySQL:
- 異步復(fù)制:數(shù)據(jù)從主服務(wù)器復(fù)制到從服務(wù)器,可能存在延遲。
- 半同步復(fù)制:可以配置為在主服務(wù)器確認(rèn)至少一個(gè)從服務(wù)器已收到數(shù)據(jù)之前才提交事務(wù),但這并不保證所有從服務(wù)器都已更新。
MySQL Galera Cluster:
- 同步復(fù)制:所有節(jié)點(diǎn)在事務(wù)提交時(shí)需要在集群中多數(shù)節(jié)點(diǎn)上確認(rèn)事務(wù),從而確保數(shù)據(jù)一致性。
4. 配置和管理
傳統(tǒng) MySQL:
- 復(fù)雜性:主從復(fù)制的配置和管理可能較為復(fù)雜,尤其是在處理主節(jié)點(diǎn)故障、重新配置主從關(guān)系以及負(fù)載均衡時(shí)。
- 自動(dòng)化工具:通常需要外部工具和腳本來處理故障轉(zhuǎn)移和負(fù)載均衡。
MySQL Galera Cluster:
- 集群管理:配置集群較為復(fù)雜,但它提供了內(nèi)置的節(jié)點(diǎn)加入和故障恢復(fù)機(jī)制。
- 故障轉(zhuǎn)移:Galera Cluster 內(nèi)置的機(jī)制使得節(jié)點(diǎn)故障轉(zhuǎn)移和恢復(fù)更加自動(dòng)化和高效。
5. 事務(wù)處理
傳統(tǒng) MySQL:
- 單節(jié)點(diǎn)事務(wù):事務(wù)處理通常發(fā)生在單個(gè)主節(jié)點(diǎn)上,可能會(huì)受制于主節(jié)點(diǎn)的性能和負(fù)載。
MySQL Galera Cluster:
- 全局事務(wù):事務(wù)需要在所有參與的節(jié)點(diǎn)上進(jìn)行一致性檢查和提交,可能會(huì)對(duì)事務(wù)性能產(chǎn)生影響,但保證了數(shù)據(jù)一致性。
6. 數(shù)據(jù)完整性
傳統(tǒng) MySQL:
- 數(shù)據(jù)一致性問題:在高負(fù)載和故障情況下,可能會(huì)出現(xiàn)數(shù)據(jù)一致性問題,尤其是在主從復(fù)制中。
MySQL Galera Cluster:
- 數(shù)據(jù)完整性:通過同步復(fù)制和全節(jié)點(diǎn)一致性檢查,Galera Cluster 更好地保證了數(shù)據(jù)的完整性和一致性。
擴(kuò)展:
如果節(jié)點(diǎn)全部關(guān)閉,重新都起來的解決辦法:
現(xiàn)在將四個(gè)節(jié)點(diǎn)全部停止,再起來mysql就都起不來了,這是因?yàn)榧旱奶攸c(diǎn),并且已經(jīng)有了集群的信息數(shù)據(jù)。只需要將一個(gè)節(jié)點(diǎn)的集群數(shù)據(jù)刪除即可。
[root@galera1 ~]# rm -rf /var/lib/mysql/g*
在刪除這個(gè)節(jié)點(diǎn)配置文件中配置的其他的節(jié)點(diǎn)名
[root@galera1 ~]# vim /etc/my.cnf 將這個(gè)行修改wsrep_cluster_address='gcomm://galera2,galera3,galera4' 修改為此行wsrep_cluster_address='gcomm://'
然后啟動(dòng)這個(gè)節(jié)點(diǎn)服務(wù)
[root@galera1 ~]# systemctl start mysqld
但這個(gè)幾點(diǎn)起來后,在將其余幾個(gè)節(jié)點(diǎn)啟動(dòng)就可以了。
[root@galera2 ~]# systemctl start mysqld [root@galera3 ~]# systemctl start mysqld [root@galera4 ~]# systemctl start mysqld
然后在把剛刪除galera1的配置文件中節(jié)點(diǎn)名再添加回去并重啟服務(wù)即可。
[root@galera1 ~]# vim /etc/my.cnf 再將這個(gè)行修改wsrep_cluster_address='gcomm://' 修改為此行wsrep_cluster_address='gcomm://galera2,galera3,galera4'
[root@galera1 ~]# systemctl restart mysqld
這是查驗(yàn)數(shù)據(jù)數(shù)據(jù)是否還完整
[root@galera1 ~]# mysql -uroot -p"Qaz123456+" mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 8.0.37 Galera Cluster for MySQL Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | database_name | | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec)
可以看到這樣數(shù)據(jù)依舊存在。
到此這篇關(guān)于MySQL Galera Cluster部署與使用的文章就介紹到這了,更多相關(guān)MySQL Galera Cluster部署內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
MySQL實(shí)現(xiàn)replace函數(shù)的幾種實(shí)用場(chǎng)景
這篇文章主要介紹了MySQL實(shí)現(xiàn)replace函數(shù)的幾種實(shí)用場(chǎng)景,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-02-02MySQL服務(wù)器進(jìn)程CPU占用100%的解決方法
早上幫朋友一臺(tái)服務(wù)器解決了 Mysql cpu 占用 100% 的問題。稍整理了一下,將經(jīng)驗(yàn)記錄在這篇文章里。2010-12-12解決mysql的賦權(quán)操作之GRANT ALL PRIVILEGES ON *.*
這篇文章主要介紹了解決mysql的賦權(quán)操作之GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION問題,本文給大家分享兩種情況分析分享解決方案,感興趣的朋友一起看看吧2022-11-11mysql數(shù)據(jù)庫(kù)基本語法及操作大全
這篇文章主要介紹了mysql數(shù)據(jù)庫(kù)基本語法及操作大全,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-04-04MySQL計(jì)劃任務(wù)(事件調(diào)度器) Event Scheduler介紹
MySQL5.1.x版本中引入了一項(xiàng)新特性EVENT,顧名思義就是事件、定時(shí)任務(wù)機(jī)制,在指定的時(shí)間單元內(nèi)執(zhí)行特定的任務(wù),因此今后一些對(duì)數(shù)據(jù)定時(shí)性操作不再依賴外部程序,而直接使用數(shù)據(jù)庫(kù)本身提供的功能2013-10-10