# The following can be used as easy to replay backup logs or for replication. # note: if you are setting up a replication slave, see README.Debian about # other settings you may need to change. server-id = 1 # 节点ID log_bin = /var/log/mysql/mysql-bin.log # 日志 binlog_format = "ROW" # 日志格式 auto_increment_increment = 2 # 自增ID间隔(=节点数,防止ID冲突) auto_increment_offset = 1 # 自增ID起始值(节点ID) #binlog_do_db = include_database_name binlog_ignore_db = mysql # 不用于同步的数据库 binlog_ignore_db = information_schema # 同上 binlog_ignore_db = performance_schema # 同上 binlog_ignore_db = sys # 同上
重启mysql : service mysql restart 后进入MySQL:
1 2 3 4 5 6 7
mysql> show master status; +------------------+----------+--------------+-------------------------------------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+-------------------------------------------------+-------------------+ | mysql-bin.000001 | 154 | | mysql,information_schema,performance_schema,sys | | +------------------+----------+--------------+-------------------------------------------------+-------------------+ 1 row in set (0.00 sec)
#!/bin/bash counter=$(netstat -na|grep "LISTEN"|grep "3306"|wc -l) if [ "${counter}" -eq 0 ]; then /etc/init.d/keepalived stop fi ``
编写异常处理脚本,复制到两台机器 > vim /etc/keepalived/mail_notify.sh
```shell #!/bin/bash
contact1='yaoqijun@xs.ustb.edu.cn' contact2='wenyoupeng@xs.ustb.edu.cn' notify() { local mailsubject="$(hostname) to be $1, vip floating" local mailbody="$(date +'%F %T'): vrrp transition, $(hostname) changed to be $1" echo "$mailbody" | mail -s "$mailsubject" $contact1 echo "$mailbody" | mail -s "$mailsubject" $contact2 }
Comments
shortname
for Disqus. Please set it in_config.yml
.