mariadb galera cluster数据库集群一键安装脚本
mariadb galare cluster是一套高可用全主mysql集群方案,优势高度数据一致性。
脚本:
#!/bin/bash
# Author: laocao
# Date: 2016/05/03
# Revision: 1.0
if [ ! -f "/etc/yum.repos.d/mariadb.repo" ];then
echo "[mariadb]" >>/etc/yum.repos.d/mariadb.repo
echo "name = MariaDB" >>/etc/yum.repos.d/mariadb.repo
echo "baseurl = http://yum.mariadb.org/10.0/centos6-amd64" >>/etc/yum.repos.d/mariadb.repo
echo "enabled = 1" >>/etc/yum.repos.d/mariadb.repo
echo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" >>/etc/yum.repos.d/mariadb.repo
echo "gpgcheck=1" >>/etc/yum.repos.d/mariadb.repo
echo -e "\033[32m add mariadb yum repo successflly \033[0m"
yum makecache
else
echo -e "\033[31m mariadb.repo has exist! noting to do \033[0m"
fi
echo ""
echo "#######install MariaDB-Galera-server galera MariaDB-client#######"
yum -y install MariaDB-Galera-server galera MariaDB-client
echo -e "\033[32m install MariaDB success \033[0m"
echo ""
if [ ! -d /data/DBdata ];then
mkdir /data/DBdata
mkdir /data/binlog
chown -R mysql.mysql /data/DBdata
chown -R mysql.mysql /data/binlog
echo -e "\033[32m create DBdata and binlog directories successflly! \033[0m"
else
echo -e "\033[31m /data/DBdata has exist! noting to do \033[0m"
fi
echo ""
echo "#####mysql_install_db####"
mysql_install_db --user=mysql --datadir=/data/DBdata
echo -e "\033[32m mysql_install_db has completed \033[0m"
echo ""
echo -e "\033[31m you need copy wsref.cnf to /etc/my.cnf.d/ \033[0m"
echo -e "\033[31m you can start database manually \033[0m"
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341