MySQL运维&开发规范

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33656602/article/details/81628790

MySQL运维&开发规范


约定
  • MySQL, 通用称谓,泛指MySQL这个服务软件等相关代号
  • mysql, 没有上下文语义时,等同上面的含义
  • mysqld, MySQL服务软件的服务端程序、进程文件
  • mysql,有上下文时,通常指MySQL服务软件中的客户端工具
  • 同上,也包括 mysqladmin/mysqldump/mysqlbinlog等其他工具
  • 不正确写法
    • Mysql
    • MySql
    • MYSQL
    • mYSQL …
MySQL发展史
  • MySQL是全球最流行的开源关系型数据库, 开源数据库界占有率第二
  • 伴随着互联网的发展而成长
  • 互联网业务标配,好基友LA(N)MP组合
  • WEB2. 0时代后更是突飞猛进
历史
  • 1999-2003年,3.23
  • 2002-2007年,4.0
  • 2003-2009年,4.1
  • 2004 - 2012年,5.0
  • 2006-2014年,5.1
  • 2010-2015年,5.5
  • 2011 年,5.6
  • 2013年,5.7
  • 2016年,8.0
主流分支
  • ORACLE MySQL
    • 官方正统
  • Percona Server
    • 基于InrnoDB增加提升性能及易管理性补丁后,形成XtraDB引擎
    • 工具:XtraBackup、pt-toolkit系列
    • 和官方保持一致,基本兼容
  • MariaDB
    • MySQL创始人Monty创建,目标在于替换现有的MySQL,也包含了Percona 的XtraDB、TokuDB在内的多种实用引擎
    • 非主流分支,和官方版木区别越来越大,有很多不兼容
Percona特色

取代企业版特有功能
- PAM Authentication
- Thread pool/线程池
- Audit/审计
其他
- 集成 TokuDB
- Extra Diagnostic Features
- Performance & Scalability Enhancements
- Extra Features for DBA/Operations Staff

MariaDB支持的引擎
  1. ColumnStore, a column oriented storage engine optimized for Data warehousing.
  2. MyRocks, a storage engine with great compression, in 10.2
  3. Aria, My ISAM replacement with better caching.
  4. FederatedX (drop-in replacement for Federated)
  5. OQGRAPH (In MariaDB 5.2 and later. Disabled in MariaDB 5.5 only.) — new in 5.2
  6. SphinxSE — new in 5.2
  7. TokuDB in MariaDB 5.5 and later.
  8. CONNECT in MariaDB 10.0 and later.
  9. SEQUENCE in MariaDB 10.0 and later.
  10. Spider in MariaDB 10.0 and later.
  11. Cassandra in MariaDB 10.0
MariaDB性能提升
  1. A lot of optimizer enhancements,子查询&JOIN优化
  2. windows系统下的 InnoDB AIO优化
  3. checksum table效率更高
  4. 字符集转换效率更高
  5. 更早实现了并行复制、多源复制、线程池、JSON、 虚拟列
  6. 比MySQL 5.7更早实现了客户端连接效率提升
线程池作用

应对瞬间的高并发的短连接的场景,在MySQL 5.7 之前,处理高并发短连接请求,MySQL 效率较低。即瞬间大量的连接请求进来,会造成线程大量的上下文切换,导致CPU较高,线程池的功能可有效缓解这样的问题,先将所有的请求放在一个队列中,再从线程池的队列中拿出一个线程去处理,避免大量的上下文切换

MariaDB新特性
  1. Microseconds in MariaDB 一 new in 5.3
  2. Number of supported decimals in DECIMAL has increased from 30 to 38.— new in 10.2
  3. Microsecond Precision in Processlist
  4. Table Elimination
  5. Virtual Columns — new in 5.2
  6. CHECK CONSTRAINT — new in 10.2
  7. DEFAULT expression, including DEFAULT for BLOB and TEXT. — new in 10.2
  8. Extended User Statistics -new in 5.2
  9. KILL all queries for a user -new in 5.3
  10. KILL QUERY ID - terminates the query by query_id, leaving the connection intact — new in 10.0.5,
  11. Pluggable Authentication — new in 5.2
  12. Storage-engine-specific CREATE TABLE — new in 5.2
  13. Enhancements to INFORMATION SCHEMA.PLUGINS table — new in 5.2
  14. Group commit for the binary log. This makes replication notably faster! — new in 5.3
  15. Added -rewrite-db mysqlbinlog option to change the used database — new in 5.2
  16. Progress reporting for ALTER TABLE and LOAD DATA INFILE. — new in 5.3
  17. Faster joins and subqueries. — new in 5.3
  18. HandlerSocket and faster HANDLER calls. — new in 5.3
  19. Dynamic Columns support. — new in 5.3
  20. GIS Functionality - new in 5.3
  21. Multi-source replication. — new in 10.0
  22. Global Transaction ID. - new in 10.0
    和官方GTID并不兼容,与官方版本只能搭建基于文件的复制
  23. SHOW EXPLAIN gives the EXPLAIN plan for a query running in another thread. 一 new in 10.0
  24. Roles.——new in 10.0
  25. PCRE Regular Expressions (including REGEXP_REPLACE〇). 一 new in 10.0
  26. DELETE … RETURNING. — new in 10.0
  27. See also a detailed breakdown of System variable differences between MariaDB 5.5 and MySQL 5.5 and System variable differences between MariaDB 10.0 and MySQL 5.6.
MariaDB 兼容性

Incompatibilities between MariaDB 10.0 and MySQL 5.6
- MariaDB GTID is not compatible with MySQL 5.6
- MariaDB 10.0 multi-source replication, not MySQL 5.6
- MariaDB 10.0 dynamic columns, not MySQL 5.6
- CREATE TABLE … SELECT在 slave 上改造成CREATE OR REPLACE TABLE
- can not support the MySQL Memcached plugin
- not Users created with MySQL’s SHA256 password algorithm
- does not support delayed replication
- MariaDB 10.1 does not support MySQL 5.7’s JSON.
- MariaDB 10.1’s InnoDB encryption is implemented differently than MySQL 5.7’s InnoDB encryption.
- MariaDB 10.1 does not support the ngram and MeCab full-text parser plugins - MDEV-10267, MDEV-10268.
- MariaDB 10.1 does not support multiple triggers for a table-MDEV-6112.
- Note: Multiple triggers per table was added in 10.2
- MariaDB stores JSON as true text, not in binary format as MySQL. The reason is that our JSON functions are much faster than MySQL’s so we didn’t need to see a need for storing things in binary format as it adds a lot of complexity when manipulating JSON objects.
- MariaDB 10.2 does not support the ngram and MeCab full-text parser plugins - MDEV-10267, MDEV-10268.
- MariaDB 10.2 does not support the MySQL X plugin.
- MariaDB 10.2 does not support the MySQL general table spaces.

关于MySQL DBA
  • 运维DBA
    • 日常管理,备份、恢复、故障处理、高可用保障等
    • 整体优化,服务器、网络、MySQL、架构
  • 开发DBA
    • 深入理解业务需求
    • SQL优化,编写存储过程、触发器等业务SQL代码
  • DB架构师
    • 整体架构设计、优化

猜你喜欢

转载自blog.csdn.net/qq_33656602/article/details/81628790