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这个地址进行安装 ...
随机推荐
- 明解C语言 入门篇 第九章答案
练习9-1 /* 将字符串存储在数组中并显示(其2:初始化) */ #include <stdio.h> int main(void) { char str[] = "ABC\0 ...
- SQL忽略重复键作用
1.插入时如果开启的话,发现重复键会忽略,否则报错 2.更新时不管开启是否都会报错
- java 获取真实ip地址
/** * 获取真实ip地址 * @param request * @return */ public static String getIpAddress(HttpServletRequest re ...
- [转载].NET Core 轻量级模板引擎 Mustachio
.NET Core 轻量级模板引擎 Mustachio 晓晨Master 一. 前言 Mustachio 是一款轻量级且强大的模板引擎,可以用在网页渲染.代码生成器等需要模板引擎的场景.我用它是用在配 ...
- ASP.NET MVC EF 连接数据库(二)-----Model First
Model first (VS2015 ,Sql Server2014) 新建MVC项目 右键product ,新增标量属性(数据库表中的字段) Ctrl + S 保存页面,右键“根据模型 ...
- Macbook中VMWare的Centos7虚拟机配置静态IP并允许上网的配置方法
一.检查Macbook本身的配置 1.打开[系统偏好设置]-[网络]- 选中[Wi-Fi]项(如果您是WIFI上网请选择此项)- 点右侧[高级] 选择[TCP/IP]选项卡,记录好[子网掩码].[路由 ...
- Java中关于位运算的面试题
位运算的效率是最高的,因为位位运算是直接对二进制进行操作 位运算只能应用于整型和char类型(char类型可以看做是特殊的无符号的整形) 面试题: a: 判断一个数是否是奇数 a & 1 == ...
- response.Close、response.End、response.Flush区别(下载文件)
今天在做文件下载功能用到的是response的方法,首先我们要了解这些方法的作用. 1.response.write():将信息写入http响应输出流. 2.response.Flush:向客户端发送 ...
- uni-app常用 HTML5+APP 设置
1.锁定屏幕方向 锁定屏幕方向后屏幕只能按锁定的屏幕方向显示,关闭当前页面后仍然有效. 可再次调用此方法修改屏幕锁定方向或调用 unlockOrientation() 方法恢复到应用的默认值. 锁定屏 ...
- 源码升级SUSE openssh
1.check old opensslrpm -q opensslopenssl versionwhich opensslwhereis opensslls /etc/ssl 2.backup old ...