1.安裝服務包組:node
yum -y install mariadb-galera mariadb-galera-server xtrabackup
2.修改配置文件mysql
vim /etc/my.cnf.d/galera.cnf
修改以下參數:
sql
wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_address="gcomm://" wsrep_node_address=172.16.0.11 wsrep_sst_auth= sst:sstpass123 wsrep_sst_method=xtrabackup 注:wsrep_cluster_address="gcomm://"
3. 在/etc/my.cnf中加入以下行:
vim
!includedir /etc/my.cnf.d/
4. 設置開機啓動MariaDB
安全
chkconfig mysqld on
5. 確認MariaDB已正確安裝並處於運行狀態bash
service mysqld start mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 14Server version: 5.5.36-MariaDB-wsrep MariaDB Server, wsrep_25.9.r3961Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
若是有wsrep字樣輸出,則說明安裝正常。
ide
6. 設置MariaDB的root密碼,並作安全加固
ui
/usr/bin/mysql_secure_installation
7. 在mysql中新建sst用戶
spa
mysql -u root -p mysql> GRANT USAGE ON *.* to sst@'%' IDENTIFIED BY 'sstpass123'; mysql> GRANT ALL PRIVILEGES on *.* to sst@'%'; mysql> GRANT USAGE ON *.* to sst@'localhost' IDENTIFIED BY 'sstpass123'; mysql> GRANT ALL PRIVILEGES on *.* to sst@'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit
8.新增節點參見步驟1-4。orm