Subversion Repositories ALCASAR

Rev

Rev 3294 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3294 Rev 3308
Line 7... Line 7...
7
# The script is designed to setup replication between ALCASAR instances.
7
# The script is designed to setup replication between ALCASAR instances.
8
 
8
 
9
# Constants
9
# Constants
10
readonly PASSWD_FILE="/root/ALCASAR-passwords.txt"
10
readonly PASSWD_FILE="/root/ALCASAR-passwords.txt"
11
readonly REPL_USER="replication"
11
readonly REPL_USER="replication"
12
readonly REPL_DB_USER="$REPL_USER"
12
readonly REPL_DB_USER="db_replication"
13
readonly REPL_PWD_LENGTH=16
13
readonly REPL_PWD_LENGTH=16
14
readonly REPL_DB_PWD_LENGTH=16
14
readonly REPL_DB_PWD_LENGTH=16
15
readonly DB_CONF=/etc/my.cnf.d/server.cnf
15
readonly DB_CONF=/etc/my.cnf.d/server.cnf
16
readonly DB_REPL_CONF=/etc/my.cnf.d/replication.cnf
16
readonly DB_REPL_CONF=/etc/my.cnf.d/replication.cnf
17
readonly EXPIRE_BINLOG_DAYS=31
17
readonly EXPIRE_BINLOG_DAYS=31
Line 73... Line 73...
73
 
73
 
74
# Enable binary logging
74
# Enable binary logging
75
echo "Enabling binary logging..."
75
echo "Enabling binary logging..."
76
echo -n "[mariadb]
76
echo -n "[mariadb]
77
log-bin
77
log-bin
78
server_id=$SRV_ID
-
 
79
report_host=$safe_hostname
78
report_host=$safe_hostname
80
log-basename=$safe_hostname
79
log-basename=$safe_hostname
81
binlog-format=mixed
80
binlog-format=mixed
82
expire_logs_days=$EXPIRE_BINLOG_DAYS
81
expire_logs_days=$EXPIRE_BINLOG_DAYS
83
master_retry_count=0
82
master_retry_count=0
Line 89... Line 88...
89
 
88
 
90
# Listen on localhost
89
# Listen on localhost
91
sed -i "s?^.*skip-networking.*?#skip-networking?" "$DB_CONF"
90
sed -i "s?^.*skip-networking.*?#skip-networking?" "$DB_CONF"
92
sed -i "s?^#bind-address.*?bind-address=127.0.0.1?" "$DB_CONF"
91
sed -i "s?^#bind-address.*?bind-address=127.0.0.1?" "$DB_CONF"
93
 
92
 
-
 
93
# Be sure to not have same server_id on members of replication architecture
-
 
94
sed -i "s?^server_id.*?server_id=$SVR_ID?g" "$DB_CONF"
-
 
95
 
94
# Apply binary logging
96
# Apply binary logging
95
echo "Restarting MariaDB..."
97
echo "Restarting MariaDB..."
96
/usr/bin/systemctl restart mariadb.service
98
/usr/bin/systemctl restart mariadb.service
97
 
99
 
98
# User for SSH tunneling
100
# User for SSH tunneling