MySQL基于 amoeba.xml的读写分离
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的读写分离的更多相关文章
- 从零开始:Mysql基于Amoeba的集群搭建
从零开始:Mysql基于Amoeba的集群搭建 准备环境 1.mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz 2.amoeba-mysql-binary-2.0. ...
- 分布式架构高可用架构篇_08_MyCat在MySQL主从复制基础上实现读写分离
参考: 龙果学院http://www.roncoo.com/share.html?hamc=hLPG8QsaaWVOl2Z76wpJHp3JBbZZF%2Bywm5vEfPp9LbLkAjAnB%2B ...
- 高可用架构篇--MyCat在MySQL主从复制基础上实现读写分离
实战操作可参考:http://www.roncoo.com/course/view/3117ffd4c74b4a51a998f9276740dcfb 一.环境 操作系统:CentOS-6.6-x86_ ...
- Mysql多实例安装+主从复制+读写分离 -学习笔记
Mysql多实例安装+主从复制+读写分离 -学习笔记 .embody{ padding:10px 10px 10px; margin:0 -20px; border-bottom:solid 1px ...
- Mysql主从配置,实现读写分离
大型网站为了软解大量的并发访问,除了在网站实现分布式负载均衡,远远不够.到了数据业务层.数据访问层,如果还是传统的数据结构,或者只是单单靠一台服务器扛,如此多的数据库连接操作,数据库必然会崩溃,数据丢 ...
- 黄聪:Mysql主从配置,实现读写分离
大型网站为了软解大量的并发访问,除了在网站实现分布式负载均衡,远远不够.到了数据业务层.数据访问层,如果还是传统的数据结构,或者只是单单靠一台服务器扛,如此多的数据库连接操作,数据库必然会崩溃,数据丢 ...
- Mysql 之主从复制,mysql-proxy读写分离
准备两台mysql服务器,master(192.168.43.64).slave(192.168.84.129) master配置: log-bin=mysql-bin binlog_format=m ...
- Mysql 基于 Amoeba 的 读写分离
首先说明一下amoeba 跟 MySQL proxy在读写分离的使用上面的区别: 在MySQL proxy 6.0版本 上面如果想要读写分离并且 读集群.写集群 机器比较多情况下,用mysql pro ...
- linux上使用amoeba实现MySql集群,以及读写分离,主从复制
一.由于是MySql集群,所以就不可能只有一个MySql,需要多个MySql,具体安装步骤,可以参考http://www.cnblogs.com/ywzq/p/4882140.html这个地址进行安装 ...
随机推荐
- 去掉DataGridView最后一行的空白行,删除空白行
//不显示出dataGridView1的最后一行空白 dataGridView1.AllowUserToAddRows = false; 直接在LODE事件
- 排列组合(包括n中随机抽取m个)
有些情况我们需要获取一个数组中的所有排列组合情况,或者获取一部分数据进行随机组合,这个在python中有一个模块可以实现.具体情况如下 :::::::::::::::::::::::::::::::: ...
- SQLAlchemy基础
1.介绍 做个简单笔记,方便回顾. SQLAlchemy是一个基于Python实现的ORM框架.该框架建立在 DB API之上,使用关系对象映射进行数据库操作,简言之便是:将类和对象转换成SQL,然后 ...
- dp - 最大子矩阵和 - HDU 1081 To The Max
To The Max Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=1081 Mean: 求N*N数字矩阵的最大子矩阵和. ana ...
- 【1】hexo+github搭建个人博客的过程记录
前提: 1.新建一个github仓库 2.安装配置Node.js 3.安装配置Git 前提 步骤1.新建一个github仓库 打开github网站,(注册)登录账号,新建一个仓库; 注:仓库名称要求, ...
- EOF的意义及用法
c/c++ 中EOF的意义及用法 EOF,为End Of File的缩写,通常在文本的最后存在此字符表示资料结束. 在微软的DOS和Windows中,读取数据时终端不会产生EOF.此时,应用程序知道数 ...
- .net core启用Swagger
启用 Swagger 页面 官方文档推荐两种框架:Swashbuckle 和 NSwag,这里使用 Swashbuckle 来生成接口文档. 目录 安装包 添加服务 配置中间件 添加 UI 设置 ...
- C# 随笔写txt
public static void WriterFile(string file) { string path = AppDomain.CurrentDomain.BaseDirectory; // ...
- windows10 edge浏览器关闭没有提示如何解决
通常情况下,用户在win10 edge中打开多个窗口,点击关闭按钮就会出现“要关闭所有标签”提示,然后可以点击 取消来取消关闭edge.不过,最近一位windows10系统用户反馈自己在一次勾选“总是 ...
- Visual Studio Code创建C#项目
Visual Studio Code是一个支持跨平台的文本编辑器,同其他文本文本编辑器一样,不但占用磁盘空间小,性能也比较快:近几年由于不断的升级和许多开发者提供大量的插件,它已经成为了一个非常强大的 ...