Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

One-click installation script for mariadb galera cluster database cluster

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Mariadb galare cluster is a highly available all-host mysql cluster solution with a high degree of data consistency.

Script:

#! / 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"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report