Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Just a few questions that I just can't find anywhere about migrating to XtraDB.

My group has been using MyISAM dbs for production and was wondering how hard is it to migrate to Percona's XtraDB and how would you go about doing so?

Would I have to migrate MyISAM to InnoDB first or can I go straight to XtraDB?

I installed Percona Server with XtraDB package on my Fedora machine but the documentation isn't very helpful as to how to use it so I was wondering does Percona just piggyback on a standard MySQL installation or is it a separate entity?

Links to documentation on how to solve my questions would be fantastic.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

You could convert either before or after. I prefer before because the data will be ready once Percona Server is installed, up and running. I say this because there are some hairy things you have to address with regards to the grant tables. (This especially includes the mysql.user table since MySQL 5.0's mysql.user tables has 37 columns while MySQL 5.5's mysql.user tables has 42 columns) I would not want to mess with connectivity or SQL Grants issues first.

Here is is the script to perform the InnoDB conversion:

Step 01) Run these commands

echo "SET SQL_LOG_BIN = 0;" > /root/ConvertMyISAMToInnoDB.sql
MYSQL_CONN="-u... -p..."
mysql ${MYSQL_CONN} -AN -e"SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' ENGINE=InnoDB;') InnoDBConversionSQL FROM information_schema.tables WHERE engine='MyISAM' AND table_schema NOT IN ('information_schema','mysql','performance_schema') ORDER BY (data_length+index_length)" > /root/ConvertMyISAMToInnoDB.sql

The script looks for all tables in all databases can converts them in size order starting with the smallest.

Step 02) Run the script

mysql ${MYSQL_CONN} -A < /root/ConvertMyISAMToInnoDB.sql

Step 03) Run this query

SELECT SUM(data_length+index_length)/POWER(1024,2) RecommendedInnoDBBufferPoolSize
FROM information_schema.tables WHERE engine='InnoDB';

This will give you the suggested (ideal, perfect world) value for innodb_buffer_pool_size. If this number exceeds75% of server RAM, then use 75% of RAM.

Step 04) service mysql stop

Step 05) rm -f /var/lib/mysql/ib_logfile* /var/lib/mysql/ibdata1

Step 06) Add the following to /etc/my.cnf

[mysqld]
innodb_file_per_table
innodb_buffer_pool_size=<SizeFromStep03>M
innodb_log_file_size=512M
innodb_log_buffer_size=64M
innodb_open_files=4096
innodb_read_io_threads=64
innodb_write_io_threads=64
innodb_io_capacity=5000
key_buffer_size=8M

CAVEATS

  • innodb_log_file_size should be 25% of innodb_buffer_pool_size
  • key_buffer_size can now be scaled back

Step 07) service mysql start

This will take awhile (2-4 min) because mysqld will creates

  • ib_logfile0
  • format it
  • create ib_logfile1
  • format it.

Step 08) Perform Percona Upgrade

share|improve this answer
    
I removed the link-only style answer and replaced it with real material –  RolandoMySQLDBA Sep 15 '12 at 20:29
    
Awesome! Thanks for the detailed answer! –  Wringley Sep 17 '12 at 17:33
    
Had a question about innoDB, if I were to use the innoDB engine with Percona would I still have to get a license from Oracle? Just wondering if you know the answer, if not then thats fine. –  Wringley Sep 17 '12 at 18:17
    
No you would not need a license because Percona Server is GPL. It's open source. –  RolandoMySQLDBA Sep 17 '12 at 18:21
    
awesome thanks again! –  Wringley Sep 17 '12 at 19:32
add comment

XtraDB is a drop-in replacement for InnoDB. Existing MyISAM tables are unaffected. To actually gain any benefit from XtraDB, you will have to convert them to InnoDB. You can do this either before or after you install XtraDB.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.