Last active
November 17, 2016 17:47
-
-
Save 3manuek/3e1e1084bb38b5b10e9c6080a09fa5b5 to your computer and use it in GitHub Desktop.
Galera Tutorial
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
| Also https://github.com/guriandoro/docker , same but dockerized. | |
| alias ll='ls -lha' | |
| alias ls='ls --color=auto' | |
| alias lxc-attach='lxc-attach -P $PWD' | |
| alias lxc-create='lxc-create -P $PWD' | |
| alias lxc-destroy='lxc-destroy -P $PWD' | |
| alias lxc-info='lxc-info -P $PWD' | |
| alias lxc-ls='lxc-ls --fancy -P $PWD' | |
| alias lxc-start='lxc-start -P $PWD -d' | |
| alias lxc-stop='lxc-stop -P $PWD' | |
| for i in {1..3} | |
| do { | |
| lxc-stop -n ema_pxc${i}; lxc-destroy -n ema_pxc${i}; lxc-create -t centos -n ema_pxc${i}; lxc-start -n ema_pxc${i}; | |
| } | |
| done ; | |
| root@bm-support01:/home/emanuel.calvo/tutorialGalera# cat /home/emanuel.calvo/tutorialGalera/ema_pxc[1-3]/tmp_root_pass | |
| Root-ema_pxc1-2qhXup | |
| Root-ema_pxc2-XlDQEq | |
| Root-ema_pxc3-La465V | |
| ytrewq1pppp | |
| yes | yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm | |
| yes | yum install http://epel.gtdinternet.com/6/i386/epel-release-6-8.noarch.rpm | |
| yes | yum -y install tar gdb strace vim qpress socat Percona-Server-server-56.x86_64 | |
| iptables -F | |
| setenforce 0; | |
| mysql_install_db; | |
| cat > /etc/my.cnf <<EOF | |
| [mysqld] | |
| datadir=/var/lib/mysql | |
| log-bin | |
| binlog_format=ROW | |
| server-id=1 | |
| log-slave-updates | |
| innodb_file_per_table | |
| innodb_buffer_pool_size=512M | |
| innodb_log_file_size=128M | |
| EOF | |
| chown -R mysql: /var/lib/mysql/ | |
| service mysql bootstrap (first node) | |
| service mysql start | |
| mysql -e "grant all privileges on *.* to 'root'@'10.0.3.%' identified by 'sekret';" | |
| mysql -e "grant all privileges on *.* to 'root'@'localhost' identified by 'sekret';" | |
| yes | yum remove Percona-Server-shared-56-5.6.33-rel79.0.el6.x86_64 Percona-Server-server-56-5.6.33-rel79.0.el6.x86_64 | |
| yes | yum install Percona-XtraDB-Cluster-server-56.x86_64 | |
| service mysql bootstrap | |
| cat > /etc/my.cnf <<EOF | |
| [mysql] | |
| port = 3306 | |
| socket = /var/lib/mysql/mysql.sock | |
| prompt='PXC: \u@\h (\d) > ' | |
| [client] | |
| port = 3306 | |
| socket = /var/lib/mysql/mysql.sock | |
| [mysqld] | |
| socket = /var/lib/mysql/mysql.sock | |
| datadir=/var/lib/mysql | |
| user=mysql | |
| wsrep_cluster_name=pxc_test | |
| wsrep_provider=/usr/lib64/libgalera_smm.so | |
| wsrep_provider_options = "gcs.fc_limit=500; gcs.fc_master_slave=YES; gcs.fc_factor=1.0; gcache.size=512M;" | |
| wsrep_slave_threads = 2 | |
| wsrep_auto_increment_control = ON | |
| wsrep_sst_method=xtrabackup-v2 | |
| wsrep_sst_auth=root:sekret | |
| wsrep_cluster_address=gcomm://10.0.3.245,10.0.3.143,10.0.3.5 | |
| wsrep_node_address=10.0.3.245 | |
| wsrep_node_name=percona1 | |
| innodb_locks_unsafe_for_binlog=1 | |
| innodb_autoinc_lock_mode=2 | |
| innodb_file_per_table=1 | |
| innodb-log-file-size = 256M | |
| innodb-flush-log-at-trx-commit = 2 | |
| innodb-buffer-pool-size = 512M | |
| innodb_use_native_aio = 0 | |
| server_id=1 | |
| binlog_format = ROW | |
| [sst] | |
| streamfmt=xbstream | |
| [xtrabackup] | |
| compress | |
| compact | |
| parallel=2 | |
| compress-threads=2 | |
| rebuild-threads=2 | |
| EOF | |
| root@bm-support01:/home/emanuel.calvo/tutorialGalera# lxc-ls | |
| NAME STATE IPV4 IPV6 AUTOSTART | |
| ---------------------------------------------- | |
| ema_pxc1 RUNNING 10.0.3.245 - NO | |
| ema_pxc2 RUNNING 10.0.3.143 - NO | |
| ema_pxc3 RUNNING 10.0.3.5 - NO | |
| service mysql start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment