標籤:nload wal http 建立 啟動 x86_64 叢集 install config
(1)環境介紹
galera官網:http://galeracluster.com/downloads/# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)
(2)以下配置三台伺服器都相同
關閉防火牆和selinux
systemctl disable firewalld systemctl stop firewalldsed -ri ‘/SELINUX=/cSELINUX=disabled‘ /etc/selinux/configsetenforce 0
配置yum源
cat >>/etc/yum.repos.d/galera.repo<<EOF[galera1]name=galera1baseurl=http://releases.galeracluster.com/mysql-wsrep-5.7/centos/7/x86_64/gpgcheck=0[galera2]name=galera2baseurl=http://releases.galeracluster.com/galera-3/centos/7/x86_64/gpgcheck=0EOF
安裝mysql和galera外掛程式
yum repolistyum list | egrep "wsrep|galera"yum -y install mysql-wsrep-server-5.7.x86_64 rsync galera-3.x86_64 -y
啟動mysqld
systemctl start mysqldsystemctl enable mysqldnewpass=$(grep "temporary password" /var/log/mysqld.log | awk ‘{print $NF}‘)mysqladmin -uroot -p"$newpass" password ‘[email protected]‘
建立用於資料同步的使用者
mysql -uroot [email protected] -e "grant all on *.* to ‘copy‘@‘192.168.1.%‘ identified by ‘[email protected]‘"mysql -uroot [email protected] -e "flush privileges;"
(3)修改設定檔:三台不一樣
node1:192.168.1.31
#vi /etc/my.cnfbinlog_format=rowdefault_storage_engine=InnoDBinnodb_autoinc_lock_mode=2bind-address=0.0.0.0wsrep_on=ONwsrep_provider=/usr/lib64/galera-3/libgalera_smm.sowsrep_cluster_address="gcomm://"wsrep_cluster_name="test"wsrep_node_address="192.168.1.31"wsrep_node_name="node1"wsrep_sst_auth=copy:[email protected]wsrep_sst_method=rsync
重啟mysqld伺服器:systemctl restart mysqld驗證連接埠狀態:ss -anltup | egrep "3306|4567"
node1節點上查看狀態
node2:192.168.1.32
#vi /etc/my.cnfbinlog_format=rowdefault_storage_engine=InnoDBinnodb_autoinc_lock_mode=2bind-address=0.0.0.0wsrep_on=ONwsrep_provider=/usr/lib64/galera-3/libgalera_smm.sowsrep_cluster_address="gcomm://192.168.1.31,192.168.1.32,192.168.1.33"wsrep_cluster_name="test"wsrep_node_address="192.168.1.32"wsrep_node_name="node2"wsrep_sst_auth=copy:[email protected]wsrep_sst_method=rsync
重啟mysqld伺服器:systemctl restart mysqld驗證連接埠狀態:ss -anltup | egrep "3306|4567"
node3:192.168.1.33
#vi /etc/my.cnfbinlog_format=rowdefault_storage_engine=InnoDBinnodb_autoinc_lock_mode=2bind-address=0.0.0.0wsrep_on=ONwsrep_provider=/usr/lib64/galera-3/libgalera_smm.sowsrep_cluster_address="gcomm://192.168.1.31,192.168.1.32,192.168.1.33"wsrep_cluster_name="test"wsrep_node_address="192.168.1.33"wsrep_node_name="node3"wsrep_sst_auth=copy:[email protected]wsrep_sst_method=rsync
重啟mysqld伺服器:systemctl restart mysqld驗證連接埠狀態:ss -anltup | egrep "3306|4567"
注意:node定義剛開始定義叢集是wsrep_cluster_address="gcomm://",如果node1重啟Mysql服務,
這個地址需要修改wsrep_cluster_address="gcomm://192.168.1.33,192.168.1.32,192.168.1.31"
參數解釋
wsrep_incoming_addresses :表示叢集主機ip
wsrep_cluster_size :叢集主機統計數量
wsrep_connected :串連狀態
(十六)MySQL叢集galera實現