- 浏览: 2539367 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
MySQL HA Solution 2019(1)Master Slave on MySQL 5.7
Prepare machines ubuntu-master, ubuntu-dev5, ubuntu-dev6
Install MySQL with right version
> sudo apt-get update
> sudo apt-get dist-upgrade
> sudo apt install mysql-server
> sudo apt install mysql-client
In the new version, we need to find the root password from here
> sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = ddHulNSEFzhUFvS1
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = ddHulNSEFzhUFvS1
socket = /var/run/mysqld/mysqld.sock
Login in these server with commands
> mysql -u debian-sys-maint -pddHulNSEFzhUFvS1
Set Up Master and Slave
On Master
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
Comments out bind-address
# bind-address = 127.0.0.1
Config the server-id and log file directory
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
On Slave ubuntu-dev5
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
server-id = 11
#bind-address = 127.0.0.1
On Slave ubuntu-dev6
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
server-id = 12
#bind-address = 127.0.0.1
Restart Master and Slaves
> sudo /etc/init.d/mysql restart
Login on ubuntu-master and set up
> mysql> use mysql;
> grant replication slave on *.* to 'masterslave'@'ubuntu-dev5' identified by '111111';
> grant replication slave on *.* to 'masterslave'@'ubuntu-dev6' identified by '111111';
Show the master status
> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 788 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
The information 788 and mysql-bin.000001 are important and it will be used later.
On Slave ubuntu-dev5
> use mysql;
> change master to master_host='ubuntu-master', master_user='masterslave', master_password='111111', master_log_file='mysql-bin.000001', master_log_pos=788;
> start slave;
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: ubuntu-master
Master_User: masterslave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 788
Relay_Log_File: ubuntu-dev5-relay-bin.000002
Relay_Log_Pos: 320
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Do the same on ubuntu-dev6
Verify the Installation
On master
> create database sillycat;
> use sillycat;
> create table branduser(id int primary key, username char(255), age int);
> insert into branduser(id, username, age) values ( 1, "sillycat", 32);
On slave
> use sillycat;
> select * from branduser;
+----+----------+------+
| id | username | age |
+----+----------+------+
| 1 | sillycat | 32 |
+----+----------+------+
1 row in set (0.00 sec)
References:
https://my.oschina.net/goudingcheng/blog/608490
https://www.cnblogs.com/gl-developer/p/6178608.html
https://blog.csdn.net/kobejayandy/article/details/60869530
https://blog.51cto.com/10316297/2139138
MyCat
https://blog.csdn.net/linuxlsq/article/details/52606225
https://blog.csdn.net/nxw_tsp/article/details/56277430
https://github.com/MyCATApache/Mycat-Server
https://hokkaitao.github.io/new-tool-to-solve-mysql-scalability-problems
Max
http://www.chinastor.com/yw/09263494H016.html
https://www.cnblogs.com/darren-lee/p/7591416.html
proxySQL
https://blog.51cto.com/sumongodb/2130453
https://www.cnblogs.com/zhoujinyi/p/6838685.html
https://github.com/sysown/proxysql
https://proxysql.com/
Prepare machines ubuntu-master, ubuntu-dev5, ubuntu-dev6
Install MySQL with right version
> sudo apt-get update
> sudo apt-get dist-upgrade
> sudo apt install mysql-server
> sudo apt install mysql-client
In the new version, we need to find the root password from here
> sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = ddHulNSEFzhUFvS1
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = ddHulNSEFzhUFvS1
socket = /var/run/mysqld/mysqld.sock
Login in these server with commands
> mysql -u debian-sys-maint -pddHulNSEFzhUFvS1
Set Up Master and Slave
On Master
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
Comments out bind-address
# bind-address = 127.0.0.1
Config the server-id and log file directory
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
On Slave ubuntu-dev5
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
server-id = 11
#bind-address = 127.0.0.1
On Slave ubuntu-dev6
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
server-id = 12
#bind-address = 127.0.0.1
Restart Master and Slaves
> sudo /etc/init.d/mysql restart
Login on ubuntu-master and set up
> mysql> use mysql;
> grant replication slave on *.* to 'masterslave'@'ubuntu-dev5' identified by '111111';
> grant replication slave on *.* to 'masterslave'@'ubuntu-dev6' identified by '111111';
Show the master status
> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 788 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
The information 788 and mysql-bin.000001 are important and it will be used later.
On Slave ubuntu-dev5
> use mysql;
> change master to master_host='ubuntu-master', master_user='masterslave', master_password='111111', master_log_file='mysql-bin.000001', master_log_pos=788;
> start slave;
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: ubuntu-master
Master_User: masterslave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 788
Relay_Log_File: ubuntu-dev5-relay-bin.000002
Relay_Log_Pos: 320
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Do the same on ubuntu-dev6
Verify the Installation
On master
> create database sillycat;
> use sillycat;
> create table branduser(id int primary key, username char(255), age int);
> insert into branduser(id, username, age) values ( 1, "sillycat", 32);
On slave
> use sillycat;
> select * from branduser;
+----+----------+------+
| id | username | age |
+----+----------+------+
| 1 | sillycat | 32 |
+----+----------+------+
1 row in set (0.00 sec)
References:
https://my.oschina.net/goudingcheng/blog/608490
https://www.cnblogs.com/gl-developer/p/6178608.html
https://blog.csdn.net/kobejayandy/article/details/60869530
https://blog.51cto.com/10316297/2139138
MyCat
https://blog.csdn.net/linuxlsq/article/details/52606225
https://blog.csdn.net/nxw_tsp/article/details/56277430
https://github.com/MyCATApache/Mycat-Server
https://hokkaitao.github.io/new-tool-to-solve-mysql-scalability-problems
Max
http://www.chinastor.com/yw/09263494H016.html
https://www.cnblogs.com/darren-lee/p/7591416.html
proxySQL
https://blog.51cto.com/sumongodb/2130453
https://www.cnblogs.com/zhoujinyi/p/6838685.html
https://github.com/sysown/proxysql
https://proxysql.com/
发表评论
-
Update Site will come soon
2021-06-02 04:10 1672I am still keep notes my tech n ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 287Hadoop Docker 2019 Version 3.2. ... -
Nginx and Proxy 2019(1)Nginx Enable Lua and Parse JSON
2019-12-03 04:17 437Nginx and Proxy 2019(1)Nginx En ... -
Data Solution 2019(13)Docker Zeppelin Notebook and Memory Configuration
2019-11-09 07:15 279Data Solution 2019(13)Docker Ze ... -
Data Solution 2019(10)Spark Cluster Solution with Zeppelin
2019-10-29 08:37 243Data Solution 2019(10)Spark Clu ... -
AMAZON Kinesis Firehose 2019(1)Firehose Buffer to S3
2019-10-01 10:15 313AMAZON Kinesis Firehose 2019(1) ... -
Rancher and k8s 2019(3)Clean Installation on CentOS7
2019-09-19 23:25 300Rancher and k8s 2019(3)Clean In ... -
Pacemaker 2019(1)Introduction and Installation on CentOS7
2019-09-11 05:48 333Pacemaker 2019(1)Introduction a ... -
Crontab-UI installation and Introduction
2019-08-30 05:54 441Crontab-UI installation and Int ... -
Spiderkeeper 2019(1)Installation and Introduction
2019-08-29 06:49 492Spiderkeeper 2019(1)Installatio ... -
Supervisor 2019(2)Ubuntu and Multiple Services
2019-08-19 10:53 362Supervisor 2019(2)Ubuntu and Mu ... -
Supervisor 2019(1)CentOS 7
2019-08-19 09:33 321Supervisor 2019(1)CentOS 7 Ins ... -
Redis Cluster 2019(3)Redis Cluster on CentOS
2019-08-17 04:07 365Redis Cluster 2019(3)Redis Clus ... -
MySQL HA Solution 2019(4)MaxScale
2019-08-03 21:19 782MySQL HA Solution 2019(4)MaxSca ... -
Amazon Lambda and Version Limit
2019-08-02 01:42 430Amazon Lambda and Version Limit ... -
MySQL HA Solution 2019(3)MyCat
2019-07-30 11:45 365MySQL HA Solution 2019(3)MyCat ... -
MySQL HA Solution 2019(2)ProxySQL
2019-07-29 09:39 481MySQL HA Solution 2019(2)ProxyS ... -
RabbitMQ Cluster 2019(2)Cluster HA and Proxy
2019-07-11 12:41 455RabbitMQ Cluster 2019(2)Cluster ... -
Zeppelin and Spark Library Dependency
2019-07-09 03:20 454Zeppelin and Spark Library Depe ... -
Running Zeppelin with Nginx Authentication
2019-05-25 21:35 315Running Zeppelin with Nginx Aut ...
相关推荐
MySQL的Master-Slave架构是一种常见的数据库高可用性和负载均衡解决方案。它允许数据从一个主服务器(Master)实时同步到一个或多个从服务器(Slave)。在这种架构中,所有的写操作都在主服务器上执行,而从服务器则...
MySQL 5.7 主从配置是指在两个或多个 MySQL 服务器之间实现数据的实时同步复制,主服务器作为数据的写入入口,slave 服务器作为数据的读取入口。这种配置可以提高数据库的高可用性和读取性能。 1. 主从配置前提 ...
在现代企业级应用中,为了确保数据的高度可用性和容灾能力,通常会采用MySQL的主从复制(Master-Slave Replication)机制来实现数据的同步。MySQL 5.7作为一款功能强大的关系型数据库管理系统,在数据同步方面提供了...
在提供的文件中,我们有一个名为`mysql-5.7.36-1.el7.x86_64.rpm-bundle.tar`的压缩包,它包含了所有必要的RPM文件。你需要解压这个文件,可以使用以下命令: ```bash tar -xvf mysql-5.7.36-1.el7.x86_64.rpm-...
1、写操作全部在Master结点执行,并由Slave数据库结点定时(默认60s)读取Master的bin-log 2、将众多的用户读请求分散到更多的数据库节点,从而减轻了单点的压力 这是对Replication的最基本陈述,这种模式的在系统...
│ mysql-slave1_05-18_10-03-14.log │ mysql-slave2_05-18_10-03-20.log │ ├─新版MySQL DBA综合实战班 第15天 │ │ 1_课后作业讲解.mp4 │ │ 2_MySQL索引原理介绍.mp4 │ │ 3_MySQL索引类型介绍.mp4 │ │ ...
1. 关于MySQL 5.7 OCP认证和1z0-888考试:MySQL 5.7 OCP(Oracle认证专业人员)是一项针对数据库管理员的技术认证。1z0-888是对应于MySQL 5.7数据库管理员的官方认证考试代码,由Oracle公司推出,主要考察考生对于...
1. **GTID(Global Transaction Identifier)全局事务标识符**:MySQL 5.7默认启用GTID模式,每个事务都有一个全局唯一的ID,这使得跟踪和管理复制变得更为简单。GTID消除了基于位置的日志文件偏移量的复杂性,提高...
- 在管理节点上包含的工具包括:masterha_check_ssh、masterha_check_repl、masterha_manager、masterha_check_status、masterha_master_monitor、masterha_master_switch、masterha_conf_host等,这些工具用于检查...
MySQL的主从复制是数据库高可用性和数据冗余的一种常见实现方式,它允许数据从一个服务器(主服务器)同步到一个或多个其他服务器(从服务器)。这种架构在处理大量读取操作、提供故障切换能力以及分布式系统中尤其...
MySQL 5.7主从复制是数据库高可用性和负载均衡的一种常见实现方式,它通过将主数据库(Master)上的写操作同步到一个或多个从数据库(Slave)来实现数据的冗余备份和读写分离。在Java开发中,MySQL主从复制常常用于...
### MySQL 5.7 新增功能详解 #### 一、概览 MySQL 5.7 是 MySQL 数据库管理系统的一个重要版本,它引入了一系列新的特性和改进,这些特性旨在提高数据库性能、增强数据处理能力以及提升数据库管理的便利性。本文将...
MySQL Master Slave 集群构架和spring整合,里面实现的是动态切换数据源,大家都是知道,spring2之后添加AbstractRoutingDataSource这个东西,这个就可以实现切换数据源,实现思路是:先按照搭建MySQL的MasterSlave...
MySQL 5.7 主从复制集群配置 MySQL 5.7 主从复制集群是 MySQL 的一种高可用性解决方案,通过将数据实时同步到多个服务器上来提高数据库的可用性和可靠性。下面是 MySQL 5.7 主从复制集群配置的详细步骤和注意事项。...
MySQL 5.7 Percona Server 是一个针对 MySQL 数据库服务器的增强版本,旨在提供更高效、更稳定且功能丰富的数据库管理解决方案。Percona 公司是 MySQL 社区的重要贡献者,他们对 MySQL 进行了优化,尤其注重在高并发...
在MySQL 5.7版本中,主从复制机制得到了优化和增强,使得复制更加稳定和高效。在准备进行MySQL主从复制配置之前,需要先完成MySQL的二进制安装,为数据库服务器准备相应的运行环境。 二进制安装包括创建MySQL用户组...
本文将详细介绍如何通过MySQL 5.7和Keepalived构建一个双主(Master-Master)加一个从库(Slave)的高可用集群,以实现故障自动转移(Failover)功能,并提高系统的整体稳定性和可靠性。 #### 二、环境准备 **硬件...