Added galera
This commit is contained in:
parent
b69e0082af
commit
ab72d8074c
24
Galera/LB.conf
Normal file
24
Galera/LB.conf
Normal file
@ -0,0 +1,24 @@
|
||||
stream {
|
||||
|
||||
# Define all gluster nodes
|
||||
upstream gluster_nodes {
|
||||
# least_conn;
|
||||
hash $remote_addr consistent;
|
||||
server <GALERA_NODE>:3306; # fail_timeout=5s
|
||||
server <GALERA_NODE>:3306; # fail_timeout=5s
|
||||
server <GALERA_NODE>:3306; # fail_timeout=5s
|
||||
server <GALERA_NODE>:3306; # fail_timeout=5s
|
||||
}
|
||||
|
||||
# TCP traffic to gluster nodes
|
||||
server {
|
||||
listen 3306;
|
||||
proxy_pass gluster_nodes;
|
||||
proxy_bind <LB_IP> transparent;
|
||||
# proxy_bind $remote_addr transparent;
|
||||
# proxy_protocol on;
|
||||
# set_real_ip_from $proxy_protocol_addr;
|
||||
}
|
||||
|
||||
|
||||
}
|
20
Galera/README
Normal file
20
Galera/README
Normal file
@ -0,0 +1,20 @@
|
||||
user for running script:
|
||||
keepaliveddd
|
||||
|
||||
|
||||
sudo adduser keepaliveddd
|
||||
|
||||
<SOME_SUPER_SECURE_PASSWORD>
|
||||
|
||||
#Galera nodes
|
||||
'''
|
||||
sudo apt install galera-4 mariadb-server
|
||||
'''
|
||||
|
||||
#Load balancers
|
||||
'''
|
||||
sudo apt install keepalived nginx
|
||||
'''
|
||||
|
||||
|
||||
Of course change what needs to be changed in config files.
|
11
Galera/chck_nginx.sh
Normal file
11
Galera/chck_nginx.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
check=$(pidof nginx)
|
||||
|
||||
if [ -z $check ]; then
|
||||
exit 1
|
||||
|
||||
else :
|
||||
exit 0
|
||||
|
||||
fi
|
36
Galera/keepalived/GLUSTER-LB-NODE-1.conf
Normal file
36
Galera/keepalived/GLUSTER-LB-NODE-1.conf
Normal file
@ -0,0 +1,36 @@
|
||||
global_defs {
|
||||
enable_script_security
|
||||
script_user keepaliveddd
|
||||
}
|
||||
|
||||
vrrp_script track_nginx {
|
||||
script "/etc/keepalived/chck_nginx.sh"
|
||||
interval 10
|
||||
}
|
||||
|
||||
vrrp_instance GLUSTER-LB {
|
||||
state MASTER
|
||||
interface eth1
|
||||
virtual_router_id 30
|
||||
priority 100
|
||||
advert_int 1
|
||||
|
||||
unicast_src_ip <MASTER_NODE_IP>
|
||||
unicast_peer {
|
||||
<BACKUP_NODE_IP>
|
||||
}
|
||||
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass <CHANGE_TO_8-CHARACTER_PASSWORD>
|
||||
}
|
||||
|
||||
track_script {
|
||||
track_nginx
|
||||
}
|
||||
|
||||
virtual_ipaddress {
|
||||
<VIP>/<MASK> dev <DMZ_NIC>
|
||||
}
|
||||
|
||||
}
|
38
Galera/keepalived/GLUSTER-LB-NODE-2.conf
Normal file
38
Galera/keepalived/GLUSTER-LB-NODE-2.conf
Normal file
@ -0,0 +1,38 @@
|
||||
global_defs {
|
||||
enable_script_security
|
||||
script_user keepaliveddd
|
||||
}
|
||||
|
||||
vrrp_script track_nginx {
|
||||
script "/etc/keepalived/chck_nginx.sh"
|
||||
interval 10
|
||||
}
|
||||
|
||||
vrrp_instance GLUSTER-LB {
|
||||
state BACKUP
|
||||
interface <KAD_NET>
|
||||
virtual_router_id 10
|
||||
priority 95
|
||||
advert_int 1
|
||||
|
||||
unicast_src_ip <NODE_IP>
|
||||
unicast_peer {
|
||||
<BACKUP_NODE_IP>
|
||||
}
|
||||
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass <CHANGE_TO_8-CHARACTER_PASSWORD>
|
||||
}
|
||||
|
||||
|
||||
track_script {
|
||||
track_nginx
|
||||
}
|
||||
|
||||
virtual_ipaddress {
|
||||
<VIP>/<MASK> dev <DMZ_NIC>
|
||||
}
|
||||
|
||||
}
|
||||
|
36
Galera/keepalived/GLUSTER-LB-NODE-3.conf
Normal file
36
Galera/keepalived/GLUSTER-LB-NODE-3.conf
Normal file
@ -0,0 +1,36 @@
|
||||
global_defs {
|
||||
enable_script_security
|
||||
script_user keepaliveddd
|
||||
}
|
||||
|
||||
vrrp_script track_nginx {
|
||||
script "/etc/keepalived/chck_nginx.sh"
|
||||
interval 10
|
||||
}
|
||||
|
||||
vrrp_instance GLUSTER-LB {
|
||||
state BACKUP
|
||||
interface <KAD_NET>
|
||||
virtual_router_id 10
|
||||
priority 90
|
||||
advert_int 1
|
||||
|
||||
unicast_src_ip <NODE_IP>
|
||||
unicast_peer {
|
||||
<BACKUP_NODE_IP>
|
||||
}
|
||||
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass <CHANGE_TO_8-CHARACTER_PASSWORD>
|
||||
}
|
||||
|
||||
track_script {
|
||||
track_nginx
|
||||
}
|
||||
|
||||
virtual_ipaddress {
|
||||
<VIP>/<MASK> dev <DMZ_NIC>
|
||||
}
|
||||
|
||||
}
|
22
Galera/mariadb_conf/GLUSTER-NODE-1.cnf
Normal file
22
Galera/mariadb_conf/GLUSTER-NODE-1.cnf
Normal file
@ -0,0 +1,22 @@
|
||||
# vim /etc/mysql/conf.d/galera.cnf
|
||||
|
||||
[mysqld]
|
||||
binlog_format=ROW
|
||||
default-storage-engine=innodb
|
||||
innodb_autoinc_lock_mode=2
|
||||
bind-address=0.0.0.0
|
||||
|
||||
# Galera Provider Configuration
|
||||
wsrep_on=ON
|
||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
||||
|
||||
# Galera Cluster Configuration
|
||||
wsrep_cluster_name="GLUSTER-NPM"
|
||||
wsrep_cluster_address="gcomm://ADDRESSES,SEPARATED,WITH,COMA"
|
||||
|
||||
# Galera Synchronization Configuration
|
||||
wsrep_sst_method=rsync
|
||||
|
||||
# Galera Node Configuration
|
||||
wsrep_node_address="<THIS_NODE_IP>"
|
||||
wsrep_node_name="GLUSTER-NODE-1"
|
22
Galera/mariadb_conf/GLUSTER-NODE-2.cnf
Normal file
22
Galera/mariadb_conf/GLUSTER-NODE-2.cnf
Normal file
@ -0,0 +1,22 @@
|
||||
# vim /etc/mysql/conf.d/galera.cnf
|
||||
|
||||
[mysqld]
|
||||
binlog_format=ROW
|
||||
default-storage-engine=innodb
|
||||
innodb_autoinc_lock_mode=2
|
||||
bind-address=0.0.0.0
|
||||
|
||||
# Galera Provider Configuration
|
||||
wsrep_on=ON
|
||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
||||
|
||||
# Galera Cluster Configuration
|
||||
wsrep_cluster_name="GLUSTER-NPM"
|
||||
wsrep_cluster_address="gcomm://ADDRESSES,SEPARATED,WITH,COMA"
|
||||
|
||||
# Galera Synchronization Configuration
|
||||
wsrep_sst_method=rsync
|
||||
|
||||
# Galera Node Configuration
|
||||
wsrep_node_address="<THIS_NODE_IP>"
|
||||
wsrep_node_name="GLUSTER-NODE-2"
|
22
Galera/mariadb_conf/GLUSTER-NODE-3.cnf
Normal file
22
Galera/mariadb_conf/GLUSTER-NODE-3.cnf
Normal file
@ -0,0 +1,22 @@
|
||||
# vim /etc/mysql/conf.d/galera.cnf
|
||||
|
||||
[mysqld]
|
||||
binlog_format=ROW
|
||||
default-storage-engine=innodb
|
||||
innodb_autoinc_lock_mode=2
|
||||
bind-address=0.0.0.0
|
||||
|
||||
# Galera Provider Configuration
|
||||
wsrep_on=ON
|
||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
||||
|
||||
# Galera Cluster Configuration
|
||||
wsrep_cluster_name="GLUSTER-NPM"
|
||||
wsrep_cluster_address="gcomm://ADDRESSES,SEPARATED,WITH,COMA"
|
||||
|
||||
# Galera Synchronization Configuration
|
||||
wsrep_sst_method=rsync
|
||||
|
||||
# Galera Node Configuration
|
||||
wsrep_node_address="<THIS_NODE_IP>"
|
||||
wsrep_node_name="GLUSTER-NODE-3"
|
22
Galera/mariadb_conf/GLUSTER-NODE-4.cnf
Normal file
22
Galera/mariadb_conf/GLUSTER-NODE-4.cnf
Normal file
@ -0,0 +1,22 @@
|
||||
# vim /etc/mysql/conf.d/galera.cnf
|
||||
|
||||
[mysqld]
|
||||
binlog_format=ROW
|
||||
default-storage-engine=innodb
|
||||
innodb_autoinc_lock_mode=2
|
||||
bind-address=0.0.0.0
|
||||
|
||||
# Galera Provider Configuration
|
||||
wsrep_on=ON
|
||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
||||
|
||||
# Galera Cluster Configuration
|
||||
wsrep_cluster_name="GLUSTER-NPM"
|
||||
wsrep_cluster_address="gcomm://ADDRESSES,SEPARATED,WITH,COMA"
|
||||
|
||||
# Galera Synchronization Configuration
|
||||
wsrep_sst_method=rsync
|
||||
|
||||
# Galera Node Configuration
|
||||
wsrep_node_address="<THIS_NODE_IP>"
|
||||
wsrep_node_name="GLUSTER-NODE-4"
|
Loading…
x
Reference in New Issue
Block a user