mysql to mariadband back again - percona...11 step 0: backup! step -1: check yoself •partition...

Post on 19-Sep-2020

0 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

MySQL to MariaDB and Back Again

benny Vasquez -- cPanel, Inc.Santa Clara, California | April 23th – 25th, 2018

2

hi, I'm benny.

3

right now

4

before cPanel

5

boring

6

boring

7

enough about me, though

Migrating your data safely

Migrating your data safelySTOP

10

Step 0: Backup!

11

Step 0: Backup!Step -1: Check yo self• Partition space is important

df ; df –I

Step 0.1: Full dumps of your database (scheme optional)• Use mysqldump

[root: ~]# mysqldump -u root -p mysql user > `date +%Y%m%d`.user_table_dump.sql[root: ~]# mysqldump -u root -p --all-databases --skip-lock-tables > `date +%Y%m%d`.alldb.sql

Step 0.2: backup of the folder(s) and configurations• Use cp, rsync, etc- cp -a /var/lib/mysql{,.back. `date +%Y%m%d`} ; cp -a /etc/my.cnf{,.back.`date +%Y%m%d`}

Step 0.3: full server backups• Wherever possible, hot-spare is your best bet.

The Environment(s)Let’s get on the same page

13

Env{1}

* CentOS 6.9

* Installed MySQL 5.5

* Installed Apache & PHP

* Added WordPress Site

The Environment(s)

Env{2}

* CentOS 6.9

* Installed cPanel & WHM

* installed w/MySQL 5.5

* Added WordPress Site

MySQL à MariaDBFo’ reals this time.

15

6 easy steps• Install the MariaDB repos

https://mariadb.com/kb/en/library/yum/• Stop MySQL and remove it

service mysqld stop; yum remove mysql-community-server• Install MariaDB with your package manager

yum install MariaDB-server MariaDB-client • Ensure MariaDB is running

service mysql startmysql -Vservice mysql status

• Run mysql_upgradeFinish the conversion

Things to keep in mind• Migrate to the same version

- MySQL 5.1 -> MariaDB 5.1- MySQL 5.5 -> MariaDB 5.5

- MySQL 5.6 -> MariaDB 10.0- MySQL 5.7 -> MariaDB 10.2

MySQL to MariaDB; Env{1} Great Success

Env{1}: Success

16

3 easy steps• Navigate to MySQL/MariaDB Upgrade• Acknowledge the warnings• Click continue

MySQL to MariaDB; Env{2} Great Success

Env{2}: Success

MariaDB à MySQL under 5.6Easy peasy

18

6 easy steps• Stop MariaDB

service mysql stop • Remove MariaDB and its repos

yum remove MariaDB-server MariaDB-client • Install MySQL• Ensure MySQL is running• mysql_upgrade

Things to keep in mind• Migrate to the same version

- MariaDB 5.1 -> MySQL 5.1- MariaDB 5.5 -> MySQL 5.5

MariaDB to MySQL, when < 5.6 Env{1} Great Success

Env{1}: Success

19

2 easy steps• Manually adjust the mysql-version in /var/cpanel/cpanel.config

[root: ~]# grep mysql-version /var/cpanel/cpanel.configmysql-version=5.5

• Tell cPanel to check the installed RPMs and fix any problems it encounters/scripts/check_cpanel_rpms targets=MySQL55,MySQL56,MySQL57,MariaDB100 --fix

Env{2}: Success

MariaDB to MySQL, when < 5.6 Env{2} Great Success

MariaDB à MySQL over 5.6ugh

21

7 easy steps• DUMP. YOUR. DATABASES. And privileges.• Stop MariaDB

service mysql stop • Remove your databases

cp -a /var/lib/mysql{,.bak}; rm -rf /var/lib/mysql; chown mysql. /var/lib/mysql• Remove MariaDB and its repos

yum remove MariaDB-server MariaDB-client • Install MySQL

- Grab the community repo, and then yum install ithttps://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/linux-installation-yum-repo.html

• Ensure MySQL is runningservice mysql status

• Restore your databases- If you’ve done good, beer.

Warning: swapping in place WILL corrupt your databases

MariaDB to MySQL, when ≥ 5.6 Env{1} eh Success

Env{1}: Success?

22

6 easy steps• DUMP. YOUR. DATABASES. And privileges.• Remove your database files

cp -a /var/lib/mysql{,.bak}; rm -rf /var/lib/mysql; chown mysql. /var/lib/mysql

• Manually adjust the mysql-version in /var/cpanel/cpanel.config[root: ~]# grep mysql-version /var/cpanel/cpanel.config

mysql-version=5.7

• Tell cPanel to check the installed RPMs and fix any problems it encounters/scripts/check_cpanel_rpms –fix

• Ensure MySQL is runningservice mysql status

• Restore your databases- Also earns beer.

Warning: ”downgrading” in place WILL corrupt your databases, and WILL increase headaches.

MariaDB to MySQL, when ≥ 5.6 Env{2} eh Success

Env{2}: Success?

Conclusions and take-awaysugh

24

ugh.

• If you can, avoid changes after 5.7/10.2• Test, tinker, make notes• Be prepared for the suck, and maybe you’ll have over estimated.• Always reward yourself.

25

27

Rate My Session

top related