PXC5.7安裝(linux)
1,下載pxc5.7,並安裝
略
2,環境準備
192.168.1.1 server01
192.168.1.2 server02
192.168.1.3 server03
以上內容寫寫入/etc/hosts
2,配置pxc5.7
在server01
編輯my.cnf配置檔案
basedir = {pxcdir}
datadir = {datadir}
secure-file-priv = “”
pid-file = {datadir}/mysql.pid
socket = {datadir}/mysql.sock
port = 3306
server_id = 81
user =mysql
plugin-dir ={pxcdir}/lib64/mysql/plugin/
binlog_format =ROW
default-storage-engine = innodb
innodb_log_group_home_dir ={something}
log-error ={something}
relay-log ={something}
log-bin ={something}
3,初始化資料庫
{pxcdir}/sbin/mysqld --defaults-file=/datadir/my.cnf --initialize-insecure --user=mysql --basedir={pxcdir}
檢視error log,如無異常,則資料庫初始化成功
4,修改my.cnf檔案,增加pxc相關配置資訊
[mysqld]
wsrep_provider={pxcdir}/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=cluster01
wsrep_cluster_address=gcomm://server02,server03,server01
wsrep_node_name=server01
wsrep_node_address=server01
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sstuser:passw0rd
pxc_strict_mode=ENFORCING
innodb_autoinc_lock_mode=2
[xtrabackup]
use-memory=32M
[sst]
inno-apply-opts="–use-memory=32M"
encrypt=0
sockopt=“retry=2,interval=3”
transferfmt=socat
streamfmt=xbstream
檢查系統是否有xtrabackup,socat和xbstream,如果沒有則需要安裝
5,啟動pxc中的第一個節點
第一個節點啟動需要加引數 --wsrep_cluster_address=‘gcomm://’
否則啟動會失敗
{pxcdir}/sbin/mysqld --defaults-file={datadir}/my.cnf
–wsrep_cluster_address=‘gcomm://’ &
6,新增資料庫使用者
mysql> GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON . TO ‘sstuser’@’%’;
7.配置第二個節點my.cnf
server_id = 82
wsrep_node_name=server02
wsrep_node_address=server02
8,啟動第二個節點
9,配置並啟動第三個節點
10,檢視error log
mysql >show status like ‘wsrep%’