MySQL 5.5.40实现一主多从 One-Master muil-slave
我们知道 MySQL读和写在性能方面的开销区别是较大的,一般来说 服务器顶着20%写的压力,另外80%的压力来自读,当然这也得看实际业
我们知道 MySQL读和写在性能方面的开销区别是较大的,,一般来说 服务器顶着20%写的压力,另外80%的压力来自读,当然这也得看实际业务情况。
这篇文章准备配置一主三从,其实多少从没什么关系,一主多从其实是一主一从的延伸,因为从库之间是没有任何通信的,具体使用哪种方式看带宽负载和具体流量。
MySQL的主从replication原理其实就是Master不断地写二进制日志,Slave去读取日志,按照里面的SQL记录去执行!如下图:
Ubuntu下Nginx做负载实现高性能WEB服务器5---MySQL主主同步
生产环境MySQL主主同步主键冲突处理
MySQL主从失败 错误Got fatal error 1236
MySQL主从复制,单台服务器上实施
搭建MySQL代理服务器实现读写分离+主从同步
MySQL 5.5 主从双向同步
MySQL 5.5主从同步排错
MySQL主从复制异步半同步实例
MySQL主从配置是与生俱来的功能,只需做简单配置即可,好了,废话少说,开始吧!
我的环境是这样,四台机器都在Vmware上,都使用桥接,用dhcp直接获取动态IP
Master:192.168.83.61
Slave1:192.168.83.87
Slave2:192.168.83.88
Slave3:192.168.83.89
四台机器的MySQL版本都是MySQL 5.5.40
第一,配置Master
vi /etc/my.cnf
server-id = 61
log-bin=mysql-bin
binlog-do-db=test //需要同步的数据库
binlog-ignore-db=mysql //被忽略的数据库
binlog-ignore-db=information-schema //被忽略的数据库
在master上为三台slave添加一个同步账号
mysql> grant replication slave1 on *.* to 'slave1'@'192.168.83.87' identified by 'slave1';
//在slave1上登陆成功
mysql> grant replication slave on *.* to 'slave2'@'192.168.83.88' identified by 'slave2';
//在slave2上登陆成功
mysql> grant replication slave on *.* to 'slave3'@'192.168.83.89' identified by 'slave3'; <p>//在slave3上登陆成功</p> <p>保存后重启Mysql服务</p> <p>service mysqld restart</p> <p>然后在mysql命令行模式下用</p> <p>mysql> show master status\G;</p> <p>*************************** 1. row ***************************<br>File: mysql-bin.000001<br>Position: 106<br>Binlog_Do_DB: test<br>Binlog_Ignore_DB: mysql,information-schema<br>1 row in set (0.00 sec)</p> <p>更多详情见请继续阅读下一页的精彩内容: </p><p align="center"><img src="/static/imghw/default1.png" data-src="/linuxfile/logo.gif" class="lazy" alt="linux"></p>

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



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)
