资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

mariadbgaleracluster数据库集群一键安装脚本

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" 


文章标题:mariadbgaleracluster数据库集群一键安装脚本
标题来源:http://cdkjz.cn/article/ihcjid.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220