前言 有了keepalived和mysql upgrade的技术作基础,可以结合两者完成无逢升级 下面分享一下我的 Best Practice Of Mysql Migration ---- 概要 --...-- 准备工作 下面步骤最好作为准备工作,提前完成,这样可以更有效进行切换,和减少窗口期 挂载NFS 安装软件包的收集(mysql,xtrabackup,keepalived) 安装keepalived
首先使用一项技术都是有目地的,使用MYSQL 的外部表主要有以下几个原因 1 存储空间不够,某个大表需要更大的存储空间 2 存储介质更新,部分表需要存放到更快的存储介质中 下面在看看到底怎么做,目前在...data 目录下挂载了mysql 的目录以及mysql_extend 两个目录,目前数据都在mysql目录下存放,我们需要将employees 库中的新建立的表都不在mysql 目录下 employees...在实际中的应用可能会存在这样一个实际情况,就是我们更换了SSD 磁盘 但怎么将表的物理文件安全的迁移到新的SSD 磁盘上。...我们继续往下看,举例我们要将emplyees 表迁移到SSD 磁盘环境,而SSD 的磁盘环境的对应的目录是 /data/mysql_extend 下 1 我们创建一个表空间,并指定到/data/mysql_extend...2 之间迁移数据到新的表空间 ? ? 上面两张图可以看到ibd 文件已经从原来的目录迁移到了新的位置,但FRM 文件还是保留在原来的目录。
这里不谈秒杀设计,不谈使用队列等使请求串行化,就谈下怎么用锁来保证数据正确,就是已经到减库存那一步了,在这一步中如果保证不超卖。...我们知道,mysql默认的事务隔离级别是 REPEATABLE-READ 关于事务隔离级别这块儿,可在公众号Java技术栈搜索阅读。
修改zabbix统计数据过期时间 [root@new-master mysql]# vim /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh...[root@new-master mysql]# grep 120 /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh if...[ `expr $TIMENOW - $TIMEFLM` -gt 120 ]; then [root@new-master mysql]# 修改之前是300,也就是5分钟,这个监控粒度太粗,所以改为...-4.013-3.el6.x86_64 has missing requires of libmysqlclient.so.16()(64bit) perl-DBD-MySQL-4.013-3.el6....x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit) php-mysql-5.3.3-40.el6_
新版master上安装并启动keepalived 安装并启动keepalived [root@new-master ~]# yum -y install ke...
要确保mysql 数据库的 datadir是清空的,否则会报错 [root@slave02 data]# cat restore.log nohup: ignoring input Warning:.../usr/bin/innobackupex version 2.3.2 based on MySQL server 5.6.24 Linux (x86_64) (revision id: 306a2e0...) Original data directory /var/lib/mysql is not empty!...) Original data directory /var/lib/mysql is not empty!...开头的文件 如: .bash_history .lesshst .mysql_history .viminfo 要指明删,如 rm -rf .bash_history .lesshst .mysql_history
myisam_recover_options [testuser@slave01 etc]$ innodb_additional_mem_pool_size 也已经被弃用了,如果有要注释掉 ---- 将zabbit加入mysql...组以方便监控 [root@new-master mysql]# vim /etc/group [root@new-master mysql]# id zabbix uid=496(zabbix) gid...=493(zabbix) groups=493(zabbix),492(mysql) [root@new-master mysql]# /etc/init.d/zabbix-agent restart...]# ---------- [root@zabbix-server ~]# zabbix_get -s new-master -p 10050 -k "mysql.slowlog[100,/var/lib.../mysql/new-master-slow.log]" 2.98465 [root@zabbix-server ~]#
innobackupex: Backup created in directory '/data/nfs/test_full_backup/2015-12-09_00-53-03' innobackupex: MySQL...binlog position: filename 'mysql-bin.000004', position 8299670 151209 02:06:09 innobackupex: Connection
]# chown -R mysql.mysql /var/lib/mysql/ [root@slave02 mysql]# ll total 5916780 drwx------ 2 mysql mysql...---- 2 mysql mysql 36864 Dec 9 03:57 mysqltestt_db drwx------ 2 mysql mysql 4096 Dec 9 03...drwx------ 2 mysql mysql 4096 Dec 9 02:52 ijavadb drwx------ 2 mysql mysql 12288 Dec 9...4096 Dec 9 02:45 mysql drwx------ 2 mysql mysql 4096 Dec 9 02:49 testdb drwx------ 2 mysql mysql...mysql mysql 20480 Dec 9 03:08 /data/mysql/ [root@slave02 mysql]#
[root@slave01 data]# cd /var/lib/mysql/ [root@slave01 mysql]# ls livedb slave01-relay-bin.000308...javadb ijavadb mysql-bin.000154 mysql-bin.000159 relay-log.info backup-my.cnf slave01-relay-bin....000309 ibdata1 wavedb mysql-bin.000155 mysql-bin.000160 functiondb mysqltest_his slave01...-relay-bin.index ib_logfile0 master.info mysql-bin.000156 mysql-bin.index test mysqltestt_db...ib_logfile2 mysql mysql-bin.000158 keydb [root@slave01 mysql]# rm -rf * [root@slave01 mysql
启动mysql并且开启同步 [root@slave02 mysql]# mysql -u root -p Enter password: Welcome to the MySQL monitor....Your MySQL connection id is 1 Server version: 5.6.27-75.0-log Percona Server (GPL), Release 75.0, Revision...mysql> show slave status\G Empty set (0.00 sec) mysql> CHANGE MASTER TO MASTER_HOST='192.168.66.100'...=8299670; Query OK, 0 rows affected, 2 warnings (0.01 sec) mysql> show slave status\G **************...hostname slave02 mysql>
/tmp/old /tmp/new id zabbix /etc/init.d/zabbix-agent restart zabbix_get -s new-master -p 10050 -k "mysql.slowlog...[100,/var/lib/mysql/new-master-slow.log]" vim /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh...grep 120 /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh yum install libev rpm -e xtrabackup...test_full_backup/2015-12-09_00-53-03/ >> restore.log 2>&1 & tail -f restore.log watch -n 2 du -sh /data/mysql.../ cat xtrabackup_binlog_pos_innodb chown -R mysql.mysql /var/lib/mysql/ 原文地址
更新slave mysql版本 [root@slave02 src]# rpm -e Percona-Server-client-51-5.1.73-rel14.11.603.rhel6.x86_64...rhel6.x86_64 Percona-Server-shared-51-5.1.73-rel14.11.603.rhel6.x86_64 error: Failed dependencies: mysql...-4.013-3.el6.x86_64 libmysqlclient.so.16()(64bit) is needed by (installed) php-mysql-5.3.3-40.el6_6....-4.013-3.el6.x86_64 libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) php-mysql...SONAME 'libfnv1a_udf.so'" mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'" mysql
启动mysql并且开启同步 [root@slave02 mysql]# mysql -u root -p Enter password: Welcome to the MySQL monitor....Your MySQL connection id is 1 Server version: 5.6.27-75.0-log Percona Server (GPL), Release 75.0, Revision...mysql> show slave status\G Empty set (0.00 sec) mysql> CHANGE MASTER TO MASTER_HOST='192.168.66.100'...[100,/var/lib/mysql/new-master-slow.log]" vim /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh.../ cat xtrabackup_binlog_pos_innodb chown -R mysql.mysql /var/lib/mysql/ 原文地址
目的是为了降低业务风险,和数据丢失的风险 通过监控历史数据可以确定这个时间窗口 ---- 关闭原集群mha 由于集群软件在侦测到主服务器失效后会干预相关资源,造成备机身份切换和IP飘移,为了避免这种影响,要关掉集群 [mysql...masterha_check_status --conf=/etc/app1.cnf app1 (pid:18911) is running(0:PING_OK), master:origin-master [mysql...[mysql@slave02 bin]$ masterha_check_status --conf=/etc/app1.cnf app1 is stopped(2:NOT_RUNNING)....[mysql@slave02 bin]$ ps faux | grep manager mysql 27192 0.0 0.0 103244 864 pts/2 S+ 00:23...0:00 \_ grep manager [mysql@slave02 bin]$ ---- 关闭原slave上keepalived
领取专属 10元无门槛券
手把手带您无忧上云