Mysql Scalability(1)Master - Slave
1. Master - Slave Concept
Steps During Replica
#1 Master update the binary log events
#2 Slave copy Master binary log events to relay log
#3 Slave execute the relay log
I will have 1 master ubuntu-master, 1 slave ubuntu-client1.
2. Install Mysql
>sudo apt-get install software-properties-common
>sudo add-apt-repository ppa:ondrej/mysql-5.6
>sudo apt-get update
>sudo apt-get install mysql-server
3. Change the Configuration
>cd /etc/mysql
>sudo vi my.cnf
For Master
#Comments the line bind-address
#bind-address = 127.0.0.1
#Configure the the server-id and log file directory
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
For Slave
server-id = 11
#this is optional, if the slave is not master of other slaves, we do not need to open log_bin
log_bin = /var/log/mysql/mysql-bin.log
#bind-address = 127.0.0.1
Restart the Mysql Server
>sudo /etc/init.d/mysql restart
Start to Run
Login on to master as root
>use mysql;
>grant replication slave on *.* to 'masterslave'@'ubuntu-client1' identified by ‘111111';
>show master status;
+------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | mysql-bin.000001 | 561 | | | | +------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec)
The number 561 and mysql-bin.000001 are important and it will be used later.
Login on to slave as root
>use mysql;
>change master to master_host='ubuntu-master', master_user='masterslave', master_password='kaishi', master_log_file='mysql-bin.000001', master_log_pos=561;
>start slave;
>show slave status\G;
Here is the status
Master_Log_File: mysql-bin.000002 Read_Master_Log_Pos: 120 Relay_Log_File: mysqld-relay-bin.000005 Relay_Log_Pos: 283 Relay_Master_Log_File: mysql-bin.000002 Slave_IO_Running: Yes Slave_SQL_Running: Yes
The most import part is Slave_IO_Running:Yes, Slave_SQL_Running:Yes. Ok, that means the master slave is running fine.
4. Verify the Installation
Create schema on Master
>create database sillycat;
>use sillycat;
Create table and Insert Data
>create table branduser(id int primary key, username char(255), age int);
>insert into branduser(id, username, age) values ( 1, "sillycat", 32);
Logon on to the slave mysql, My data is already there
>use sillycat;
>select * from branduser;
References:
http://xuwensong.elastos.org/2014/01/07/ubuntu-%E4%B8%8B-mysql-%E4%B8%BB%E4%BB%8E%E5%A4%8D%E5%88%B6%E5%8F%8Amysql-proxy-%E8%AF%BB%E5%86%99%E5%88%86%E7%A6%BB/
http://blog.csdn.net/hguisu/article/details/7325124
http://heylinux.com/archives/1004.html
ubuntu set up
http://sillycat.iteye.com/blog/2090147
- 浏览: 2566814 次
- 性别:
- 来自: 成都
-
最新评论
-
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
相关推荐
1. Canal 模拟 MySQL 的 slave 的交互协议,伪装成 mysql slave,并将转发协议发送到 MySQL Master 服务器。 2. MySQL Master 接收到转储请求并开始将二进制日志推送到 slave(即 canal)。 3. Canal 将二进制日志...
2. **Master-Master-Slave (MMS) 架构**:在此基础上增加一个或多个只读节点,主要用于查询操作,进一步提高系统的读取性能。 3. **Ring Replication 架构**:通过环形结构连接多个数据库节点,每个节点都既是其他...
and data loss, and provides linear scalability for a growing environment. Features of Percona XtraDB Cluster include: • Synchronous replication: Data is written to all nodes simultaneously, or not ...
55links友情链接网址跟踪器,放在桌面,每次直接打开就可以访问55links友情链接交易平台,方便快捷。
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
moore_01_0909
FIBR English learning
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
OIF_IEEE802.3_liaison_19OCt09
做网络安全FTP内容的实验必备
nagarajan_01_1107
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
mellitz_3cd_01_0318
PyQt6实战派 配套代码
陕西省省级非物质文化遗产经纬度数据统计表 统计内容包含以下字段: 1. 项目名称 2. 遗产类别 3. 入选批次 4. 所属地区 5. 申报地区/单位 6. 地理经度 7. 地理纬度 该统计表系统记录了陕西省省级非物质文化遗产的地理空间信息,为文化遗产的数字化保护与研究工作提供了重要的数据支撑。
ran_3ck_02a_0918
毕业设计_基于springboot+vue开发的汽车租赁管理系统【源码+sql+可运行】【50308】.zip 全部代码均可运行,亲测可用,尽我所能,为你服务; 1.代码压缩包内容 代码:springboo后端代码+vue前端页面代码; 脚本:数据库SQL脚本 效果图:运行结果请看资源详情效果图 2.环境准备: - JDK1.8+ - maven3.6+ - nodejs14+ - mysql5.6+ - redis 3.技术栈 - 后台:springboot+mybatisPlus+Shiro - 前台:vue+iview+Vuex+Axios - 开发工具: idea、navicate 4.功能列表 - 系统设置:用户管理、角色管理、资源管理、系统日志 - 业务管理:汽车管理、客户管理、租赁订单 3.运行步骤: 步骤一:修改数据库连接信息(ip、port修改) 步骤二:找到启动类xxxApplication启动 4.若不会,可私信博主!!!
# Runcorder - 跑步训练管理系统 Runcorder 是一款专为跑步爱好者、马拉松运动员及高校体育生设计的本地化跑步训练管理工具,基于 Python 开发,结合 Tkinter 图形界面与强大的数据处理能力,为用户提供从训练记录到数据分析的全方位支持。无论是初学者还是专业跑者,Runcorder 都能帮助你科学规划训练、精准追踪进度,并通过可视化图表直观呈现训练成果,让你的跑步训练更智能、更高效! - **多用户管理**:支持创建、加载和删除用户档案,每个用户的数据独立存储,确保隐私与安全。 - **科学训练记录**:全维度记录跑步数据,包括日期、里程、配速、自评和晨跑标记,支持智能输入校验,避免数据错误。 - **多维数据分析**:通过动态可视化图表展示跑步里程趋势、平均配速曲线,支持自定义 Y 轴范围,帮助用户深入理解训练效果。 - **高阶功能**:提供 4 种科学训练模式(有氧/无氧/混合),支持历史记录修改与删除,数据以 JSON 格式持久化存储,跨平台兼容。
paatzsch_01_0708
AnythingLLM是一个全栈应用程序,您可以使用流行的开源大语言模型,再结合向量数据库解决方案构建个人本地AI大模型知识库