-
Notifications
You must be signed in to change notification settings - Fork 0
/
swoosh.sh
52 lines (52 loc) · 1.92 KB
/
swoosh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#############################################
#-+-+-+ Percona XtraDB Installation & +-+-+-#
#+-+- Automation script - by histerix -+-+-+#
#############################################
apt update -y
apt install nano net-tools ufw -y
apt remove apparmor -y
wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
dpkg -i percona-release_latest.generic_all.deb
percona-release setup -y pxc-57
apt install percona-xtradb-cluster-full-57 -y
mv /etc/mysql/percona-xtradb-cluster.conf.d/wsrep.cnf /root/wsrep-cnf-backup.cnf
touch /etc/mysql/percona-xtradb-cluster.conf.d/wsrep.cnf
cat << EOF > /etc/mysql/percona-xtradb-cluster.conf.d/wsrep.cnf
[mysqld]
wsrep_provider=/usr/lib/galera3/libgalera_smm.so
#wsrep_cluster_address=gcomm:https://10.0.0.1,10.0.0.2,10.0.0.3
wsrep_cluster_address=gcomm:https://
binlog_format=ROW
default_storage_engine=InnoDB
wsrep_slave_threads=8
innodb_autoinc_lock_mode=2
pxc_strict_mode=ENFORCING
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth="sstuser:sstpassword"
wsrep_node_address=10.0.0.1
wsrep_node_name=node1
wsrep_cluster_name=pxc-cluster
EOF
ufw -y enable
ufw default deny incoming
ufw allow from your-ip-here to any port 22
ufw allow from 10.0.0.1 to any port 3306
ufw allow from 10.0.0.1 to any port 4444
ufw allow from 10.0.0.1 to any port 4567
ufw allow from 10.0.0.1 to any port 4568
ufw allow from 10.0.0.2 to any port 3306
ufw allow from 10.0.0.2 to any port 4444
ufw allow from 10.0.0.2 to any port 4567
ufw allow from 10.0.0.2 to any port 4568
ufw allow from 10.0.0.3 to any port 3306
ufw allow from 10.0.0.3 to any port 4444
ufw allow from 10.0.0.3 to any port 4567
ufw allow from 10.0.0.3 to any port 4568
ufw reload
###############################################
# On next 2 cluster nodes uncomment row 18, #
# adjust IP addresses, then comment row 19, #
# & change addresses & names on rows 27 & 28. #
# Add sstuser to DB before adding nodes 2&3! #
###############################################