SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
MySQL migration from latin1 to UTF-8
                    Meetup Viadeo / LeMUG.fr, Paris 16-11-2011




            Olivier DASINI – dasini.net/blog/
In this talk

Why migrate in UTF-8
Charset and collation ?
Obstacles faced
Solutions found, approved and tested
Rolling upgrade
Switchover
Reminder... (abstract for exhausted people)




                   Olivier DASINI - ©2011 – http://dasini.net/blog/   2
Me, myself & I
Olivier DASINI
  MySQL Expert at Viadeo
  ●
     http://fr.viadeo.com/fr/profile/olivier.dasini
  My technology watch blog on MySQL
  ●
     http://dasini.net/blog/
  Co-founder of the french society: MySQL User Group Francophone (LeMug.fr)
  ●
     http://lemug.fr

Book author (in french)
  Audit et optimisation – MySQL 5, Bonnes pratiques pour l’administrateur
  ●
    Eyrolles, ISBN-13: 978-2212126341

  MySQL 5 – Administration et optimisation
  ●
    ENI, ISBN-13: 978-2-7460-5516-2




                       Olivier DASINI - ©2011 – http://dasini.net/blog/       3
Migration UTF-8 mission



Main mission
  Convert the data to UTF-8
  ●
    Viadeo used in over 200 countries
  ●
    Including China, India, Russia, Middle East, ...




Secondaries missions
  Convert the tables to InnoDB
  ●
    Performances, Hot Backup, Operability,...
  Server tuning
  ●
    InnoDB tuning differ from MyISAM tuning




                            Olivier DASINI - ©2011 – http://dasini.net/blog/   4
Charset & collation 1/4
                      Charset
                        Can be defined as the encoding of an alphabet
                        39 different charset in MySQL 5.5
                        Latin1 (ISO/CEI 8859-1) is the default charset in MySQL
                        ●
                          « Almost » optimal for Western Europe
                        ●
                          1 character = 1 byte
                        utf8 is that we want (must) use
                        ●
                          « universal » charset
                        ●
                          1 character = 1, 2 ou 3 byte(s)



SHOW CHARACTER SET WHERE Charset='latin1';
+­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+
| Charset | Description          | Default collation | Maxlen |
+­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+
| latin1  | cp1252 West European | latin1_swedish_ci |      1 | 
+­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+


SHOW CHARACTER SET WHERE Charset='utf8';
+­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+
| Charset | Description   | Default collation | Maxlen |
+­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+
| utf8    | UTF­8 Unicode | utf8_general_ci   |      3 | 
+­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+

                        Olivier DASINI - ©2011 – http://dasini.net/blog/          5
Charset & collation 2/4
   Latin1 does not recognize all the characters


