MySQL MHA测试之感
从Oracle慢慢接触MySQL之后,最近一段时间对MySQL的高可用架构进行研究。 偶然间看到MHA+MySQL组合,狂搜索了下相关文章阅读,在主从自动切换上评价还算可以,打算在自己测试一下。 首先,看一下我话的MHA+MySQL组合架构图 基本与MMM相同。 测试之前我想过两
从Oracle慢慢接触MySQL之后,最近一段时间对MySQL的高可用架构进行研究。
偶然间看到MHA+MySQL组合,狂搜索了下相关文章阅读,在主从自动切换上评价还算可以,打算在自己测试一下。
首先,看一下我话的MHA+MySQL组合架构图
基本与MMM相同。
测试之前我想过两个问题:
1)在主从切换之后应用如何访问new master?
2)一台MHA Manager服务器上能否监控多组MySQL主从架构?
部署安装都不太难,看文档就可以搞定,这里也不列出。
我搞了个两组MySQL主从架构,每组三台机器:Master-Premary、Master-Standby、Slave。
另外一台MHA Manger。
测试基本顺利,也了解了MHA工作机制。
总结一下:
1)MHA只负责主从Failover,它没有一个固定的接口提供给应用端,所以在现实环境中,还是需要Keepalived等工具来提供VIP;
2)单台MHA Manager服务器上无法监控多组MySQL主从,会提示冲突;
3)MHA Failover时间非常快,也较稳定;
4)MHA Failover时候会将Master-Standby也就是New Master给reset slave处理,所以后期需要手动恢复。
我需要的答案基本都得到了,前面提到的两个问题答案并不很完美,所以暂时没考虑应用到公司生产环境上。
原文地址:MySQL MHA测试之感, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

The amount of memory required for an Oracle database depends on the database size, workload type, and number of concurrent users. General recommendations: Small databases: 16-32 GB, Medium databases: 32-64 GB, Large databases: 64 GB or more. Other factors to consider include database version, memory optimization options, virtualization, and best practices (monitor memory usage, adjust allocations).
