高可用性MySQL(影印版)
Charles Bell, Mats Kindahl, Lars Thalmann
Mark Callaghan 序
出版时间:2011年03月
页数:598
服务器瓶颈和故障是任何数据库都无法回避的现实问题,但它们不至于导致整体宕机。MySQL具有多种特性,可以帮助你保护系统免于失效,无论它运行在硬件、虚拟机上,还是云中。《高可用性MySQL》将详细解释如何在各种各样的现实场景中运用这些复制、集群和监控功能特性。
本书由设计相关工具的工程师编写,披露了很多关于MySQL可靠性和高可用性方面未写入文档或者很难找到的内容——对于任何使用该数据库系统的组织都是很重要的知识。
· 探索二进制日志,这是用于实现复制功能的文件,有助于灾难恢复和故障诊断
· 获取改善响应时间和处理大规模数据集的技巧
· 学习如何通过复制来扩展服务器
· 监控数据库活动和性能,以及主要的操作系统参数
· 追踪主从数据库动态,并且处理故障、重启、数据损坏和其他事件
· 使用本书作者编写的开源库代码自动化关键任务
· 学习在虚拟化环境中使用MySQL的技巧,比如Amazon Web Services
· 利用MySQL Cluster实现高可用性
“MySQL复制虽然已广泛部署,但是从未被充分阐释过。本书改变了这一切。”
——Mark Callaghan MySQL贡献者,担任过多家世界上
最大型互联网公司的MySQL工程团队领导
本书的作者Charles Bell博士是一位专注于复制和备份方面的资深开发者。他的兴趣范围包括数据库理论、软件工程和敏捷开发实践。
Mats Kindahl博士是MySQL复制与备份团队的复制功能主要开发者。
Lars Thalmann博士是MySQL 复制与备份团队的开发经理和技术领导者,他设计了很多复制备份方面的功能特性。
(建议有编程经验者阅读。)
  1. Foreword
  2. Preface
  3. Part I. Replication
  4. 1. Introduction
  5. What’s This Replication Stuff Anyway?
  6. So, Backups Are Not Needed Then?
  7. What’s with All the Monitoring?
  8. Is There Anything Else I Can Read?
  9. Conclusion
  10. 2. MySQL Replication Fundamentals
  11. Basic Steps in Replication
  12. Configuring the Master
  13. Configuring the Slave
  14. Connecting the Master and Slave
  15. A Brief Introduction to the Binary Log
  16. What’s Recorded in the Binary Log
  17. Watching Replication in Action
  18. The Binary Log’s Structure and Content
  19. Python Support for Managing Replication
  20. Basic Classes and Functions
  21. Operating System
  22. Server Class
  23. Server Roles
  24. Creating New Slaves
  25. Cloning the Master
  26. Cloning the Slave
  27. Scripting the Clone Operation
  28. Performing Common Tasks with Replication
  29. Reporting
  30. Conclusion
  31. 3. The Binary Log
  32. Structure of the Binary Log
  33. Binlog Event Structure
  34. Logging Statements
  35. Logging Data Manipulation Language Statements
  36. Logging Data Definition Language Statements
  37. Logging Queries
  38. LOAD DATA INFILE Statements
  39. Binary Log Filters
  40. Triggers, Events, and Stored Routines
  41. Stored Procedures
  42. Stored Functions
  43. Events
  44. Special Constructions
  45. Nontransactional Changes and Error Handling
  46. Logging Transactions
  47. Transaction Cache
  48. Distributed Transaction Processing Using XA
  49. Binary Log Management
  50. The Binary Log and Crash Safety
  51. Binlog File Rotation
  52. Incidents
  53. Purging the Binlog File
  54. The mysqlbinlog Utility
  55. Basic Usage
  56. Interpreting Events
  57. Binary Log Options and Variables
  58. Conclusion
  59. 4. Replication for High Availability
  60. Redundancy
  61. Planning
  62. Slave Failures
  63. Master Failures
  64. Relay Failures
  65. Disaster Recovery
  66. Procedures
  67. Hot Standby
  68. Dual Masters
  69. Semisynchronous Replication
  70. Slave Promotion
  71. Circular Replication
  72. Conclusion
  73. 5. MySQL Replication for Scale-Out
  74. Scaling Out Reads, Not Writes
  75. The Value of Asynchronous Replication
  76. Managing the Replication Topology
  77. Example of an Application-Level Load Balancer
  78. Hierarchal Replication
  79. Setting Up a Relay Server
  80. Adding a Relay in Python
  81. Specialized Slaves
  82. Filtering Replication Events
  83. Using Filtering to Partition Events to Slaves
  84. Data Sharding
  85. Shard Representation
  86. Partitioning the Data
  87. Balancing the Shards
  88. A Sharding Example
  89. Managing Consistency of Data
  90. Consistency in a Nonhierarchal Deployment
  91. Consistency in a Hierarchal Deployment
  92. Conclusion
  93. 6. Advanced Replication
  94. Replication Architecture Basics
  95. The Structure of the Relay Log
  96. The Replication Threads
  97. Starting and Stopping the Slave Threads
  98. Running Replication over the Internet
  99. Setting Up Secure Replication Using Built-in Support
  100. Setting Up Secure Replication Using Stunnel
  101. Finer-Grained Control over Replication
  102. Information About Replication Status
  103. Options for Handling Broken Connections
  104. How the Slave Processes Events
  105. Housekeeping in the I/O Thread
  106. SQL Thread Processing
  107. Slave Safety and Recovery
  108. Syncing, Transactions, and Problems with Database Crashes
  109. Rules for Protecting Nontransactional Statements
  110. Multisource Replication
  111. Row-Based Replication
  112. Options for Row-Based Replication
  113. Mixed-Mode Replication
  114. Events for Handling Row-Based Replication
  115. Event Execution
  116. Events and Triggers
  117. Filtering
  118. Conclusion
  119. Part II. Monitoring and Disaster Recovery
  120. 7. Getting Started with Monitoring
  121. Ways of Monitoring
  122. Benefits of Monitoring
  123. System Components to Monitor
  124. Processor
  125. Memory
  126. Disk
  127. Network Subsystem
  128. Monitoring Solutions
  129. Linux and Unix Monitoring
  130. Process Activity
  131. Memory Usage
  132. Disk Usage
  133. Network Activity
  134. General System Statistics
  135. Automated Monitoring with cron
  136. Mac OS X Monitoring
  137. System Profiler
  138. Console
  139. Activity Monitor
  140. Microsoft Windows Monitoring
  141. The Windows Experience
  142. The System Health Report
  143. The Event Viewer
  144. The Reliability Monitor
  145. The Task Manager
  146. The Performance Monitor
  147. Monitoring as Preventive Maintenance
  148. Conclusion
  149. 8. Monitoring MySQL
  150. What Is Performance?
  151. MySQL Server Monitoring
  152. How MySQL Communicates Performance
  153. Performance Monitoring
  154. SQL Commands
  155. The mysqladmin Utility
  156. MySQL GUI Tools
  157. MySQL Administrator
  158. MySQL Query Browser
  159. Server Logs
  160. Third-Party Tools
  161. The MySQL Benchmark Suite
  162. Database Performance
  163. Measuring Database Performance
  164. Database Optimization Best Practices
  165. Best Practices for Improving Performance
  166. Everything Is Slow
  167. Slow Queries
  168. Slow Applications
  169. Slow Replication
  170. Conclusion
  171. 9. Storage Engine Monitoring
  172. MyISAM
  173. Optimizing Disk Storage
  174. Tuning Your Tables for Performance
  175. Using the MyISAM Utilities
  176. Storing a Table in Index Order
  177. Compressing Tables
  178. Defragmenting Tables
  179. Monitoring the Key Cache
  180. Preloading Key Caches
  181. Using Multiple Key Caches
  182. Other Parameters to Consider
  183. InnoDB
  184. Using the SHOW ENGINE Command
  185. Using InnoDB Monitors
  186. Monitoring Logfiles
  187. Monitoring the Buffer Pool
  188. Monitoring Tablespaces
  189. Using INFORMATION_SCHEMA Tables
  190. Other Parameters to Consider
  191. Conclusion
  192. 10. Replication Monitoring
  193. Getting Started
  194. Server Setup
  195. Inclusive and Exclusive Replication
  196. Replication Threads
  197. Monitoring the Master
  198. Monitoring Commands for the Master
  199. Master Status Variables
  200. Monitoring Slaves
  201. Monitoring Commands for the Slave
  202. Slave Status Variables
  203. Replication Monitoring with MySQL Administrator
  204. Other Items to Consider
  205. Networking
  206. Monitor and Manage Slave Lag
  207. Causes and Cures for Slave Lag
  208. Conclusion
  209. 11. Replication Troubleshooting
  210. What Can Go Wrong
  211. Problems on the Master
  212. Problems on the Slave
  213. Advanced Replication Problems
  214. Tools for Troubleshooting Replication
  215. Best Practices
  216. Know Your Topology
  217. Check the Status of All of Your Servers
  218. Check Your Logs
  219. Check Your Configuration
  220. Conduct Orderly Shutdowns
  221. Conduct Orderly Restarts After a Failure
  222. Manually Execute Failed Queries
  223. Common Procedures
  224. Reporting Replication Bugs
  225. Conclusion
  226. 12. Protecting Your Investment
  227. What Is Information Assurance?
  228. The Three Practices of Information Assurance
  229. Why Is Information Assurance Important?
  230. Information Integrity, Disaster Recovery, and the Role of Backups
  231. High Availability Versus Disaster Recovery
  232. Disaster Recovery
  233. The Importance of Data Recovery
  234. Backup and Restore
  235. Backup Utilities and OS-Level Solutions
  236. The InnoDB Hot Backup Application
  237. Physical File Copy
  238. The mysqldump Utility
  239. XtraBackup
  240. Logical Volume Manager Snapshots
  241. Comparison of Backup Methods
  242. Backup and MySQL Replication
  243. Backup and Recovery with Replication
  244. PITR
  245. Automating Backups
  246. Conclusion
  247. 13. MySQL Enterprise
  248. Getting Started with MySQL Enterprise
  249. Subscription Levels
  250. Installation Overview
  251. MySQL Enterprise Components
  252. MySQL Enterprise Server
  253. MEM
  254. MySQL Production Support
  255. Using MySQL Enterprise
  256. Installation
  257. Fixing Monitoring Agent Problems
  258. Monitoring
  259. Query Analyzer
  260. Further Information
  261. Conclusion
  262. Part III. High Availability Environments
  263. 14. Cloud Computing Solutions
  264. What Is Cloud Computing?
  265. Cloud Architectures
  266. Is Cloud Computing an Economical Choice?
  267. Cloud Computing Use Cases
  268. Cloud Computing Benefits
  269. Cloud Computing Vendors
  270. AWS
  271. A Brief Overview of Technologies
  272. How Does It All Work?
  273. Amazon Cloud Tools
  274. Getting Started
  275. Working with Disk
  276. Where to Go from Here
  277. MySQL in the Cloud
  278. MySQL Replication and EC2
  279. Best Practices for Using MySQL in EC2
  280. Open Source Cloud Computing
  281. Conclusion
  282. 15. MySQL Cluster
  283. What Is MySQL Cluster?
  284. Terminology and Components
  285. How Does MySQL Cluster Differ from MySQL?
  286. Typical Configuration
  287. Features of MySQL Cluster
  288. Local and Global Redundancy
  289. Log Handling
  290. Redundancy and Distributed Data
  291. Architecture of MySQL Cluster
  292. How Data Is Stored
  293. Partitioning
  294. Transaction Management
  295. Online Operations
  296. Example Configuration
  297. Getting Started
  298. Starting a MySQL Cluster
  299. Testing the Cluster
  300. Shutting Down the Cluster
  301. Achieving High Availability
  302. System Recovery
  303. Node Recovery
  304. Replication
  305. Achieving High Performance
  306. Considerations for High Performance
  307. High Performance Best Practices
  308. Conclusion
  309. Appendix: Replication Tips and Tricks
  310. Index