CREATE TABLE t_latin1 (
  nom varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci

CREATE TABLE t_utf8 (
  nom varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci


SELECT * FROM t_latin1;
+­­­­­­+
| nom  |
+­­­­­­+
| ??   |     Latin1 can't encode Mandarin
+­­­­­­+

SELECT * FROM t_utf8;
+­­­­­­­­+
| nom    |
+­­­­­­­­+
|  谢谢 |
+­­­­­­­­+

                          Olivier DASINI - ©2011 – http://dasini.net/blog/   6
Charset & collation 3/4
Collation
  Can be defined as the set of rules that compare and order the symbols of an alphabet .
  Used mainly in the sorts
  Related to a charset
  ●
    LATIN1 default collation is latin1_swedish_ci
  ●
    UTF-8 default collation is utf8_general_ci
  Beware of the differences in behavior and performances...




                          Olivier DASINI - ©2011 – http://dasini.net/blog/                 7
Charset & collation 4/4
   Collation is used mainly in the sorts


SELECT * FROM table ORDER BY col COLLATE latin1_xxxxx_ci;

SELECT * FROM c1;                                        ORDER BY c COLLATE latin1_swedish_ci;
+­­­­­­+                                                 +­­­­­­+
| c    |                                                 | c    |
+­­­­­­+                                                 +­­­­­­+
| û    |                                                 | û    | 
| u    |                                                 | u    | 
| ü    |                                                 | ù    | 
| ù    |                                                 | ü    | 
+­­­­­­+                                                 +­­­­­­+

ORDER BY c COLLATE latin1_german1_ci;                     ORDER BY c COLLATE latin1_german2_ci;
+­­­­­­+                                                  +­­­­­­+
| c    |                                                  | c    |
+­­­­­­+                                                  +­­­­­­+
| û    |                                                  | û    | 
| u    |                                                  | u    | 
| ü    |                                                  | ù    | 
| ù    |                                                  | ü    | 
+­­­­­­+                                                  +­­­­­­+


                          Olivier DASINI - ©2011 – http://dasini.net/blog/                        8
Method
  Convert the tables
    Charset : UTF-8
    Collation : utf8_swedish_ci
    Storage : InnoDB


  Very simple with MySQL
    A single command : ALTER TABLE
    Fingers in the nose !


ALTER TABLE ma_table ENGINE = INNODB, ALTER TABLE ma_table CHARSET 
= utf8 COLLATE utf8_swedish_ci




      Does it work ?


                             Olivier DASINI - ©2011 – http://dasini.net/blog/   9
The end ?


        Thank you for your attention !




             Olivier DASINI - ©2011 – http://dasini.net/blog/   10
Not so simple...

 Viadeo constraints
   Workload: a huge amount of data is managed (Nov. 2011)
   ●
     1 000 000 new members / month
   ●
       250 000 connections / day
   ●
       165 000 active discussiondans forum
   ●
        80 000 forum member / month
   ●
        18 000 articles shared / day
   ●
          1 250 events organized / week
   Minimize the downtime
   ●
     No connection = no income
   Nasty surprise
   ●
     Dirty data
   ●
     Legacy...


 MySQL constraints
  Maximum size of the index
  Characteristics related to the CHARSET & COLLATION
  => had suddenly became issues when migrating ...


                     Olivier DASINI - ©2011 – http://dasini.net/blog/   11
Mission: Impossible ?




              Olivier DASINI - ©2011 – http://dasini.net/blog/   12
Viadeo constraints

MySQL @ Viadeo (prod OLTP) : huge volume of data
  About thirty instances distributed on 5 « clusters » ie Master / Slaves replication
  2 TB of data (for MySQL)
  About 1000 tables                                   20% of the effort
  ●
     70% MyISAM                                          Required good MySQL skills
  5 billions rows                                        Scripting know-how
Minimize the downtime with MySQL replication
  => Rolling upgrade
  ●
    Slaves are migrated first
  ●
    Allowing testing and validate the process
  => Switchover
  ●
    A slave promoted to master
                                                                       80% of the effort
                                                                         Required good business skills
Data legacy                                                              Large consumer of time and energy
  for historical reasons, some data was not « clean »
  ●
     Thank you to the elders.................................................................................

  The application migration was carried out several months before
  => mix of latin1 et utf8 data in latin1 tables
  => Tedious hand cleaning
  => Performed with a good knowledge of code
  ●
    Thank you to the elders !
                                       Olivier DASINI - ©2011 – http://dasini.net/blog/                         13
80% of the effort




Required good business skills
Large consumer of time and energy
  3 weeks of labor
  The dark side of the force...




                      Olivier DASINI - ©2011 – http://dasini.net/blog/   14
Data legacy - Taille max des index
  Limited to 767 bytes for InnoDB (1000 bytes for MyISAM)
    Specified key was too long; max key length is 767 bytes
    Warning 1071 : for a not unique index
    ●
       MySQL index the 255 first characters
    ●
       KEY `idx_url` (`url`(255))
    ERROR 1071 (42000) : for an unique index
    ●
       Many ways to handle it.
    ●
       Highly dependent on the business logic.
    ●
       => Processed on a case by case basis.

ALTER TABLE _table CONVERT TO CHARACTER SET utf8;
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

CREATE TABLE _table (
  info varchar(256) NOT NULL,     256 x 3 = 768 > 767 ... the count is not good !
  PRIMARY KEY (info)
) ENGINE=InnoDB DEFAULT CHARSET=latin1


ALTER TABLE _table2 CONVERT TO CHARACTER SET utf8;
Query OK, 0 rows affected, 2 warnings (0.33 sec)
Records: 0  Duplicates: 0  Warnings: 2

CREATE TABLE _table2 (
  info varchar(256) NOT NULL,
  KEY info (info(255))          Add by        MySQL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
                          Olivier DASINI - ©2011 – http://dasini.net/blog/          15
Data legacy – Duplicate entry 1/3

Process
 Run tests on a sample data
 Understand the problem(s)
   ●
      ERROR 1062 (23000): Duplicate entry
   ●
      => Different charset = different behavior of the server

 Identify rows issues
 ●
   The problematic characters :
   ●
     Do not appear to cause problems or are sometimes invisible
 ●
   With SQL queries : easy but sometimes long, often very long

 Deal with the problem
 ●
   Understand the data
 ●
   Understand MySQL
 ●
   Difficult to automate => TEDIOUS




                         Olivier DASINI - ©2011 – http://dasini.net/blog/   16
Data legacy – Duplicate entry 2/3
  Weird characters in the data
   A0 / A020 / 20A0 / C2A0 / … at the end of some rows

                             Clean hand operation !




SELECT ID, hex(url) FROM _table WHERE  LEFT(reverse(Url),2) LIKE 
CONCAT(UNHEX('A0'),'%') ;


for col in postID;  do     
    for carac in A0 A020 20A0;  do
        mysql ­ugrantless ­uP4S5 ­B ­N ­e"SELECT ID FROM _table 
WHERE LEFT(reverse($col),2) LIKE CONCAT(UNHEX('$carac'),'%');"; 
    done;
done; 

                        Olivier DASINI - ©2011 – http://dasini.net/blog/   17
Data legacy – Duplicate entry 2/3

    ERROR 1062 (23000): Duplicate entry 'pykachu' for key 'surnom'
      ●
        While there are (apparently) no duplicates...




                                                                              ?
SELECT surnom... LIKE 'p_kachu';
+­­­­­­­­­+




                                                                              =
| surnom  |       Unique index
+­­­­­­­­­+
| pykachu |
| pÿkachu |
+­­­­­­­­­+




                                                                              ?
SELECT surnom... LIKE 'p_kachu';
+­­­­­­­­+
| surnom |       Unique index



                                                                              =
+­­­­­­­­+
| pykachu|
| pykachu |
+­­­­­­­­+


   Similar but different characters...
     Depends on the collation y = ÿ 
                              ² = 2 
                              ª = a 
                              ß = ss
                           Olivier DASINI - ©2011 – http://dasini.net/blog/       18
Charset & collation (again) 1/4
      2 different letters can be similar...



SELECT 'u' = 'ü' COLLATE utf8_general_ci;                    SELECT 'e' = 'ë' COLLATE utf8_general_ci;
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                       +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| 'u' = 'ü' COLLATE utf8_general_ci  |                       | 'e' = 'ë' COLLATE utf8_general_ci  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                       +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                                  1 |                       |                                  1 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                       +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+


SELECT 'u' = 'ü' COLLATE utf8_swedish_ci;                    SELECT 'e' = 'ë' COLLATE utf8_swedish_ci;
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                       +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| 'u' = 'ü' COLLATE utf8_swedish_ci  |                       | 'e' = 'ë' COLLATE utf8_swedish_ci  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                       +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                                  0 |                       |                                  1 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                       +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+


SELECT 'u' = 'ü' COLLATE utf8_bin;                           SELECT 'e' = 'ë' COLLATE utf8_bin;
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                              +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| 'u' = 'ü' COLLATE utf8_bin  |                              | 'e' = 'ë' COLLATE utf8_bin  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                              +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                           0 |                              |                           0 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                              +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+




                              Olivier DASINI - ©2011 – http://dasini.net/blog/                           19
Charset & collation (again) 2/4
      Behavior may differ between latin1_swedish_ci & utf8_swedish_ci




SELECT 'u' = 'ü' COLLATE latin1_swedish_ci;                      SELECT 'e' = 'ë' COLLATE latin1_swedish_ci;
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                           +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| 'u' = 'ü' COLLATE utf8_general_ci  |                           | 'e' = 'ë' COLLATE utf8_general_ci  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                           +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                                  0 |                           |                                  0 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                           +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+


SELECT 'u' = 'ü' COLLATE utf8_swedish_ci;                        SELECT 'e' = 'ë' COLLATE utf8_swedish_ci;
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                           +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| 'u' = 'ü' COLLATE utf8_swedish_ci  |                           | 'e' = 'ë' COLLATE utf8_swedish_ci  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                           +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                                  0 |                           |                                  1 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+                           +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+



      Identical behavior                                          Different behavior
      ●   u is different from ü                                   ●   e is different from ë in latin1_swedish_ci
                                                                  ●   e is identical to ë in utf8_swedish_ci




                                  Olivier DASINI - ©2011 – http://dasini.net/blog/                                 20
Charset & collation (again) 3/4
  Collation : pay attention to differences in performance


SELECT BENCHMARK(1000000000, (select 'u'='ü' collate utf8_bin));
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| BENCHMARK(1000000000, (select 'u'='ü' collate utf8_bin))  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                                                         0 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
1 row in set (20.62 sec)

SELECT BENCHMARK(1000000000, (select 'u'='ü' collate utf8_swedish_ci));
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| BENCHMARK(1000000000, (select 'u'='ü' collate utf8_swedish_ci))  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                                                                0 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
1 row in set (57.53 sec)

SELECT BENCHMARK(1000000000, (select 'u'='ü' collate utf8_general_ci));
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
| BENCHMARK(1000000000, (select 'u'='ü' collate utf8_general_ci))  |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
|                                                                0 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+
1 row in set (27.71 sec)
                         Olivier DASINI - ©2011 – http://dasini.net/blog/   21
Charset & collation (again) 4/4 – Illegal mix
  Collation : pay attention to collation mixes

CREATE TABLE City (
…
) DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci


CREATE TABLE Country (
…
) DEFAULT CHARSET=utf8                collate=utf8_general_ci




SELECT City.name FROM City JOIN Country  USING(name) ;

ERROR 1267 (HY000): Illegal mix of collations (utf8_swedish_ci,IMPLICIT) 
and (utf8_general_ci,IMPLICIT) for operation '='


SELECT City.name FROM City Ci JOIN Country Co ON Ci.name=Co.name COLLATE 
utf8_general_ci ;
                              Bypassing the problem


                          Olivier DASINI - ©2011 – http://dasini.net/blog/   22
20% of the effort




Required good MySQL skills
Scripting know-how
  3 days of labor
  Light side of the force




                      Olivier DASINI - ©2011 – http://dasini.net/blog/   23
Minimize the downtime – Rolling upgrade
Updated tested and validated on slaves




   White DB  : latin-1
   Orange DB : UTF-8



                      Olivier DASINI - ©2011 – http://dasini.net/blog/   24
Rolling upgrade 1/4
Optimize the duration of the migration
  Minimize disk I/O
  Maximize buffers utilization



Extract, Transform and Load (data)
  mysqldump
  ALTER TABLE
  mysqlimport
  REPAIR TABLE (MyISAM)

                                                                  Powered by bash !
Tuning server
  Setting buffers o their proper value
  Various optimization


MySQL replication
  Stop it before the migration process
  Start it after the migration process




                           Olivier DASINI - ©2011 – http://dasini.net/blog/           25
Rolling upgrade 2/4
   Optimize the duration of the migration
     Minimize disk I/O
     Maximize buffers utilization

Disable logs
SET SESSION SQL_LOG_BIN=0;
SET GLOBAL slow_query_log=0;
SET GLOBAL general_log=0; 

InnoDB tuning
                             Reduction disks I/O
SET GLOBAL innodb_flush_log_at_trx_commit = 0;
SET GLOBAL innodb_support_xa      = 0;
SET GLOBAL unique_checks=0; 
SET GLOBAL foreign_key_checks=0; 

MyISAM tuning                                               Buffer for sorting MyISAM indexes:
SET GLOBAL myisam_sort_buffer_size = N;                     REPAIR TABLE / CREATE INDEX / ALTER TABLE
SET GLOBAL bulk_insert_buffer_size = N;
                                                            Optimization : LOAD DATA INFILE
Server tuning
SET GLOBAL read_buffer_size = N;               Used for « full table scan »
Default DB charset & collation
ALTER DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_swedish_ci;
                              Olivier DASINI - ©2011 – http://dasini.net/blog/                     26
Rolling upgrade 3/4
     Extract, Transform and Load (data)
         mysqldump
         ALTER TABLE
         mysqlimport
         REPAIR TABLE (MyISAM)

Save the structure and the data in UTF8:
mysqldump ­­default­character­set=utf8 ­­hex­blob DB table1 table2 ­T /path/to/bck/
1m22.406s

Convert the tables in InnoDB, utf8, utf8_swedish_ci:
ALTER TABLE _table ENGINE=InnoDB, CONVERT TO CHARACTER SET utf8 COLLATE 
utf8_swedish_ci;
Query OK, 12193106 rows affected (31 min 14.77 sec)
Records: 12193106  Duplicates: 0  Warnings: 0
                                                                                    To do without the data !!!
Load the data in UTF8:
time mysql ­­default­character­set=utf8 DB < data.sql
real 26m4.613s
              VS
time mysqlimport ­­default­character­set=utf8 DB _table.txt
DB._table: Records: 12193106  Deleted: 0  Skipped: 0  Warnings: 0
real 13m40.607s
                           mysqlimport (load data infile) is the fastest

                                 Olivier DASINI - ©2011 – http://dasini.net/blog/                                27
Rolling upgrade 4/4
  Tuning server
      Setting buffers o their proper value
      Various optimization




Refactoring my.cnf + Tuning Server

default_storage_engine=InnoDB

# Charset & Collation                                 Limit bad surprises
character_set_server=utf8   
collation_server=utf8_swedish_ci

# Replication
Skip­slave­start

# Change hashing algorithm (REHASH passwords)
old_passwords=0
                          The old passwords hashing algorithm is not secure (< 4.1)
...
                          $ time ./poc XXxxXxxXXXxXxXXX
                          mysql crack POC (c) 2006 Philippe Vigier & www.sqlhack.com
                          password for footprint XXxxXxxXXXxXxXXX = '______'
                          real 38m47.400s

                               Olivier DASINI - ©2011 – http://dasini.net/blog/        28
Minimize the downtime - Switchover
Switchover for minimize the downtime
  A slave turn master
  The master become a slave




                        Olivier DASINI - ©2011 – http://dasini.net/blog/   29
Switchover – Pseudo code 1/3


/* the master should be in READ ONLY mode*/                           Does not work with the
$mA_cmd    = "SET GLOBAL read_only='ON';";                            SUPER privilege

$mA_cmd      = "FLUSH NO_WRITE_TO_BINLOG TABLES WITH READ LOCK;";


/*Retrieved old master binlog info*/
$mA_cmd    = "SHOW MASTER STATUS;";
                                   Allows the slave to stop at the exact position
$old_master_file = $row["File"];
$old_master_pos   = $row["Position"];


/* Kill the pending old master's connexions */
SELECT sleep(2);
SELECT ID, USER, HOST FROM information_schema.PROCESSLIST WHERE 
TIME > 2;
KILL CONNECTION  ...   Kill any remaining connections to the old master



                         Olivier DASINI - ©2011 – http://dasini.net/blog/                      30
Switchover – Pseudo code 2/3


/*For all the slaves*/

/*Wait for the slave up to date*/
$m[B|C]_cmd    = "SELECT master_pos_wait('$old_master_file', 
$old_master_pos);";      Gives back the hand when the slave is synchronized with the
                         master
/*Stop the replication*/
$m[B|C]_cmd    = "STOP SLAVE"; Stop the replication

/*Retrive new master binlog info*/
$mB_cmd    = "SHOW MASTER STATUS;";
                                                     On the promoted server.
                                                     Used to set the slaves on the new master
$new_master_file      = $row["File"];
$new_master_pos       = $row["Position"];




                         Olivier DASINI - ©2011 – http://dasini.net/blog/                       31
Switchover – Pseudo code 3/3

/*For all the new slaves*/

/*reset the old slave configuration*/
$mC_cmd    = "RESET SLAVE;"; Reset replication informations on all the other slaves

/*Configure the new master*/
$mC_cmd    = "CHANGE MASTER TO MASTER_HOST = '$new_master_host', 
MASTER_USER = '$new_master_user', MASTER_PASSWORD = 
'$new_master_pwd', MASTER_PORT=$new_master_port, 
MASTER_LOG_FILE='$new_master_file', 
MASTER_LOG_POS=$new_master_pos;";  Tell the slaves which is the new master


/*Start the replication*/
$mC_cmd    = "START SLAVE";                     Start replication on all the slaves

/*reset the replication info for the new master*/
$mB_cmd    = "RESET SLAVE";    New master cleanup



                          Olivier DASINI - ©2011 – http://dasini.net/blog/            32
Switchover - inspiration
   Audit et optimisation, MySQL 5 --- éditions Eyrolles (french book)
      Page 239
Soit A le serveur master, B le slave de A qui va être promu master et C un autre slave de A
   1/ Interdire les écritures sur A:
       SET GLOBAL read_only='ON'; verrouille en lecture seule
       FLUSH TABLES WITH READ LOCK; verrouille en lecture seule pour les autres comptes avec le droit
           SUPER
   2/ Sauvegarder le numéro du journal binaire et la position de A  :
       SHOW MASTER STATUS;
       paramètres  : File, Position
   3/ Laissez le serveur B & C rattraper leur retard au niveau de la réplication
       SELECT master_pos_wait('mysql-bin.xxxxxx',N);
       paramètres  : File & Position de A (point 2).
       La fonction rendra la main une fois l’esclave à jour
   3/ Une fois B à jour,
       assurez vous qu'il est configuré en master
           log binaire
           server-id unique
           Utilisateur de réplication
       exécutez SHOW MASTER STATUS;
           File & Position serviront à reconfigurer A et C.
   4/ Routez les clients sur B qui devient alors le serveur actif
   5/ Reconfigurer les serveurs A et C pour qu’ils soient esclave de B et qu’il reparte sur le bon fichier
       binaire et à la bonne position:
       STOP SLAVE;
       CHANGE MASTER TO MASTER_HOST='', MASTER_PORT=, MASTER_USER='', MASTER_PASSWORD='',
           MASTER_LOG_FILE = 'mysql-bin.xxxxxx', MASTER_LOG_POS = N;
       A doit être configurer comme un slave
       … la suite dans le livre :)
                                       Olivier DASINI - ©2011 – http://dasini.net/blog/                      33
Recap
Lessons learned from this painful experience
  Know you data
  ●
    Know and understand the business logic
  ●
    Respect the data
  ●
    => Check them before you store them (in an ideal world)
  ●
    => Otherwise you will pay sooner or later... (in the real world)
  Know MySQL
  ●
    The charset that I need, the collation that I chose
  ●
    Limits => RTFM
  ●
    Rolling upgrade
  ●
    Switchover
  Migrate the DB before migrating the application
  ●
    See point 1...
  Automate everything that can
  ●
    Scripting for ever




                           Olivier DASINI - ©2011 – http://dasini.net/blog/   34
Merci
The Viadeo team                                                           The speakers
 Anna                                                                       Stéphane Combaudon
 Christophe                                                                 Olivier Dasini
 Élodie                                                                     Cédric Peintre
 Lionel                                                                     Marc Thomas
 Lourdes
 Marie Anne                                                               You...
 Nicolas
 Pierre(s)
 Sabri et son équipe
 Sandy
 Séverine
 Stéphane
 Sylvain
 Yorick
 ...




                       Olivier DASINI - ©2011 – http://dasini.net/blog/                          35
Questions

 Where to find the slides of the meetup ?
   http://dasini.net/blog/presentations/




                          Olivier DASINI - ©2011 – http://dasini.net/blog/   36

Weitere ähnliche Inhalte

Was ist angesagt?

How to set up orchestrator to manage thousands of MySQL servers
How to set up orchestrator to manage thousands of MySQL serversHow to set up orchestrator to manage thousands of MySQL servers
How to set up orchestrator to manage thousands of MySQL serversSimon J Mudd
 
MariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB plc
 
MySQL Timeout Variables Explained
MySQL Timeout Variables Explained MySQL Timeout Variables Explained
MySQL Timeout Variables Explained Mydbops
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바NeoClova
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Mydbops
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용I Goo Lee
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compactionMIJIN AN
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxVinicius M Grippa
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insightsKirill Loifman
 
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundMasahiko Sawada
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBMydbops
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMario Beck
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxNeoClova
 
How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0Norvald Ryeng
 
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centersMariaDB plc
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLMorgan Tocker
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestI Goo Lee
 

Was ist angesagt? (20)

How to set up orchestrator to manage thousands of MySQL servers
How to set up orchestrator to manage thousands of MySQL serversHow to set up orchestrator to manage thousands of MySQL servers
How to set up orchestrator to manage thousands of MySQL servers
 
MariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and Optimization
 
MySQL Timeout Variables Explained
MySQL Timeout Variables Explained MySQL Timeout Variables Explained
MySQL Timeout Variables Explained
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
 
MySQL Shell for DBAs
MySQL Shell for DBAsMySQL Shell for DBAs
MySQL Shell for DBAs
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compaction
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptx
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insights
 
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparound
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptx
 
How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0
 
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centers
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
 

Andere mochten auch

Étude de cas : migration MySQL Latin 1 vers UTF-8
Étude de cas : migration MySQL Latin 1 vers UTF-8Étude de cas : migration MySQL Latin 1 vers UTF-8
Étude de cas : migration MySQL Latin 1 vers UTF-8Olivier DASINI
 
MHA : MySQL haute dispo, chez Viadeo par Olivier Dasini
MHA : MySQL haute dispo, chez Viadeo par Olivier DasiniMHA : MySQL haute dispo, chez Viadeo par Olivier Dasini
MHA : MySQL haute dispo, chez Viadeo par Olivier DasiniOlivier DASINI
 
Architectures haute disponibilité avec MySQL
Architectures haute disponibilité avec MySQLArchitectures haute disponibilité avec MySQL
Architectures haute disponibilité avec MySQLOlivier DASINI
 
MySQL Day Paris 2016 - MySQL as a Document Store
MySQL Day Paris 2016 - MySQL as a Document StoreMySQL Day Paris 2016 - MySQL as a Document Store
MySQL Day Paris 2016 - MySQL as a Document StoreOlivier DASINI
 
MySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeurs
MySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeursMySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeurs
MySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeursFrederic Descamps
 
Haute disponibilité my sql avec group réplication
Haute disponibilité my sql avec group réplicationHaute disponibilité my sql avec group réplication
Haute disponibilité my sql avec group réplicationFrederic Descamps
 
MySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise EditionMySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise EditionOlivier DASINI
 
MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMorgan Tocker
 
MySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMatt Lord
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterMySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterOlivier DASINI
 
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud ServiceMySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud ServiceOlivier DASINI
 
MySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The DolphinMySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The DolphinOlivier DASINI
 
Les nouveautés de MySQL 5.1
Les nouveautés de MySQL 5.1Les nouveautés de MySQL 5.1
Les nouveautés de MySQL 5.1Olivier DASINI
 
Mix ‘n’ Match Async and Group Replication for Advanced Replication Setups
Mix ‘n’ Match Async and Group Replication for Advanced Replication SetupsMix ‘n’ Match Async and Group Replication for Advanced Replication Setups
Mix ‘n’ Match Async and Group Replication for Advanced Replication SetupsPedro Gomes
 
Fine-tuning Group Replication for Performance
Fine-tuning Group Replication for PerformanceFine-tuning Group Replication for Performance
Fine-tuning Group Replication for PerformanceVitor Oliveira
 
Group Replication: A Journey to the Group Communication Core
Group Replication: A Journey to the Group Communication CoreGroup Replication: A Journey to the Group Communication Core
Group Replication: A Journey to the Group Communication CoreAlfranio Júnior
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Severalnines
 
Best practices for MySQL High Availability
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High AvailabilityColin Charles
 
Jeudis du Libre - MySQL InnoDB Cluster
Jeudis du Libre - MySQL InnoDB ClusterJeudis du Libre - MySQL InnoDB Cluster
Jeudis du Libre - MySQL InnoDB ClusterFrederic Descamps
 

Andere mochten auch (20)

Étude de cas : migration MySQL Latin 1 vers UTF-8
Étude de cas : migration MySQL Latin 1 vers UTF-8Étude de cas : migration MySQL Latin 1 vers UTF-8
Étude de cas : migration MySQL Latin 1 vers UTF-8
 
Optimisation de MySQL
Optimisation de MySQLOptimisation de MySQL
Optimisation de MySQL
 
MHA : MySQL haute dispo, chez Viadeo par Olivier Dasini
MHA : MySQL haute dispo, chez Viadeo par Olivier DasiniMHA : MySQL haute dispo, chez Viadeo par Olivier Dasini
MHA : MySQL haute dispo, chez Viadeo par Olivier Dasini
 
Architectures haute disponibilité avec MySQL
Architectures haute disponibilité avec MySQLArchitectures haute disponibilité avec MySQL
Architectures haute disponibilité avec MySQL
 
MySQL Day Paris 2016 - MySQL as a Document Store
MySQL Day Paris 2016 - MySQL as a Document StoreMySQL Day Paris 2016 - MySQL as a Document Store
MySQL Day Paris 2016 - MySQL as a Document Store
 
MySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeurs
MySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeursMySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeurs
MySQL 5.7 & JSON - Nouvelles opportunités pour les dévelopeurs
 
Haute disponibilité my sql avec group réplication
Haute disponibilité my sql avec group réplicationHaute disponibilité my sql avec group réplication
Haute disponibilité my sql avec group réplication
 
MySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise EditionMySQL Day Paris 2016 - MySQL Enterprise Edition
MySQL Day Paris 2016 - MySQL Enterprise Edition
 
MySQL Cloud Service Deep Dive
MySQL Cloud Service Deep DiveMySQL Cloud Service Deep Dive
MySQL Cloud Service Deep Dive
 
MySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB Clusters
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterMySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
 
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud ServiceMySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
 
MySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The DolphinMySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The Dolphin
 
Les nouveautés de MySQL 5.1
Les nouveautés de MySQL 5.1Les nouveautés de MySQL 5.1
Les nouveautés de MySQL 5.1
 
Mix ‘n’ Match Async and Group Replication for Advanced Replication Setups
Mix ‘n’ Match Async and Group Replication for Advanced Replication SetupsMix ‘n’ Match Async and Group Replication for Advanced Replication Setups
Mix ‘n’ Match Async and Group Replication for Advanced Replication Setups
 
Fine-tuning Group Replication for Performance
Fine-tuning Group Replication for PerformanceFine-tuning Group Replication for Performance
Fine-tuning Group Replication for Performance
 
Group Replication: A Journey to the Group Communication Core
Group Replication: A Journey to the Group Communication CoreGroup Replication: A Journey to the Group Communication Core
Group Replication: A Journey to the Group Communication Core
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
 
Best practices for MySQL High Availability
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High Availability
 
Jeudis du Libre - MySQL InnoDB Cluster
Jeudis du Libre - MySQL InnoDB ClusterJeudis du Libre - MySQL InnoDB Cluster
Jeudis du Libre - MySQL InnoDB Cluster
 

Ähnlich wie Case Study: MySQL migration from latin1 to UTF-8

My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2Morgan Tocker
 
MySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features SummaryMySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features SummaryOlivier DASINI
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupSaewoong Lee
 
Dave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceDave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceNagios
 
Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Ivan Ma
 
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 20197 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019Dave Stokes
 
Oracle Exadata Cloud Services guide from practical experience - OOW19
Oracle Exadata Cloud Services guide from practical experience - OOW19Oracle Exadata Cloud Services guide from practical experience - OOW19
Oracle Exadata Cloud Services guide from practical experience - OOW19Nelson Calero
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007eLiberatica
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightDataStax Academy
 
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_SummaryHiram Fleitas León
 
Objects? No thanks!
Objects? No thanks!Objects? No thanks!
Objects? No thanks!corehard_by
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019Dave Stokes
 
Php johannesburg meetup - talk 2014 - scaling php in the enterprise
Php johannesburg   meetup - talk 2014 - scaling php in the enterprisePhp johannesburg   meetup - talk 2014 - scaling php in the enterprise
Php johannesburg meetup - talk 2014 - scaling php in the enterpriseSarel van der Walt
 
MySQL 8.0 & Unicode: Why, what & how
MySQL 8.0 & Unicode: Why, what & howMySQL 8.0 & Unicode: Why, what & how
MySQL 8.0 & Unicode: Why, what & howBernt Marius Johnsen
 
Magento performances 2015 best practices
Magento performances 2015 best practicesMagento performances 2015 best practices
Magento performances 2015 best practicesNBS System
 
TiDB DevCon 2020 Opening Keynote
TiDB DevCon 2020 Opening Keynote TiDB DevCon 2020 Opening Keynote
TiDB DevCon 2020 Opening Keynote PingCAP
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)Dave Stokes
 
