首页 > 代码库 > Galera MariaDB 搭建
Galera MariaDB 搭建
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。
Galera MariaDB 搭建
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。