Drizzle to MySQL, Stress Free Migration

2,078 views
1,979 views

Published on

Talk at the 2011 MySQL Conference and Expo on Drizzle to MySQL migration

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,078
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Drizzle to MySQL, Stress Free Migration

  1. 1. MySQL to Drizzle, stress free migration Andrew Hutchings Software Developer Rackspace [email_address] Http://www.linuxjedi.co.uk/
  2. 2. What is Drizzle?
  3. 3. KDE3 -> 4 <ul><li>New Frameworks
  4. 4. Easier for Developers
  5. 5. Improved Usability </li></ul>
  6. 6. MySQL to Drizzle, stress free migration Picture by K Latham under a CC by NC SA 2.0 license
  7. 7. Installing
  8. 8. Installing in Ubuntu Natty: sudo apt-get install drizzle Lucid & Maverick: sudo apt-get install python-software-properties sudo apt-add-repository ppa:drizzle-developers/ppa sudo apt-get update sudo apt-get install drizzle (These instructions are also on http://docs.drizzle.org/ )
  9. 9. Installing on Fedora Create a /etc/yum.repos.d/drizzle.repo: [drizzle] name=drizzle baseurl=http://rpm.drizzle.org/7-dev/fedora/$releasever/$basearch/ enabled=1 gpgcheck=0 [drizzle-src] name=drizzle-src baseurl=http://rpm.drizzle.org/7-dev/fedora/$releasever/SRPMS enabled=1 Gpgcheck=0 Then: su -c “yum install drizzle7-server drizzle7-client” (These instructions are also on http://docs.drizzle.org/ )
  10. 10. Not Supported
  11. 11. Not Supported (yet) <ul><li>Stored Procedures
  12. 12. Triggers
  13. 13. Views
  14. 14. SET data type
  15. 15. Partitions </li></ul>
  16. 16. Not Supported (at all) <ul><li>MyISAM (as a main table)
  17. 17. Memory/Heap (as a main table)
  18. 18. FULLTEXT indexes
  19. 19. DELETE/UPDATE using multiple tables
  20. 20. Multiple timezones (only UTC)
  21. 21. Cartesian Joins </li></ul>
  22. 22. Protocol Picture by Derek Kaczmarczyk under a CC by 2.0 license
  23. 23. Protocol Existing Application libmysqlclient Drizzle New Application libdrizzle
  24. 24. Settings Picture by Travel Aficionado under a CC by NC 2.0 license
  25. 25. Settings <ul><li>Configuration can be multiple files
  26. 26. Just use --config-dir=/path/to/files
  27. 27. By default no configuration is needed </li></ul>
  28. 28. Settings Example config file 1: user=test max-heap-table-size=32M
  29. 29. Settings Example config file 2: innodb.buffer-pool-size=256M mysql-protocol.max-connection=2000
  30. 30. Settings Example config file 3: [innodb] buffer-pool-size=256M [mysql-protocol] max-connections=32
  31. 31. Authentication Auth_all Auth_file Auth_http Auth_ldap Auth_pam Auth plugin system
  32. 32. Replication Picture by Kristina Alexanderson under a CC by NC SA 2.0 license
  33. 33. MySQL Replication Slave Master Binary Log IO thread SQL thread Transaction InnoDB
  34. 34. Drizzle Replication Slave Master InnoDB Replication Reader Replication Applier Transaction
  35. 35. Drizzle Replication Start Master: $ drizzled --innodb.replication-log Slave config (slave.cfg): master-host=my_host master-port=3306 master-user=my_user master-password=my_password Start Slave: $ drizzled --plugin-add=slave --slave.config-file=/path/to/slave.cfg
  36. 36. Drizzle Replication Disabling replication for a database or table: drizzle> create table t2 (a int) replicate=FALSE; Query OK, 0 rows affected (0.087416 sec) drizzle> create database test2 replicate=FALSE; Query OK, 1 row affected (0.280803 sec)
  37. 37. Schemas – Removed Types <ul><li>TINY/SMALL/MEDIUM INT
  38. 38. TINY/MEDIUM/LONG BLOB/TEXT
  39. 39. YEAR
  40. 40. SET
  41. 41. CHAR/BINARY </li></ul>
  42. 42. Schemas – Changed Types Time In MySQL range is -839:59:59 to 838:59:59 In Drizzle range is 00:00:00 to 23:59:59
  43. 43. Schemas – Changed Types Date/Datetime First valid date in MySQL 0000-00-00 First valid date in Drizzle 0001-01-01
  44. 44. Schemas – Changed Types INT UNSIGNED UNSIGNED is only a constraint in Drizzle For extended values use BIGINT
  45. 45. Schemas – Changed Types INT(n) The braces are not used and ignored.
  46. 46. Schemas – New Types TIMESTAMP(6) TIMESTAMP(6) stores microseconds drizzle> select now(); +----------------------------+ | now() | +----------------------------+ | 2011-04-14 00:17:14.638962 | +----------------------------+ 1 row in set (0.000396 sec)
  47. 47. Schemas – New Types UUID Stores universally unique values drizzle> select * from t1; +------+--------------------------------------+ | a | b | +------+--------------------------------------+ | 1 | 22681f76-41fa-4245-8461-96dba0961675 | +------+--------------------------------------+ 1 row in set (0.000409 sec)
  48. 48. Schemas – New Types BOOLEAN Native BOOLEAN, stores in a single bit where engine supports it. drizzle> select * from t1; +------+------+ | a | b | +------+------+ | 1 | TRUE | +------+------+ 1 row in set (0.000408 sec)
  49. 49. Schemas - Strictness <ul><li>Erroneous ENUM actually errors
  50. 50. Divide by zero is an error
  51. 51. Not NULL actually means Not NULL </li></ul>
  52. 52. Character Sets Drizzle supports 2 character sets: UTF-8 and Binary
  53. 53. Information Schema Now follows the SQL standard Everything else is in DATA_DICTIONARY
  54. 54. Drizzledump Migration Picture by Gianluca Neri under a CC by NC ND 2.0 license
  55. 55. Drizzledump Migration History... August 2010 in Seattle, the Developers meeting
  56. 56. Drizzledump Migration Database Are you MySQL? Convert Data Output
  57. 57. Drizzledump Migration MySQL drizzledump Drizzle stdout
  58. 58. Drizzledump Migration <ul><li>MyISAM -> InnoDB
  59. 59. FullText Dropped
  60. 60. INT UNSIGNED -> BIGINT
  61. 61. TINY/SMALL/MEDIUM INT -> INT
  62. 62. TINY/MEDIUM/LONG BLOB -> BLOB
  63. 63. TINY/MEDIUM/LONG TEXT -> TEXT
  64. 64. YEAR -> INT
  65. 65. TIME -> INT </li></ul>
  66. 66. Drizzledump Migration <ul><li>ENUM has DEFAULT NULL and convert '' to NULL
  67. 67. DATE/DATETIME DEFAULT 0000-00-00 -> DEFAULT NULL
  68. 68. DATE/DATETIME NOT NULL -> NULL
  69. 69. DATE/DATETIME 0000-00-00 data -> NULL
  70. 70. SET -> TEXT </li></ul>
  71. 71. Drizzledump Migration $ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password > dumpfile.sql $ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password --destination-type=database --desination-host=drizzle-host
  72. 72. Drizzledump Migration Mysqldump: CREATE TABLE `t1` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` char(50) DEFAULT NULL, `c` datetime DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `t1` ( `a` INT NOT NULL AUTO_INCREMENT, `b` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL, `c` DATETIME DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE='InnoDB' AUTO_INCREMENT=1 COLLATE='utf8_general_ci'; Drizzledump:
  73. 73. Drizzledump Migration INSERT INTO `t1` VALUES (1,'Hello','0000-00-00 00:00:00'), (2,'World','2011-04-14 06:50:52'); INSERT INTO `t1` VALUES (1,'Hello',NULL), (2,'World','2011-04-14 06:50:52'); Mysqldump: Drizzledump:
  74. 74. My Data is Mangled! Picture by Remi under a CC by NC ND 2.0 license
  75. 75. My Data is Mangled! Whilst migrating... 'è' Became 'è'
  76. 76. My Data is Mangled! UTF8 Data PHP App MySQL Server UTF8 Table Drizzledump
  77. 77. My Data is Mangled! Solution? --my-data-is-mangled Drizzledump doesn't set MySQL connection character set.
  78. 78. Wordpress 3.1 Migration <ul><li>Drizzledump Migration
  79. 79. Change 0000-00-00 to 0001-01-01 in code </li></ul>Clint Byrum from Canonical is working on a plugin for this
  80. 80. The Future
  81. 81. Drizzledump From File MySQL Server mysqldump MySQL dump file Drizzledump? Drizzle Server Drizzle dump file
  82. 82. MySQL to Drizzle Replication Drizzle Server MySQL Server Binlog Reader Transaction Applier
  83. 83. Questions? Photo by Ντάνκαν under CC by NA SA 2.0 license
  84. 84. Drizzle Developer Day Friday 15 th April 9:30 – 16:00 Hilton Hotel (across the road) Coastal Ballroom

×