1、准备两台服务器  centos7

192.168.52.35

192.168.52.36

2、关闭防火墙

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce

3、两台都下载mysql

yum -y install mariadb mariadb-server

4、编辑MySQL配置文件

第一台:

[root@localhost ~]# vim /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd server-id= #添加
log-bin=mysql-bin #添加
relay-log=mysql-relay #添加

第二台:

[root@localhost ~]# vim /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd server-id= #添加
log-bin=mysql-bin #添加
relay-log=mysql-relay #添加

5、开启mysql服务

systemctl restart mariadb

6、进入第一台主的服务器

[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is
Server version: 5.5.-MariaDB MariaDB Server Copyright (c) , , Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create user tom;
Query OK, rows affected (0.00 sec) MariaDB [(none)]> grant all on *.* to'tom'@'192.168.52.36' identified by '';
Query OK, rows affected (0.00 sec) MariaDB [(none)]> flush privileges;
Query OK, rows affected (0.00 sec) MariaDB [(none)]> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin. | | | |
+------------------+----------+--------------+------------------+
row in set (0.00 sec) MariaDB [(none)]>

打开第二台的mysql

[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is
Server version: 5.5.-MariaDB MariaDB Server Copyright (c) , , Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> stop slave;
Query OK, rows affected, warning (0.00 sec) MariaDB [(none)]> change master to
-> master_host='192.168.52.35',
-> master_password='',
-> master_user='tom',
-> master_log_file='mysql-bin.000003',
-> master_log_pos=;
Query OK, rows affected (0.01 sec) MariaDB [(none)]> flush privileges;
Query OK, rows affected (0.00 sec) MariaDB [(none)]> start slave;
Query OK, rows affected (0.00 sec)

Slave_IO_Running: Yes    #这俩个要变成yes才算成功
Slave_SQL_Running: Yes

MySQL基于 amoeba.xml的读写分离的更多相关文章

  1. 从零开始:Mysql基于Amoeba的集群搭建

    从零开始:Mysql基于Amoeba的集群搭建 准备环境 1.mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz 2.amoeba-mysql-binary-2.0. ...

  2. 分布式架构高可用架构篇_08_MyCat在MySQL主从复制基础上实现读写分离

    参考: 龙果学院http://www.roncoo.com/share.html?hamc=hLPG8QsaaWVOl2Z76wpJHp3JBbZZF%2Bywm5vEfPp9LbLkAjAnB%2B ...

  3. 高可用架构篇--MyCat在MySQL主从复制基础上实现读写分离

    实战操作可参考:http://www.roncoo.com/course/view/3117ffd4c74b4a51a998f9276740dcfb 一.环境 操作系统:CentOS-6.6-x86_ ...

  4. Mysql多实例安装+主从复制+读写分离 -学习笔记

    Mysql多实例安装+主从复制+读写分离 -学习笔记 .embody{ padding:10px 10px 10px; margin:0 -20px; border-bottom:solid 1px ...

  5. Mysql主从配置,实现读写分离

    大型网站为了软解大量的并发访问,除了在网站实现分布式负载均衡,远远不够.到了数据业务层.数据访问层,如果还是传统的数据结构,或者只是单单靠一台服务器扛,如此多的数据库连接操作,数据库必然会崩溃,数据丢 ...

  6. 黄聪:Mysql主从配置,实现读写分离

    大型网站为了软解大量的并发访问,除了在网站实现分布式负载均衡,远远不够.到了数据业务层.数据访问层,如果还是传统的数据结构,或者只是单单靠一台服务器扛,如此多的数据库连接操作,数据库必然会崩溃,数据丢 ...

  7. Mysql 之主从复制,mysql-proxy读写分离

    准备两台mysql服务器,master(192.168.43.64).slave(192.168.84.129) master配置: log-bin=mysql-bin binlog_format=m ...

  8. Mysql 基于 Amoeba 的 读写分离

    首先说明一下amoeba 跟 MySQL proxy在读写分离的使用上面的区别: 在MySQL proxy 6.0版本 上面如果想要读写分离并且 读集群.写集群 机器比较多情况下,用mysql pro ...

  9. linux上使用amoeba实现MySql集群,以及读写分离,主从复制

    一.由于是MySql集群,所以就不可能只有一个MySql,需要多个MySql,具体安装步骤,可以参考http://www.cnblogs.com/ywzq/p/4882140.html这个地址进行安装 ...

随机推荐

  1. lower_case_table_names与表格名称大小写的问题

    1 简介 在MySQL中,数据库对应数据目录中的目录.数据库中的每个表至少对应数据库目录中的一个文件(也可能是多个,取决于存储引擎).因此,所使用操作系统的大小写敏感性决定了数据库名和表名的大小写敏感 ...

  2. hbase 查看元数据

    package com.jason.lala.pipe.dbinfo import com.jason.lala.common.query.option.HbaseOptions import org ...

  3. Hbase flusher源码解析(flush全代码流程解析)

    版权声明:本文为博主原创文章,遵循版权协议,转载请附上原文出处链接和本声明. 在介绍HBASE flush源码之前,我们先在逻辑上大体梳理一下,便于后续看代码.flush的整体流程分三个阶段 1.第一 ...

  4. centos7.x下环境搭建(三)—nodejs安装

    有3种方式可以安装nodejs yum安装 源码包安装 nvm方式安装 一.方式1:yum安装 这里我们指定安装8.x以上的版本 # curl --silent --location https:// ...

  5. 干货满满!如何优雅简洁地实现时钟翻牌器(支持JS/Vue/React)

    双十一剁手节过去了,大家应该在很多网页中看到了数字翻牌的效果吧,比如倒计时. 数字增长等.相信很多人都已经自己独立实现过了,我也在网上看了一些demo,发现HTML结构大多比较复杂,用了4个并列的标签 ...

  6. FileChannel(API详解)

    1.两种获取通道的方法FileChannel.open()的方式 FileChannel channell = FileChannel.open(Paths.get("a.txt" ...

  7. win10系统本地iis或nginx服务器部署vue.js项目

    1.前端框架一般依赖node.js,我们首先要安装node.js.请参考: http://www.cnblogs.com/wuac/p/6381819.html to:安装好node.js后npm也安 ...

  8. c# winform devexpress TreeList过滤和绑定

    /// <summary> /// 模糊查询 /// </summary> /// <param name="str"></param&g ...

  9. Message "'OFFSET' 附近有语法错误。\r\n在 FETCH 语句中选项 NEXT 的用法无效。" 解决办法 EntityFrameworkCore

    由于新版的EntityFrameworkCore默认使用的是SqlServer2012或以上版本的Sql语法分页,来提高性能. 所以使用数据库的版本如果低于2012(如Sqlserver2008)需要 ...

  10. python——CSV转Excel

    在转换之前,事先需要将csv文件另存为此格式 import pandas as pd def csv_to_xlsx_pd(): csv = pd.read_csv(r'C:\Users\Jery\D ...