#!/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"
MARIADB galera Cluster One-click installation script