RDS恢复数据到本地mysql(阿里云)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RDS恢复数据到本地mysql(阿里云)相关的知识,希望对你有一定的参考价值。
一、准备mysql环境
1.1、安装mysql依赖软件
[[email protected] src]# yum install -y gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool* cmake bison bison-devel* [[email protected] src]# wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz [[email protected] src]# wget [[email protected] src]# tar -zxvf cmake-2.8.8.tar.gz [[email protected] src]# cd cmake-2.8.8 [[email protected] cmake-2.8.8]# ./bootstrap [[email protected] cmake-2.8.8]# gmake && gmake install [[email protected] cmake-2.8.8]# cd ../ && tar -zxvf bison-2.5.tar.gz [[email protected] bison-2.5]# cd bison-2.5 [[email protected] bison-2.5]# ./configure [[email protected] bison-2.5]# make && make install
1.2、安装mysql
[[email protected] ~]# wget -O /usr/local/src [[email protected] ~]# cd /usr/local/src/ [[email protected] src]# tar –zxvf mysql-5.6.32.tar.gz [[email protected] src]# cd mysql-5.6.32 [[email protected] mysql-5.6.32]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql/ [[email protected] mysql-5.6.32]# make && make install [[email protected] mysql-5.6.32]# mkdir -p /data/mysql [[email protected] mysql-5.6.32]# chown -R mysql.mysql /data/mysql [[email protected] mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld [[email protected] mysql]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf [[email protected] mysql]# chmod +x /etc/init.d/mysqld [[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/ --basedir=/usr/local/mysql/
1.3、创建mysql用户及准备rds恢复数据
[[email protected] mysql-5.6.32]# useradd -u 49 -M -s/sbin/nologin mysql [[email protected] mysql-5.6.32]# wget -c ‘www.xxxxxxxx.com‘ -O /data/mysql-bak/mysqlbin.tar [[email protected] mysql-5.6.32]# tar -zxvf mysqlbin.tar
二、安装perconna
[[email protected] src]# wget http://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.2.10/binary/redhat/6/x86_64/Percona-XtraBackup-2.2.10-re623acb-el6-x86_64-bundle.tar [[email protected] src]# tar -xvf Percona-XtraBackup-2.2.10-re623acb-el6-x86_64-bundle.tar [[email protected] src]# yum -y install perlperl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL perl-ExtUtils-CBuilderperl-ExtU tils-MakeMaker libdigest-perl-md5-perl perl-Digest-MD5 [[email protected] src]# rpm -ivh percona-xtrabackup-2.2.10-1.el6.x86_64.rpm
三、恢复数据
[[email protected] src]# innobackupex --apply-log /data/mysql-bak/ [[email protected] src]# innobackupex --copy-back /data/mysql-bak/
最后恢复的结尾出现ok表示恢复成功,最后再重新赋予mysql主目录的属主就可以启动了
[[email protected] mysql-5.6.32]# chown -R mysql.mysql /data/mysql
本文出自 “初心、始终” 博客,请务必保留此出处http://gouyc.blog.51cto.com/1594451/1863561
以上是关于RDS恢复数据到本地mysql(阿里云)的主要内容,如果未能解决你的问题,请参考以下文章