书名:高可用性MySQL(影印版)
译者:Mark Callaghan 序
国内出版社:东南大学出版社
出版时间:2011年03月
页数:598
书号:978-7-5641-2525-7
原版书书名:MySQL High Availability
原版书出版商:O'Reilly Media
Charles Bell
 
Dr. Charles Bell is a senior software engineer at Oracle. He is currently the lead developer
for backup and a member of the MySQL Backup and Replication team. He lives
in a small town in rural Virginia with his loving wife. He received his Doctor of Philosophy
in Engineering from Virginia Commonwealth University in 2005. His research
interests include database systems, versioning systems, semantic web, and agile software
development.
 
 
Mats Kindahl
 
Dr. Mats Kindahl is a senior software developer working on the MySQL server. He is
the main architect and implementor of MySQL’s row-based replication and is responsible
for strategic development of replication, reengineering, and the plug-in architecture.
Before starting at MySQL, he did research in formal methods, program analysis,
and distributed systems, the area where he earned his doctoral degree in computer
science. He has also spent many years developing C/C++ compilers and knows more
programming languages than he has fingers.
 
 
Lars Thalmann
 
Dr. Lars Thalmann is the development manager for MySQL replication and backup.
He is responsible for the strategy and development of these features and leads the corresponding
engineering teams. Thalmann has worked with MySQL development since
2001, when he was a software developer working on MySQL Cluster. More recently,
he has driven the creation and development of the MySQL Enterprise Backup feature,
has guided the evolution of MySQL replication since 2004, and has been a key player
in the development of MySQL Cluster replication. Thalmann holds a doctorate in
Computer Science from Uppsala University, Sweden.
 
 
The animal on the cover of MySQL High Availability is an American robin (Turdus
migratorius). Instantly recognizable by its distinctive appearance—dark head, reddishorange
breast, and brown back—this member of the thrush family is among the most
common American birds. (Though it shares its name with the European robin, which
also has a reddish breast, the two species are not closely related.)
The American robin inhabits a range of six million square miles in North America and
is resident year-round through much of the United States. Commonly considered a
harbinger of spring, robins are early to sing in the morning and among the last birds
singing at night. Their diets consist of invertebrates (often earthworms) and fruit and
berries. Robins favor open ground and short grass, so they are frequent backyard visitors,
and they are often found in parks, in gardens, and on lawns.