代码拉取完成,页面将自动刷新
---
# MySQL Conf
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-conf
namespace: mysql-test
data:
mysql-master.cnf: |
[mysqld]
skip-name-resolve
datadir = /var/lib/mysql
socket = /var/run/mysqld/mysqld.sock
secure-file-priv = /var/lib/mysql-files
pid-file = /var/run/mysqld/mysqld.pid
user = mysql
secure-file-priv = NULL
default_authentication_plugin = mysql_native_password
gtid_mode = on
enforce_gtid_consistency = on
server-id = 1
log-bin = master-bin
log_bin_index = master-bin.index
binlog_ignore_db = information_schema
binlog_ignore_db = performance_schema
binlog_ignore_db = sys
binlog-format = ROW
long_query_time = 0.1
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
lower_case_table_names = 1
default-time_zone = '+8:00'
mysql-slave.cnf: |
[mysqld]
skip-name-resolve
datadir = /var/lib/mysql
socket = /var/run/mysqld/mysqld.sock
secure-file-priv = /var/lib/mysql-files
pid-file = /var/run/mysqld/mysqld.pid
user = mysql
secure-file-priv = NULL
default_authentication_plugin = mysql_native_password
gtid_mode = on
enforce_gtid_consistency = on
slave-skip-errors = 1007
log-bin = slave-bin
relay-log = slave-relay-bin
relay-log-index = slave-relay-bin.index
binlog_ignore_db = information_schema
binlog_ignore_db = performance_schema
binlog_ignore_db = sys
long_query_time = 0.1
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
lower_case_table_names = 1
default-time_zone = '+8:00'
init-master.sql: |
CREATE USER 'repl'@'%' IDENTIFIED WITH mysql_native_password BY 'Mogujie@repl';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
flush privileges;
init-slave.sql: |
CHANGE MASTER TO MASTER_HOST='mysql-master-0.mysql-master', MASTER_USER='repl', MASTER_PASSWORD='Mogujie@repl', master_auto_position=1;
start slave;
reset-slave.sh: |
#!/bin/sh
# wait mysqld startup
until mysql -uroot -p$$MYSQL_ROOT_PASSWORD -e "SELECT 1"; do sleep 1; done
# reset slave
mysql -uroot -p$$MYSQL_ROOT_PASSWORD <<EOF
stop slave;
reset slave;
CHANGE MASTER TO MASTER_HOST='mysql-master-0.mysql-master', MASTER_USER='repl', MASTER_PASSWORD='Mogujie@repl', master_auto_position=1;
start slave;
EOF
check_slave_status.sh: |
#!/bin/sh
# wait mysqld startup
until mysql -uroot -p$$MYSQL_ROOT_PASSWORD -e "SELECT 1"; do sleep 1; done
# Check slave status
mysql -u root -p$MYSQL_ROOT_PASSWORD -e "SHOW SLAVE STATUS\G" | grep -q "Slave_IO_Running: Yes"
if [ $? -ne 0 ]; then
exit 1
fi
mysql -u root -p$MYSQL_ROOT_PASSWORD -e "SHOW SLAVE STATUS\G" | grep -q "Slave_SQL_Running: Yes"
if [ $? -ne 0 ]; then
exit 1
fi
mysql -u root -p$MYSQL_ROOT_PASSWORD -e "SHOW SLAVE STATUS\G" | grep -q "Seconds_Behind_Master: 0"
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。