Successfully reported this slideshow.
Your SlideShare is downloading. ×

Upgrading to my sql 8.0

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 37 Ad
Advertisement

More Related Content

Slideshows for you (20)

Similar to Upgrading to my sql 8.0 (20)

Advertisement

Recently uploaded (20)

Upgrading to my sql 8.0

  1. 1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrading to MySQL 8.0+, a More Automated Upgrade Experience Ståle Deraas, Software Development Director Oracle, MySQL Oct 2018 Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
  2. 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  3. 3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Agenda Introduction A straight forward upgrade to MySQL 8.0 Upgrade to MySQL 8.0 in detail A better future with MySQL 8.0 -> 1 2 3 4
  4. 4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Introduction
  5. 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrading in General • Why upgrade the MySQL installation? – Security concerns – Performance and Scalability – New functionality – Reduce tech debt for the MySQL installation • Multiple version upgrade is complex (5.6 -> 5.7 -> 8.0) • Eg. deprecated functionality in 5.7, removed in 8.0 5
  6. 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Why do we postpone upgrades? • Do we have the required knowledge? • Do we have the required resources? • Do we have the time? • Cost for doing the actual work necessary to upgrade – For DBAs and possibly consultants • Can we afford it? – Cost for lost business during the switchover, depending on downtime 6
  7. 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrading in General - Biting the Bullet • At some point upgrade needs to happen! • DBA input regarding upgrading MySQL – Reducing risk and cost is key – Total duration of upgrade should be short – For customer apps, keep old MySQL behaviour by default, change behavior later – Want to test new version gradually – When switching, downtime should be minimal 7
  8. 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrade to MySQL 8.0 The straightforward case
  9. 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL upgrade 5.7 -> 8.0, smooth sailing! 9 • Read release notes: Conclusion – No problems • Run upgrade_checker me@siv20$ ./mysqlsh root:@localhost:3307 -e "util.checkForServerUpgrade();” The MySQL server at localhost:3307 will now be checked for compatibility issues for upgrade to MySQL 8.0... MySQL version: 5.7.24 - Source distribution 1) Usage of db objects with names conflicting with reserved keywords in 8.0 No issues found 2) Usage of utf8mb3 charset No issues found ..... No known compatibility errors or issues for upgrading the target server to MySQL 8 were found.
  10. 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL upgrade 5.7 -> 8.0, smooth sailing! Con’t 10 • Backup your data directory, install and start MySQL 8.0 – In-place upgrade • Run mysql_upgrade • me@siv20$ ./mysql_upgrade --socket=/me/mysql/mysql.sock --port=3307 --user=root • Checking if update is needed. • Checking server version. • Running queries to upgrade MySQL server. • Upgrading system table data. • Checking system database. • mysql.columns_priv OK • mysql.component OK • mysql.db OK ... • Upgrade process completed successfully.
  11. 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL upgrade 5.7 -> 8.0, smooth sailing! Con’t 11 • Restart the server and look at messages in the error log 2018-10-06T09:11:28.167169Z 0 [System] [MY-010116] [Server] /me/mysqld (mysqld 8.0.12) starting as process 27147 2018-10-06T09:11:30.261139Z 0 [System] [MY-010931] [Server] /me/mysqld: ready for connections. Version: '8.0.12' socket: ’/me/mysql/mysql.sock' port: 3307 Source distribution • Verify that apps and services are working as expected
  12. 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Improvements to upgrade to MySQL 8.0
  13. 13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Goals for the MySQL upgrade experience • Upgrade to be faster and with lower risk – Eliminate legacy issues with metadata • Transition from legacy metadata handling to transactional data dictionary • The upgrade process will produce a consistent data dictionary • Help DBAs upgrading to MySQL 8.0 – Better support preparing for the upgrade • Added upgrade_checker to the MySQL Shell – Better support during the upgrade • Added upgrade checks to MySQL server • Prohibit legacy issues from entering the 8.0 metadata store 13
  14. 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL Data Dictionary before MySQL 8.0 14 Data Dictionary Files FRM TRG OPT System Tables (mysql.) user procevents InnoDB System Tables MyISAM File system InnoDB SQL
  15. 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Transactional Data Dictionary in MySQL 8.0 15 Data Dictionary InnoDB SQL DD TableDD TableDD Table
  16. 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Typical upgrade procedure • Let a slave have the new version, and receive all data • Test applications on new slave, and possibly adapt applications • Let slave receive production traffic • Upgrade remaining slaves • Finally promote master 16
  17. 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | The traditional MySQL upgrade • Consider standalone ”in-place” upgrade, new SW on existing data image – Proper backups are assumed 1. Stop old MySQL server 2. Change binaries to new MySQL server version 3. Adjust config, my.cnf of new server version 4. Start new MySQL server 5. Run mysql_upgrade to possibly upgrade system tables and user tables 6. Restart MySQL server 17
  18. 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrade to 8.0 in detail and how the upgrade_checker helps
  19. 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL 8.0 Features 19 • Read release notes https://dev.mysql.com/doc/relnotes/mysql/8.0/en/ and https://dev.mysql.com/doc/refman/8.0/en/upgrading.html • Read blogs on https://mysqlserverteam.com • New features in 8.0, and there is a lot of them – Transactional Data Dictionary, and Atomic DDL – Geography support – Roles – Persistent runtime configuration – ++++
  20. 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL 8.0 Deprecation/Removals, Samples – Features removed • Query Cache, Non-native partitioning – Options and variables removed • Log_errors/log_warnings replaced by log_error_verbosity • Secure_auth system var, --secure-auth client option and MYSQL_SECURE_AUTH from mysql options • SQL Modes removed – Account management • The PASSWORD() function has been removed, using GRANT to create users is no longer supported – Syntaxes affected • EXTENDED and PARTITIONS keywords for EXPLAIN removed • N as a synonym for NULL in SQL removed. Use NULL instead 20
  21. 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL 8.0 Defaults Changes There are a lot of changes to the defaults in 8.0, see https://mysqlserverteam.com/new-defaults-in-mysql-8-0/ Some important ones: – Default characterset and collation to 'utf8mb4' and 'utf8mb4_0900_ai_ci’ – The default/preferred authentication plugin ‘caching_sha2_password’ – innodb_undo_tablespaces changed from 0 to 2 – log_bin has been changed from OFF to ON – Upgrade from MySQL 5.7: ALTER INSTANCE ROTATE INNODB MASTER KEY 21
  22. 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL 8.0 Defaults Changes –Especially note, character set and collation defaults changes – Note that for upgrading SCHEMAs from 5.7 to 8.0, each shema has it’s own specified default charset and collation, so nothing needs to be done to preserve this – Rolling upgrade with a 5.7 master • For new schemas using defaults, you will get the master’s charset and collation on the 8.0 slaves too • New tables in existing schemas inherit the schemas defaults, so ”no problem” 22
  23. 23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL upgrade_checker – New tool in MySQL 5.7 Shell – upgrade_checker will check your MySQL 5.7 installation readiness for upgrade – Clean up legacy issues • Running the tool on the 5.7 installation, users can make changes when time permits before the upgrade – upgrade_checker is in active development and more checks will be added • Part of MySQL update releases – NOTE We think it is unlikely that there are installations with all the issues explained in the following slides 23
  24. 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | • Usage of old temporal type • Conflicting db object names and reserved keywords • Usage of utf8mb3 charset • Reserved tablenames in mysql schema • FK names longer than 64 chars • Usage of obsolete sql_mode • ENUM/SET column definitions containing elements longer than 255 characters • Usage of partitioned tables in shared tablespaces • Usage of removed functions • Usage of removed GROUP BY ASC/DESC • Issues reported by ”check table x for upgrade” command 24 MySQL upgrade_checker
  25. 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Issues detected by the upgrade_checker: example 1 • The Transactional Data Dictionary is stored as tables in mysql schema, and can not conflict with user table names – Detect with SQL: SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE LOWER(TABLE_SCHEMA) = 'mysql’ and LOWER(TABLE_NAME) IN ( 'catalogs’, ’character_sets’....); – ACTION: RENAME tables with conflicting name 25
  26. 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Issues detected by the upgrade_checker: example 2 • In MySQL 5.7, several spatial functions available under multiple names were deprecated. Example PointFromText – Detect with SQL: Use INFORMATION_SCHEMA to look at VIEW definitions like e.g. : select table_name from information_schema.views where view_definition like "%function%” Do similar for ROUTINE, TRIGGER,EVENT, GC – ACTION: Use the new function in 8.0 with prefix ’ST_’ or ’MBR’ – ALTER TABLE t_gcol_dep MODIFY g POINT GENERATED ALWAYS AS (ST_POINTFROMTEXT(POINT(10, 10))); 26
  27. 27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Issues detected by the upgrade_checker: example 3 • Data types like e.g old style decimals, old style TIME/DATETIME etc that have persisted up until MySQL 5.7 due to the binary upgrade will not be supported in MySQL 8.0 – Tables using this type can be identified by running CHECK TABLE…FOR UPGRADE or mysqlcheck with check-upgrade option in MySQL 5.7 – ACTION: fix through REPAIR TABLE and dump/reload for old style varchar/old style decimal 27
  28. 28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | When the upgrade_checker runs clean 28 • Backup your data directory, and install new MySQL 8.0 version • Run mysql_upgrade • Restart the server and inspect the error log • Reconnect apps and verify they work as expected • Attempting upgrade without a clean upgrade_checker run will abort the upgrade
  29. 29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | A better future with MySQL 8.0 ->
  30. 30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrade MySQL 8.0 -> • How can we continue improving the upgrade? –We want to reduce time and risk even further • Bulk of time spent for in-place upgrade of MySQL: –Harvest metadata for analysis –Examine all user tables
  31. 31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Transactional Data Dictionary in MySQL 8.0 31 Data Dictionary InnoDB SQL DD TableDD TableDD Table
  32. 32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrade MySQL 8.0 -> • MySQL now stores all metadata in InnoDB (Done) – Enables fast metadata analysis with SQL-queries • Added metadata for versioning (Done) – The new mysqld executable knows which version it is upgrading from • Improved protection of metadata, good for security reasons (Partly done) – Enforced metadata integrity • Remove need for mysql_upgrade client (WIP) – Move functionality to mysqld proper – Docker/container friendly
  33. 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Upgrade MySQL 8.0 -> the GREAT news • The traditional MySQL upgrade revisited 1. Stop old MySQL server 2. Change binaries to new MySQL server version 3. Adjust config, my.cnf of new server version 4. Start new MySQL server • Analyze metadata and automatically upgrade, making upgrade process fast 5. Run mysq_upgrade to possibly upgrade system tables and user tables • Potentially time consuming 6. Restart MySQL server • Reduces downtime, container/docker friendly 33
  34. 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Summary: Upgrade MySQL 8.0 -> • Lowers risk – The upgrade_checker identifies potential issues • In active development – Metadata integrity • Faster upgrade process – Fast metadata analysis – Fast metadata upgrade – Removal of mysql_upgrade • Simplified upgrade process – Fewer steps – Automatic metadata upgrade 34
  35. 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Recap: Upgrade to MySQL 8.0 • Prepare your upgrade (release notes, resources) • DO run the upgrade_checker – Fix issues until it runs clean • TEST your applications on MySQL 8.0 • DO your backup • Upgrade to MySQL 8.0 35
  36. 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Try for yourself! • Downloadable 8.0.13 – http://dev.mysql.com • Enjoy and give us your feedback! • Thank you for listening • http://mysqlserverteam.com 36
  37. 37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL Upgrade Resources • https://dev.mysql.com/doc/refman/8.0/en/upgrading-strategies.html#upgrade-prerequisites • https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html • https://mysqlserverteam.com/inplace-upgrade-from-mysql-5-7-to-mysql-8-0/ • https://mysqlserverteam.com/upgrading-to-mysql-8-0-here-is-what-you-need-to-know/ • https://mysqlserverteam.com/mysql-shell-8-0-4-introducing-upgrade-checker-utility/ • https://mysqlserverteam.com/upgrading-to-mysql-8-0-with-spatial-data/ • https://mysqlserverteam.com/whats-new-in-mysql-8-0-generally-available/ • https://mysqlserverteam.com/upgrading-your-mysql-server-farm/

×