mysql 迁移4

2022-03-21 18:40:36 浏览数 (1)

确认备份数据

在销毁slave和原master前,这是最后一次可以备份原库统计数据的机会

生产数据已经陈旧,不一致了

确认后可以进行下一步


备份新master以便重建

代码语言:javascript复制
[root@new-master nfs]# time nohup /usr/bin/innobackupex --defaults-file=/etc/my.cnf --user=root --password=xxxxxxxxxx /data/nfs/test_full_backup    >>  /data/nfs/full_backup.log 2>&1  &
[1] 80736
[root@new-master nfs]# 
[root@new-master nfs]# 
[root@new-master nfs]# tail -f full_backup.log 
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 3
xtrabackup:   innodb_log_file_size = 268435456
xtrabackup: using O_DIRECT
>> log scanned up to (4998975642548)
xtrabackup: Generating a list of tablespaces
>> log scanned up to (4998975644454)

销毁slave数据库

如果有足够空间,可以备到一个目录,没有则可以直接删

代码语言:javascript复制
[root@slave01 data]# /etc/init.d/mysql  stop 
Shutting down MySQL.............. SUCCESS! 
[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        slave01-slow.log          ib_logfile1  mobildb   mysql-bin.000157  testdb
slave01.err     stuff_on              ib_logfile2  mysql        mysql-bin.000158  keydb
[root@slave01 mysql]# rm -rf * 
[root@slave01 mysql]# ls
[root@slave01 mysql]# df -h 
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              16G  3.7G   12G  25% /
tmpfs                  16G     0   16G   0% /dev/shm
/dev/sda1             194M   66M  119M  36% /boot
/dev/sdb1             493G  1.3G  466G   1% /data
new-master:/data/nfs
                      1.7T  300G  1.4T  19% /data/nfs
[root@slave01 mysql]# 

如果有多个slave ,重复上面操作

0 人点赞