What is MariaDB Server 10.3?
What is MariaDB Server 10.3?What is MariaDB Server 10.3?
What is MariaDB Server 10.3?Colin Charles
 

Ähnlich wie Case Study: MySQL migration from latin1 to UTF-8 (20)

Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2
 
MySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features SummaryMySQL 8.0.22 - New Features Summary
MySQL 8.0.22 - New Features Summary
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backup
 
Dave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceDave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical Experience
 
Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Exploring mysql cluster 7.4
Exploring mysql cluster 7.4
 
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 20197 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
 
Oracle Exadata Cloud Services guide from practical experience - OOW19
Oracle Exadata Cloud Services guide from practical experience - OOW19Oracle Exadata Cloud Services guide from practical experience - OOW19
Oracle Exadata Cloud Services guide from practical experience - OOW19
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
 
Macy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-FlightMacy's: Changing Engines in Mid-Flight
Macy's: Changing Engines in Mid-Flight
 
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
[DBA]_HiramFleitas_SQL_PASS_Summit_2017_Summary
 
Objects? No thanks!
Objects? No thanks!Objects? No thanks!
Objects? No thanks!
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
Php johannesburg meetup - talk 2014 - scaling php in the enterprise
Php johannesburg   meetup - talk 2014 - scaling php in the enterprisePhp johannesburg   meetup - talk 2014 - scaling php in the enterprise
Php johannesburg meetup - talk 2014 - scaling php in the enterprise
 
MySQL 8.0 & Unicode: Why, what & how
MySQL 8.0 & Unicode: Why, what & howMySQL 8.0 & Unicode: Why, what & how
MySQL 8.0 & Unicode: Why, what & how
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
Magento performances 2015 best practices
Magento performances 2015 best practicesMagento performances 2015 best practices
Magento performances 2015 best practices
 
TiDB DevCon 2020 Opening Keynote
TiDB DevCon 2020 Opening Keynote TiDB DevCon 2020 Opening Keynote
TiDB DevCon 2020 Opening Keynote
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 
What is MariaDB Server 10.3?
What is MariaDB Server 10.3?What is MariaDB Server 10.3?
What is MariaDB Server 10.3?
 

Mehr von Olivier DASINI

MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...Olivier DASINI
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsOlivier DASINI
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best PracticesOlivier DASINI
 
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL TeamMySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL TeamOlivier DASINI
 
MySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features SummaryMySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features SummaryOlivier DASINI
 
MySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features SummaryMySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features SummaryOlivier DASINI
 
MySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features SummaryMySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features SummaryOlivier DASINI
 
MySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryMySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryOlivier DASINI
 
MySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features SummaryMySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features SummaryOlivier DASINI
 
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the DolphinMySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the DolphinOlivier DASINI
 
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirementsMySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirementsOlivier DASINI
 
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...Olivier DASINI
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreOlivier DASINI
 
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?Olivier DASINI
 
MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018Olivier DASINI
 
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...Olivier DASINI
 
MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?Olivier DASINI
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...Olivier DASINI
 
MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)Olivier DASINI
 

Mehr von Olivier DASINI (20)

MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern Applications
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best Practices
 
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL TeamMySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
MySQL Database Service - 100% Developed, Managed and Supported by the MySQL Team
 
MySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features SummaryMySQL 8.0.21 - New Features Summary
MySQL 8.0.21 - New Features Summary
 
MySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features SummaryMySQL 8.0.19 - New Features Summary
MySQL 8.0.19 - New Features Summary
 
MySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features SummaryMySQL 8.0.18 - New Features Summary
MySQL 8.0.18 - New Features Summary
 
MySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryMySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features Summary
 
MySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features SummaryMySQL 8.0.16 New Features Summary
MySQL 8.0.16 New Features Summary
 
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the DolphinMySQL Day Paris 2018 - Introduction & The State of the Dolphin
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
 
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirementsMySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
MySQL Day Paris 2018 - MySQL & GDPR; Privacy and Security requirements
 
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0
 
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
 
MySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document StoreMySQL Day Paris 2018 - MySQL JSON Document Store
MySQL Day Paris 2018 - MySQL JSON Document Store
 
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
MySQL Day Paris 2018 - What’s New in MySQL 8.0 ?
 
MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018MySQL 8.0, what's new ? - Forum PHP 2018
MySQL 8.0, what's new ? - Forum PHP 2018
 
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
 
MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?MySQL 8.0 - What's New ?
MySQL 8.0 - What's New ?
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
 
MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)
 

Kürzlich hochgeladen

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 

Kürzlich hochgeladen (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

Case Study: MySQL migration from latin1 to UTF-8

  • 1. MySQL migration from latin1 to UTF-8 Meetup Viadeo / LeMUG.fr, Paris 16-11-2011 Olivier DASINI – dasini.net/blog/
  • 2. In this talk Why migrate in UTF-8 Charset and collation ? Obstacles faced Solutions found, approved and tested Rolling upgrade Switchover Reminder... (abstract for exhausted people) Olivier DASINI - ©2011 – http://dasini.net/blog/ 2
  • 3. Me, myself & I Olivier DASINI MySQL Expert at Viadeo ● http://fr.viadeo.com/fr/profile/olivier.dasini My technology watch blog on MySQL ● http://dasini.net/blog/ Co-founder of the french society: MySQL User Group Francophone (LeMug.fr) ● http://lemug.fr Book author (in french) Audit et optimisation – MySQL 5, Bonnes pratiques pour l’administrateur ● Eyrolles, ISBN-13: 978-2212126341 MySQL 5 – Administration et optimisation ● ENI, ISBN-13: 978-2-7460-5516-2 Olivier DASINI - ©2011 – http://dasini.net/blog/ 3
  • 4. Migration UTF-8 mission Main mission Convert the data to UTF-8 ● Viadeo used in over 200 countries ● Including China, India, Russia, Middle East, ... Secondaries missions Convert the tables to InnoDB ● Performances, Hot Backup, Operability,... Server tuning ● InnoDB tuning differ from MyISAM tuning Olivier DASINI - ©2011 – http://dasini.net/blog/ 4
  • 5. Charset & collation 1/4 Charset Can be defined as the encoding of an alphabet 39 different charset in MySQL 5.5 Latin1 (ISO/CEI 8859-1) is the default charset in MySQL ● « Almost » optimal for Western Europe ● 1 character = 1 byte utf8 is that we want (must) use ● « universal » charset ● 1 character = 1, 2 ou 3 byte(s) SHOW CHARACTER SET WHERE Charset='latin1'; +­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+ | Charset | Description          | Default collation | Maxlen | +­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+ | latin1  | cp1252 West European | latin1_swedish_ci |      1 |  +­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+ SHOW CHARACTER SET WHERE Charset='utf8'; +­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+ | Charset | Description   | Default collation | Maxlen | +­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+ | utf8    | UTF­8 Unicode | utf8_general_ci   |      3 |  +­­­­­­­­­+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­+­­­­­­­­+ Olivier DASINI - ©2011 – http://dasini.net/blog/ 5
  • 6. Charset & collation 2/4 Latin1 does not recognize all the characters CREATE TABLE t_latin1 (   nom varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CREATE TABLE t_utf8 (   nom varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci SELECT * FROM t_latin1; +­­­­­­+ | nom  | +­­­­­­+ | ??   | Latin1 can't encode Mandarin +­­­­­­+ SELECT * FROM t_utf8; +­­­­­­­­+ | nom    | +­­­­­­­­+ |  谢谢 | +­­­­­­­­+ Olivier DASINI - ©2011 – http://dasini.net/blog/ 6
  • 7. Charset & collation 3/4 Collation Can be defined as the set of rules that compare and order the symbols of an alphabet . Used mainly in the sorts Related to a charset ● LATIN1 default collation is latin1_swedish_ci ● UTF-8 default collation is utf8_general_ci Beware of the differences in behavior and performances... Olivier DASINI - ©2011 – http://dasini.net/blog/ 7
  • 8. Charset & collation 4/4 Collation is used mainly in the sorts SELECT * FROM table ORDER BY col COLLATE latin1_xxxxx_ci; SELECT * FROM c1; ORDER BY c COLLATE latin1_swedish_ci; +­­­­­­+ +­­­­­­+ | c    | | c    | +­­­­­­+ +­­­­­­+ | û    |  | û    |  | u    |  | u    |  | ü    |  | ù    |  | ù    |  | ü    |  +­­­­­­+ +­­­­­­+ ORDER BY c COLLATE latin1_german1_ci; ORDER BY c COLLATE latin1_german2_ci; +­­­­­­+ +­­­­­­+ | c    | | c    | +­­­­­­+ +­­­­­­+ | û    |  | û    |  | u    |  | u    |  | ü    |  | ù    |  | ù    |  | ü    |  +­­­­­­+ +­­­­­­+ Olivier DASINI - ©2011 – http://dasini.net/blog/ 8
  • 9. Method Convert the tables Charset : UTF-8 Collation : utf8_swedish_ci Storage : InnoDB Very simple with MySQL A single command : ALTER TABLE Fingers in the nose ! ALTER TABLE ma_table ENGINE = INNODB, ALTER TABLE ma_table CHARSET  = utf8 COLLATE utf8_swedish_ci Does it work ? Olivier DASINI - ©2011 – http://dasini.net/blog/ 9
  • 10. The end ? Thank you for your attention ! Olivier DASINI - ©2011 – http://dasini.net/blog/ 10
  • 11. Not so simple... Viadeo constraints Workload: a huge amount of data is managed (Nov. 2011) ● 1 000 000 new members / month ● 250 000 connections / day ● 165 000 active discussiondans forum ● 80 000 forum member / month ● 18 000 articles shared / day ● 1 250 events organized / week Minimize the downtime ● No connection = no income Nasty surprise ● Dirty data ● Legacy... MySQL constraints Maximum size of the index Characteristics related to the CHARSET & COLLATION => had suddenly became issues when migrating ... Olivier DASINI - ©2011 – http://dasini.net/blog/ 11
  • 12. Mission: Impossible ? Olivier DASINI - ©2011 – http://dasini.net/blog/ 12
  • 13. Viadeo constraints MySQL @ Viadeo (prod OLTP) : huge volume of data About thirty instances distributed on 5 « clusters » ie Master / Slaves replication 2 TB of data (for MySQL) About 1000 tables 20% of the effort ● 70% MyISAM Required good MySQL skills 5 billions rows Scripting know-how Minimize the downtime with MySQL replication => Rolling upgrade ● Slaves are migrated first ● Allowing testing and validate the process => Switchover ● A slave promoted to master 80% of the effort Required good business skills Data legacy Large consumer of time and energy for historical reasons, some data was not « clean » ● Thank you to the elders................................................................................. The application migration was carried out several months before => mix of latin1 et utf8 data in latin1 tables => Tedious hand cleaning => Performed with a good knowledge of code ● Thank you to the elders ! Olivier DASINI - ©2011 – http://dasini.net/blog/ 13
  • 14. 80% of the effort Required good business skills Large consumer of time and energy 3 weeks of labor The dark side of the force... Olivier DASINI - ©2011 – http://dasini.net/blog/ 14
  • 15. Data legacy - Taille max des index Limited to 767 bytes for InnoDB (1000 bytes for MyISAM) Specified key was too long; max key length is 767 bytes Warning 1071 : for a not unique index ● MySQL index the 255 first characters ● KEY `idx_url` (`url`(255)) ERROR 1071 (42000) : for an unique index ● Many ways to handle it. ● Highly dependent on the business logic. ● => Processed on a case by case basis. ALTER TABLE _table CONVERT TO CHARACTER SET utf8; ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes CREATE TABLE _table (   info varchar(256) NOT NULL, 256 x 3 = 768 > 767 ... the count is not good !   PRIMARY KEY (info) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ALTER TABLE _table2 CONVERT TO CHARACTER SET utf8; Query OK, 0 rows affected, 2 warnings (0.33 sec) Records: 0  Duplicates: 0  Warnings: 2 CREATE TABLE _table2 (   info varchar(256) NOT NULL,   KEY info (info(255)) Add by MySQL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 Olivier DASINI - ©2011 – http://dasini.net/blog/ 15
  • 16. Data legacy – Duplicate entry 1/3 Process Run tests on a sample data Understand the problem(s) ● ERROR 1062 (23000): Duplicate entry ● => Different charset = different behavior of the server Identify rows issues ● The problematic characters : ● Do not appear to cause problems or are sometimes invisible ● With SQL queries : easy but sometimes long, often very long Deal with the problem ● Understand the data ● Understand MySQL ● Difficult to automate => TEDIOUS Olivier DASINI - ©2011 – http://dasini.net/blog/ 16
  • 17. Data legacy – Duplicate entry 2/3 Weird characters in the data A0 / A020 / 20A0 / C2A0 / … at the end of some rows Clean hand operation ! SELECT ID, hex(url) FROM _table WHERE  LEFT(reverse(Url),2) LIKE  CONCAT(UNHEX('A0'),'%') ; for col in postID;  do      for carac in A0 A020 20A0;  do mysql ­ugrantless ­uP4S5 ­B ­N ­e"SELECT ID FROM _table  WHERE LEFT(reverse($col),2) LIKE CONCAT(UNHEX('$carac'),'%');";  done; done;  Olivier DASINI - ©2011 – http://dasini.net/blog/ 17
  • 18. Data legacy – Duplicate entry 2/3 ERROR 1062 (23000): Duplicate entry 'pykachu' for key 'surnom' ● While there are (apparently) no duplicates... ? SELECT surnom... LIKE 'p_kachu'; +­­­­­­­­­+ = | surnom  | Unique index +­­­­­­­­­+ | pykachu | | pÿkachu | +­­­­­­­­­+ ? SELECT surnom... LIKE 'p_kachu'; +­­­­­­­­+ | surnom | Unique index = +­­­­­­­­+ | pykachu| | pykachu | +­­­­­­­­+ Similar but different characters... Depends on the collation y = ÿ  ² = 2  ª = a  ß = ss Olivier DASINI - ©2011 – http://dasini.net/blog/ 18
  • 19. Charset & collation (again) 1/4 2 different letters can be similar... SELECT 'u' = 'ü' COLLATE utf8_general_ci; SELECT 'e' = 'ë' COLLATE utf8_general_ci; +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | 'u' = 'ü' COLLATE utf8_general_ci  | | 'e' = 'ë' COLLATE utf8_general_ci  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                                  1 | |                                  1 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ SELECT 'u' = 'ü' COLLATE utf8_swedish_ci; SELECT 'e' = 'ë' COLLATE utf8_swedish_ci; +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | 'u' = 'ü' COLLATE utf8_swedish_ci  | | 'e' = 'ë' COLLATE utf8_swedish_ci  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                                  0 | |                                  1 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ SELECT 'u' = 'ü' COLLATE utf8_bin; SELECT 'e' = 'ë' COLLATE utf8_bin; +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | 'u' = 'ü' COLLATE utf8_bin  | | 'e' = 'ë' COLLATE utf8_bin  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                           0 | |                           0 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ Olivier DASINI - ©2011 – http://dasini.net/blog/ 19
  • 20. Charset & collation (again) 2/4 Behavior may differ between latin1_swedish_ci & utf8_swedish_ci SELECT 'u' = 'ü' COLLATE latin1_swedish_ci; SELECT 'e' = 'ë' COLLATE latin1_swedish_ci; +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | 'u' = 'ü' COLLATE utf8_general_ci  | | 'e' = 'ë' COLLATE utf8_general_ci  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                                  0 | |                                  0 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ SELECT 'u' = 'ü' COLLATE utf8_swedish_ci; SELECT 'e' = 'ë' COLLATE utf8_swedish_ci; +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | 'u' = 'ü' COLLATE utf8_swedish_ci  | | 'e' = 'ë' COLLATE utf8_swedish_ci  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                                  0 | |                                  1 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ Identical behavior Different behavior ● u is different from ü ● e is different from ë in latin1_swedish_ci ● e is identical to ë in utf8_swedish_ci Olivier DASINI - ©2011 – http://dasini.net/blog/ 20
  • 21. Charset & collation (again) 3/4 Collation : pay attention to differences in performance SELECT BENCHMARK(1000000000, (select 'u'='ü' collate utf8_bin)); +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | BENCHMARK(1000000000, (select 'u'='ü' collate utf8_bin))  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                                                         0 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ 1 row in set (20.62 sec) SELECT BENCHMARK(1000000000, (select 'u'='ü' collate utf8_swedish_ci)); +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | BENCHMARK(1000000000, (select 'u'='ü' collate utf8_swedish_ci))  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                                                                0 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ 1 row in set (57.53 sec) SELECT BENCHMARK(1000000000, (select 'u'='ü' collate utf8_general_ci)); +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ | BENCHMARK(1000000000, (select 'u'='ü' collate utf8_general_ci))  | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ |                                                                0 | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­+ 1 row in set (27.71 sec) Olivier DASINI - ©2011 – http://dasini.net/blog/ 21
  • 22. Charset & collation (again) 4/4 – Illegal mix Collation : pay attention to collation mixes CREATE TABLE City ( … ) DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci CREATE TABLE Country ( … ) DEFAULT CHARSET=utf8 collate=utf8_general_ci SELECT City.name FROM City JOIN Country  USING(name) ; ERROR 1267 (HY000): Illegal mix of collations (utf8_swedish_ci,IMPLICIT)  and (utf8_general_ci,IMPLICIT) for operation '=' SELECT City.name FROM City Ci JOIN Country Co ON Ci.name=Co.name COLLATE  utf8_general_ci ; Bypassing the problem Olivier DASINI - ©2011 – http://dasini.net/blog/ 22
  • 23. 20% of the effort Required good MySQL skills Scripting know-how 3 days of labor Light side of the force Olivier DASINI - ©2011 – http://dasini.net/blog/ 23
  • 24. Minimize the downtime – Rolling upgrade Updated tested and validated on slaves White DB : latin-1 Orange DB : UTF-8 Olivier DASINI - ©2011 – http://dasini.net/blog/ 24
  • 25. Rolling upgrade 1/4 Optimize the duration of the migration Minimize disk I/O Maximize buffers utilization Extract, Transform and Load (data) mysqldump ALTER TABLE mysqlimport REPAIR TABLE (MyISAM) Powered by bash ! Tuning server Setting buffers o their proper value Various optimization MySQL replication Stop it before the migration process Start it after the migration process Olivier DASINI - ©2011 – http://dasini.net/blog/ 25
  • 26. Rolling upgrade 2/4 Optimize the duration of the migration Minimize disk I/O Maximize buffers utilization Disable logs SET SESSION SQL_LOG_BIN=0; SET GLOBAL slow_query_log=0; SET GLOBAL general_log=0;  InnoDB tuning Reduction disks I/O SET GLOBAL innodb_flush_log_at_trx_commit = 0; SET GLOBAL innodb_support_xa = 0; SET GLOBAL unique_checks=0;  SET GLOBAL foreign_key_checks=0;  MyISAM tuning Buffer for sorting MyISAM indexes: SET GLOBAL myisam_sort_buffer_size = N; REPAIR TABLE / CREATE INDEX / ALTER TABLE SET GLOBAL bulk_insert_buffer_size = N; Optimization : LOAD DATA INFILE Server tuning SET GLOBAL read_buffer_size = N; Used for « full table scan » Default DB charset & collation ALTER DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_swedish_ci; Olivier DASINI - ©2011 – http://dasini.net/blog/ 26
  • 27. Rolling upgrade 3/4 Extract, Transform and Load (data) mysqldump ALTER TABLE mysqlimport REPAIR TABLE (MyISAM) Save the structure and the data in UTF8: mysqldump ­­default­character­set=utf8 ­­hex­blob DB table1 table2 ­T /path/to/bck/ 1m22.406s Convert the tables in InnoDB, utf8, utf8_swedish_ci: ALTER TABLE _table ENGINE=InnoDB, CONVERT TO CHARACTER SET utf8 COLLATE  utf8_swedish_ci; Query OK, 12193106 rows affected (31 min 14.77 sec) Records: 12193106  Duplicates: 0  Warnings: 0 To do without the data !!! Load the data in UTF8: time mysql ­­default­character­set=utf8 DB < data.sql real 26m4.613s               VS time mysqlimport ­­default­character­set=utf8 DB _table.txt DB._table: Records: 12193106  Deleted: 0  Skipped: 0  Warnings: 0 real 13m40.607s mysqlimport (load data infile) is the fastest Olivier DASINI - ©2011 – http://dasini.net/blog/ 27
  • 28. Rolling upgrade 4/4 Tuning server Setting buffers o their proper value Various optimization Refactoring my.cnf + Tuning Server default_storage_engine=InnoDB # Charset & Collation Limit bad surprises character_set_server=utf8    collation_server=utf8_swedish_ci # Replication Skip­slave­start # Change hashing algorithm (REHASH passwords) old_passwords=0 The old passwords hashing algorithm is not secure (< 4.1) ... $ time ./poc XXxxXxxXXXxXxXXX mysql crack POC (c) 2006 Philippe Vigier & www.sqlhack.com password for footprint XXxxXxxXXXxXxXXX = '______' real 38m47.400s Olivier DASINI - ©2011 – http://dasini.net/blog/ 28
  • 29. Minimize the downtime - Switchover Switchover for minimize the downtime A slave turn master The master become a slave Olivier DASINI - ©2011 – http://dasini.net/blog/ 29
  • 30. Switchover – Pseudo code 1/3 /* the master should be in READ ONLY mode*/ Does not work with the $mA_cmd = "SET GLOBAL read_only='ON';"; SUPER privilege $mA_cmd = "FLUSH NO_WRITE_TO_BINLOG TABLES WITH READ LOCK;"; /*Retrieved old master binlog info*/ $mA_cmd = "SHOW MASTER STATUS;"; Allows the slave to stop at the exact position $old_master_file = $row["File"]; $old_master_pos = $row["Position"]; /* Kill the pending old master's connexions */ SELECT sleep(2); SELECT ID, USER, HOST FROM information_schema.PROCESSLIST WHERE  TIME > 2; KILL CONNECTION  ... Kill any remaining connections to the old master Olivier DASINI - ©2011 – http://dasini.net/blog/ 30
  • 31. Switchover – Pseudo code 2/3 /*For all the slaves*/ /*Wait for the slave up to date*/ $m[B|C]_cmd = "SELECT master_pos_wait('$old_master_file',  $old_master_pos);"; Gives back the hand when the slave is synchronized with the master /*Stop the replication*/ $m[B|C]_cmd = "STOP SLAVE"; Stop the replication /*Retrive new master binlog info*/ $mB_cmd = "SHOW MASTER STATUS;"; On the promoted server. Used to set the slaves on the new master $new_master_file = $row["File"]; $new_master_pos = $row["Position"]; Olivier DASINI - ©2011 – http://dasini.net/blog/ 31
  • 32. Switchover – Pseudo code 3/3 /*For all the new slaves*/ /*reset the old slave configuration*/ $mC_cmd = "RESET SLAVE;"; Reset replication informations on all the other slaves /*Configure the new master*/ $mC_cmd = "CHANGE MASTER TO MASTER_HOST = '$new_master_host',  MASTER_USER = '$new_master_user', MASTER_PASSWORD =  '$new_master_pwd', MASTER_PORT=$new_master_port,  MASTER_LOG_FILE='$new_master_file',  MASTER_LOG_POS=$new_master_pos;";  Tell the slaves which is the new master /*Start the replication*/ $mC_cmd = "START SLAVE"; Start replication on all the slaves /*reset the replication info for the new master*/ $mB_cmd = "RESET SLAVE"; New master cleanup Olivier DASINI - ©2011 – http://dasini.net/blog/ 32
  • 33. Switchover - inspiration Audit et optimisation, MySQL 5 --- éditions Eyrolles (french book) Page 239 Soit A le serveur master, B le slave de A qui va être promu master et C un autre slave de A 1/ Interdire les écritures sur A: SET GLOBAL read_only='ON'; verrouille en lecture seule FLUSH TABLES WITH READ LOCK; verrouille en lecture seule pour les autres comptes avec le droit SUPER 2/ Sauvegarder le numéro du journal binaire et la position de A  : SHOW MASTER STATUS; paramètres  : File, Position 3/ Laissez le serveur B & C rattraper leur retard au niveau de la réplication SELECT master_pos_wait('mysql-bin.xxxxxx',N); paramètres  : File & Position de A (point 2). La fonction rendra la main une fois l’esclave à jour 3/ Une fois B à jour, assurez vous qu'il est configuré en master log binaire server-id unique Utilisateur de réplication exécutez SHOW MASTER STATUS; File & Position serviront à reconfigurer A et C. 4/ Routez les clients sur B qui devient alors le serveur actif 5/ Reconfigurer les serveurs A et C pour qu’ils soient esclave de B et qu’il reparte sur le bon fichier binaire et à la bonne position: STOP SLAVE; CHANGE MASTER TO MASTER_HOST='', MASTER_PORT=, MASTER_USER='', MASTER_PASSWORD='', MASTER_LOG_FILE = 'mysql-bin.xxxxxx', MASTER_LOG_POS = N; A doit être configurer comme un slave … la suite dans le livre :) Olivier DASINI - ©2011 – http://dasini.net/blog/ 33
  • 34. Recap Lessons learned from this painful experience Know you data ● Know and understand the business logic ● Respect the data ● => Check them before you store them (in an ideal world) ● => Otherwise you will pay sooner or later... (in the real world) Know MySQL ● The charset that I need, the collation that I chose ● Limits => RTFM ● Rolling upgrade ● Switchover Migrate the DB before migrating the application ● See point 1... Automate everything that can ● Scripting for ever Olivier DASINI - ©2011 – http://dasini.net/blog/ 34
  • 35. Merci The Viadeo team The speakers Anna Stéphane Combaudon Christophe Olivier Dasini Élodie Cédric Peintre Lionel Marc Thomas Lourdes Marie Anne You... Nicolas Pierre(s) Sabri et son équipe Sandy Séverine Stéphane Sylvain Yorick ... Olivier DASINI - ©2011 – http://dasini.net/blog/ 35
  • 36. Questions Where to find the slides of the meetup ? http://dasini.net/blog/presentations/ Olivier DASINI - ©2011 – http://dasini.net/blog/ 36