Created
August 30, 2015 10:32
-
-
Save momijiame/ebd750c1e7ed6002ba93 to your computer and use it in GitHub Desktop.
MariaDB Galera Cluster w/CentOS7 - sysbench
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -x | |
set -e | |
SERVICE_OPTION=${1:-""} | |
cat << EOF | sudo tee /etc/yum.repos.d/MariaDB.repo | |
[mariadb] | |
name = MariaDB | |
baseurl = http://yum.mariadb.org/10.0/centos7-amd64 | |
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB | |
gpgcheck=1 | |
EOF | |
yum clean all | |
yum -y install epel-release | |
yum -y install MariaDB-Galera-server MariaDB-client galera sysbench | |
firewall-cmd --permanent --add-port=3306/tcp | |
firewall-cmd --permanent --add-port=4444/tcp | |
firewall-cmd --permanent --add-port=4567/tcp | |
firewall-cmd --permanent --add-port=4568/tcp | |
firewall-cmd --reload | |
cat << EOF | sudo tee /etc/my.cnf.d/server.cnf > /dev/null | |
[mariadb] | |
wsrep_provider='/usr/lib64/galera/libgalera_smm.so' | |
wsrep_cluster_address=gcomm://192.168.33.11,192.168.33.12,192.168.33.13 | |
wsrep_node_address=$(ip -f inet -o addr show | grep "192.168.33." | cut -d "/" -f 1 | awk '{print $NF}') | |
binlog_format=ROW | |
default_storage_engine=InnoDB | |
innodb_autoinc_lock_mode=2 | |
innodb_doublewrite=1 | |
wsrep_on=ON | |
log-error = error.log | |
EOF | |
service mysql start ${SERVICE_OPTION} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -x | |
set -e | |
cat << EOF | sudo tee /etc/yum.repos.d/MariaDB.repo | |
[mariadb] | |
name = MariaDB | |
baseurl = http://yum.mariadb.org/10.0/centos7-amd64 | |
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB | |
gpgcheck=1 | |
EOF | |
yum -y install epel-release | |
yum -y install MariaDB-server sysbench | |
systemctl start mysql | |
systemctl enable mysql | |
cat << EOF | sudo tee /etc/my.cnf.d/server.cnf > /dev/null | |
[mariadb] | |
binlog_format=ROW | |
default_storage_engine=InnoDB | |
innodb_autoinc_lock_mode=2 | |
innodb_doublewrite=1 | |
log-error = error.log | |
EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.define :node1, primary: true do |node1| | |
node1.vm.box = "centos7" | |
node1.vm.box_url = "https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box" | |
node1.vm.network "private_network", ip: "192.168.33.11" | |
node1.vm.provider "virtualbox" do |vb| | |
vb.cpus = "2" | |
vb.memory = "1024" | |
end | |
node1.vm.provision :shell do |shell| | |
shell.path = "galeracluster.sh" | |
shell.args = ["--wsrep-new-cluster"] | |
end | |
end | |
config.vm.define :node2 do |node2| | |
node2.vm.box = "centos7" | |
node2.vm.box_url = "https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box" | |
node2.vm.network "private_network", ip: "192.168.33.12" | |
node2.vm.provider "virtualbox" do |vb| | |
vb.cpus = "2" | |
vb.memory = "1024" | |
end | |
node2.vm.provision :shell do |shell| | |
shell.path = "galeracluster.sh" | |
shell.args = [] | |
end | |
end | |
config.vm.define :node3 do |node3| | |
node3.vm.box = "centos7" | |
node3.vm.box_url = "https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box" | |
node3.vm.network "private_network", ip: "192.168.33.13" | |
node3.vm.provider "virtualbox" do |vb| | |
vb.cpus = "2" | |
vb.memory = "1024" | |
end | |
node3.vm.provision :shell do |shell| | |
shell.path = "galeracluster.sh" | |
shell.args = [] | |
end | |
end | |
config.vm.define :standalone do |standalone| | |
standalone.vm.box = "centos7" | |
standalone.vm.box_url = "https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box" | |
standalone.vm.network "private_network", ip: "192.168.33.14" | |
standalone.vm.provider "virtualbox" do |vb| | |
vb.cpus = "2" | |
vb.memory = "1024" | |
end | |
standalone.vm.provision :shell do |shell| | |
shell.path = "standalone.sh" | |
shell.args = [] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment