1.安裝服務包組:
yum -y install mariadb-galera mariadb-galera-server xtrabackup
2.修改配置文件
vim /etc/my.cnf.d/galera.cnf
修改如下參數:
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中加入如下行:
!includedir /etc/my.cnf.d/
4. 設置開機啓動MariaDB
chkconfig mysqld on
5. 確認MariaDB已正確安裝並處於運行狀態
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字樣輸出,則說明安裝正常。
6. 設置MariaDB的root密碼,並做安全加固
/usr/bin/mysql_secure_installation
7. 在mysql中新建sst用戶
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。