MySQL-MMM的负载均衡及高可用
用途mmm是基于信息探测方式进行mysql主从复制架构的监测与故障转移mmm可以做到负载均衡,100%的数据可用性mmm所涉及的检查项服务器可达性,服务可达性,复制线程可
用途
mmm是基于信息探测方式进行mysql主从复制架构的监测与故障转移
mmm可以做到负载均衡,100%的数据可用性
mmm所涉及的检查项 服务器可达性,服务可达性,复制线程可控性
如图: 当 master1在宕机时, mmm可以将之前分摊的流量进行转移,甚至于将从服务器提升为主
延续双主模型.
mmm-agent端状态一览
online 节点可用
replication_delay 复制延迟或无法进行(检查req_backlog文件)
replication_fail 复制失败
awating_recovery 等待恢复
hard_offline 主机离线
admin_offline 主控端离线
unknown 未知错误
规划如下
172.16.43.200 主控机器负责监测与资源的管理
172.16.43.1 vip(172.16.43.11) master1 主主复制第一台(可读写)
172.16.43.2 vip(172.16.43.12) master2 主主复制第二台(只读)
172.16.43.3 vip(172.16.43.13) slave 主从方式复制 1 , 2 的信息(只读)
实验过程如下
主控安装安装: ansible, mysql客户端, mysql-mmm
集群节点安装如下: mariadb, mysql-agent
i) 主机互信,ansible部署的关键
yum -y install ansible-1.5.4-1.el6.noarch.rpm vim /etc/ansible/hosts # 主控节点完成 [masterserver] master1.king.com master2.king.com . [slaveserver] slave.king.com # 主控节点完成互信多个被管理节点不重复了 ssh-keygen -t rsa ssh-copy-id -i .ssh/id_rsa.pub root@slave.king.com . # 主控节点完成安装mysql-mmm* yum -y install mysql mysql-mmm* . # 实现mmm配置文件有两种 # 1. 主控端 mmm_common, mmm_mon # 2. 集群端 mmm_common, mmm_agent # 主控端配置common /etc/mysql-mmm/mmm_common.conf active_master_role writer .ii) 安装 mariadb, mysql-agent安装与配置
不熟yaml的童鞋可以 yaml.org

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

Big data structure processing skills: Chunking: Break down the data set and process it in chunks to reduce memory consumption. Generator: Generate data items one by one without loading the entire data set, suitable for unlimited data sets. Streaming: Read files or query results line by line, suitable for large files or remote data. External storage: For very large data sets, store the data in a database or NoSQL.

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.

Load balancing strategies are crucial in Java frameworks for efficient distribution of requests. Depending on the concurrency situation, different strategies have different performance: Polling method: stable performance under low concurrency. Weighted polling method: The performance is similar to the polling method under low concurrency. Least number of connections method: best performance under high concurrency. Random method: simple but poor performance. Consistent Hashing: Balancing server load. Combined with practical cases, this article explains how to choose appropriate strategies based on performance data to significantly improve application performance.

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.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.
