mysql主从调参数

  sre

ryWUZd.jpg

MYSQL_ROOTPWD='2222222222222222222222222'
mysql -N -h mysql.host -uroot -P23306 -p"MYSQL_ROOTPWD" <<EOF
set global sync_binlog=1;
set global innodb_flush_log_at_trx_commit=1;
set global master_info_repository='table';
set global relay_log_info_repository='table';
show global variables like 'sync_binlog';
show global variables like 'innodb_flush_log_at_trx_commit';
show global variables like 'master_info_repository';
show global variables like 'relay_log_info_repository';
EOF

cp -arf /data/mysql/23306/run/23306.cnf /data/mysql/23306/run/23306.cnf_(date +%Y%m%d%H%M%S)
sed -i "s#sync_binlog         = 0#sync_binlog         = 1#g" /data/mysql/23306/run/23306.cnf
sed -i "s#innodb_flush_log_at_trx_commit  = 2#innodb_flush_log_at_trx_commit  = 1#g" /data/mysql/23306/run/23306.cnf
sed -i '/sync_binlog/arelay_log_info_repository = table' /data/mysql/23306/run/23306.cnf
sed -i '/sync_binlog/amaster_info_repository = table' /data/mysql/23306/run/23306.cnf
yum install -y dos2unix
dos2unix /data/mysql/23306/run/23306.cnf
mv /etc/my.cnf /etc/my.cnf_$(date +%Y%m%d%H%M%S)
cp -arf /data/mysql/23306/run/23306.cnf /etc/my.cnf

LEAVE A COMMENT

Captcha Code