`
sillycat
  • 浏览: 2553019 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Mysql Scalability(1)Master - Slave

 
阅读更多

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

分享到:
评论

相关推荐

    Designing for Scalability with Erlang-OTP.pdf

    Designing for Scalability with Erlang-OTP.pdf Designing for Scalability with Erlang-OTP.pdf Designing for Scalability with Erlang-OTP.pdf

    Overview of fine granularity scalability in MPEG-4 video standard

    1. **比特平面编码(Bitplane Coding)**:FGS的核心在于比特平面编码技术的应用。比特平面编码是一种逐层编码的方法,可以将视频信号分解成多个比特平面,每个比特平面代表一个特定的质量级别。这种方式使得接收端...

    Bit-Rate-Scalability-in-Audio-Coding

    1. **层次编码**:音频编码器可以生成不同质量层次的编码数据,每一层都包含前一层的所有信息。用户可以根据可用带宽选择接收哪个层次的数据,从而实现比特率的动态调整。 2. **分块编码**:音频信号被分割成多个块...

    Robustness Communication Software -- Extreme Availability, Reliability and Scalability for Carrier-Grade System

    综上所述,《Robustness Communication Software -- Extreme Availability, Reliability and Scalability for Carrier-Grade System》这本书提供了关于如何设计高性能、高可靠性、高可用性以及高伸缩性的电信级系统...

    mysql-ref-5.6-en.pdf

    - **HA/Scalability Guide**:提供了关于如何构建高可用和可扩展MySQL架构的指南。 - **备份与恢复**:介绍了备份策略和恢复流程,确保数据的安全性和可靠性。 - **虚拟化**:讨论了MySQL在虚拟化环境中的部署和管理...

    Java Performance and Scalability(Server-Side Programming Techniques)

    学习java性能调优的好书,国外专家写的,很不错

    mysql5.0参考手册-english

    根据提供的文件信息,我们可以从多个角度来探讨与MySQL 5.0相关的知识点。以下是对这些知识点的详细解析: ### MySQL 5.0 参考手册概述 #### 1. **MySQL 5.0版本覆盖范围** - **版本详情**:此手册涵盖了MySQL ...

    MySQL 8 Administrator's Guide

    Your companion to master all the administration-related tasks in MySQL 8 Ensure high performance and high availability of your MySQL solution using effective replication and backup techniques A ...

    django-master-class

    #### 1. Unit Testing (Simon Willison) **Introduction:** Unit testing is a crucial aspect of software development that ensures the reliability of individual components or functions within an ...

    mysql_refman-5.6-en.a4.pdf

    - **HA/Scalability Guide**:高可用性和可扩展性指南,讲解如何构建高可用和高性能的MySQL集群。 - **Server Administration**:服务器管理指南,涵盖服务器的安装、配置和维护等内容。 - **MySQL Yum ...

    MySQL5.5使用手册---refman-5.5-en.pdf

    #### 1. 支持的操作系统平台 MySQL 5.5 支持多种操作系统,包括 Linux/Unix、Windows 和 MacOSX。这些平台提供了广泛的兼容性,确保了数据库能够在不同的计算环境中运行。 #### 2. MySQL Workbench MySQL ...

    Scalability patterns

    - 主从复制(Master-Slave)、树状复制(Tree Replication)、双主复制(Master-Master)、伙伴复制(Buddy Replication)等都是常见的复制策略。 ### CAP定理在实践中的应用 在分布式系统中,CAP定理强调了在遇到网络...

    OSG Scalability Area Tools-开源

    1. **性能基准测试**:对OSG节点进行基准测试,以了解它们在不同工作负载下的表现。 2. **压力测试**:模拟高并发情况,检查系统的最大处理能力,找出可能的崩溃点。 3. **资源利用率监控**:跟踪CPU、内存、网络和...

    designing-for-scalability-with-erlang-otp-exercises:“Designing for Scalability with ErlangOTP”书籍练习

    使用 Erlang/OTP 设计可扩展性 - 练习 在这个存储库中,我将阅读 Francesco Cesarini 和 Steve Vinoski 所著的“Designing for scaling with Erlang and Otp”一书时编写的代码组合在一起,你可以在购买这本书。...

    mysql5.6手册英文版本

    ##### 3.4 HA/Scalability Guide - **高可用性**: 包括 MySQL Thread Pool、MySQL Partitioning 等。 - **扩展性**: 如 MySQL Proxy、MySQL and Virtualization 等。 #### 四、安全与合规 ##### 4.1 Security - ...

    mysql-installer-web-community-5.7.29.0.msi + .NET Framework 4.5.2 安装包

    MySQL + .NET Framework 4.5.2 安装包 ...MySQL Cluster enables users to meet the database challenges of next generation web, cloud, and communications services with uncompromising scalability, uptime...

    The Art of Scalability

    "Scalability Mastery" Scalability是指系统、软件或应用程序能够满足增长和变化的需求,而不影响其性能和可靠性。Scalability是一个非常重要的概念,在现代软件开发和 IT 行业中扮演着关键角色。下面是从《The Art...

    MySQL V5.5帮助文档

    1. General Information 1.1. About This Manual 1.2. Typographical and Syntax Conventions 1.3. Overview of the MySQL Database Management System 1.3.1. What is MySQL? 1.3.2. History of MySQL 1.3.3. The ...

    MySQL 5.7 Reference Manual

    - **HA/Scalability Guide**:介绍如何设置高可用性和可扩展性的 MySQL 架构。 - **Server Administration**:涵盖服务器管理的基础知识,包括安装、配置和日常维护。 - **MySQL Yum Repository**:介绍了如何使用 ...

Global site tag (gtag.js) - Google Analytics