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 [email protected]‘%‘ IDENTIFIED BY ‘sstpass123‘; mysql> GRANT ALL PRIVILEGES on *.* to [email protected]‘%‘; mysql> GRANT USAGE ON *.* to [email protected]‘localhost‘ IDENTIFIED BY ‘sstpass123‘; mysql> GRANT ALL PRIVILEGES on *.* to [email protected]‘localhost‘; mysql> FLUSH PRIVILEGES; mysql> quit
8.新增节点参见步骤1-4。
时间: 2024-10-12 23:24:34