MySQL管理基础.pptVIP

  • 3
  • 0
  • 约2.98千字
  • 约 33页
  • 2017-11-14 发布于河北
  • 举报
MySQL管理基础

MySQL Overview MySQL Replication MySQL HA MySQL管理基础 MySQL 结构层次 InnoDB vs MyISAM on Index InnoDB物理文件组成 InnoDB的数据文件包括: .frm 表结构文件 .ibd 表数据文件(数据目录) 系统元数据和undo space(共享表空间) ib_logfile* 重做日志文件 (Oracle的Redo Log) INSERT BUFFER Innodb使用insert buffer忽悠数据库:它并不马上更新索引的叶子页,而是把若干对同一页面的更新缓存起来,一次性更新,从而有效节约I/O InnoDB优化设计 只能用在非唯一索引中,因为列的唯一性通过索引来保证,所以在索引没有被更新前,数据库并不知道索引是否是唯一的.如果用在唯一索引中,在insert merge的过程中,可能就会导致唯一键冲突 DOUBLE WRITE InnoDB在将数据写到数据文件的时候,会出现只写了一半但由于某种原因剩下的数据没有写到innodb file上,如果 double write buffer写成功的话,但是写磁盘失败,innodb就不用通过事务日志来计算了,而是直接用buffer的数据再写一遍 InnoDB优化设计 the doublewrite buffer is actually a benefit. Beyond guaranteeing that pages are recoverable, it also reduces the required fsyncs. Without it, each page that is written to the tablespace would need to be fsynced. With doublewrite enabled, a chunk of pages is written to the doublewrite buffer then 1 fsync is called, then pages are written to the tablespace and then 1 fsync fsync函数同步内存中所有已修改的文件数据到储存设备。参数fd是该进程打开来的文件描述符。 函数成功执行时,返回0。失败返回-1 ADAPTIVE HASH INDEX InnoDB存储引擎会监控对表上索引的查找, 如果观察到建立哈希索引可以带来速度的提升,则建立哈希索引,所以称之为自适应(adaptive)哈希索引 innodb_adaptive_hash_index  InnoDB优化设计 Adaptive Hash Index However, sometimes, the read/write lock that guards access to the adaptive hash index may become a source of contention under heavy workloads, such as multiple concurrent joins. btr0sea.c 内容概要 MySQL Overview MySQL Replication MySQL HA 提供实时热备,保证高可用性 MySQL的所有高可用架构都是基于复制的,Replication是高可用的核心和基础 Replication 作用 MySQL复制基本原理 将在A机器上执行的所有SQL序列在B上原样重复执行一遍 在MySQL中称之为 : statement binlog-format=statement mysqlbinlog工具 mysqlbinlog binlog文件名 实现方式1 rand()函数 uuid()函数 自增 statement方式的问题 将在A机器上数据行的变化在B上原样做一遍 在MySQL中称之为 : row binlog-format=row mysqlbinlog工具 mysqlbinlog binlog文件名 实现方式2 mysqlbinlog -vv mysqlbinlog binlog文件大小的问题 如:update a set c1=100 where id 1000000; row方式的问题 Statement和row方式的组合 在MySQL中称之为 :mixed binlog-format=mixed mysqlbinlog工具 mysqlbinlog binlog文件名 实现方式3 第二种方式: binlog-format=row 理由: statement可能造成主备不一致 一次更新

文档评论(0)

1亿VIP精品文档

相关文档