• 下载,安装
 
[root@localhost src]# cd /usr/local/src/
[root@localhost src]# tar zxvf mysql-router-2.0.3-linux-glibc2.12-x86-64bit.tar.gz -C /usr/local/soft/
[root@localhost src]# cd /usr/local/soft/
[root@localhost soft]# ll
total 36
drwxr-xr-x.  9 xiaojf xiaojf 4096 Oct 30 00:20 elasticsearch
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 filebeat
drwxr-xr-x.  8 uucp      143 4096 Apr  1  2016 jdk
drwxrwxr-x. 11   1000   1000 4096 Jul 10  2016 kibana
drwxr-xr-x.  6 root   root   4096 Jul  9  2016 logstash
drwxrwxr-x.  7   7161 wheel  4096 Feb 22  2016 mysql-router-2.0.3-linux-glibc2.12-x86-64bit
drwxrwxr-x.  6 root   root   4096 Dec  6 00:38 redis-3.2.6
drwxr-xr-x.  5 root   root   4096 Jan 13 22:57 redis_cluster
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 tar
[root@localhost soft]# mv mysql-router-2.0.3-linux-glibc2.12-x86-64bit mysql-router
[root@localhost soft]# ll
total 36
drwxr-xr-x.  9 xiaojf xiaojf 4096 Oct 30 00:20 elasticsearch
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 filebeat
drwxr-xr-x.  8 uucp      143 4096 Apr  1  2016 jdk
drwxrwxr-x. 11   1000   1000 4096 Jul 10  2016 kibana
drwxr-xr-x.  6 root   root   4096 Jul  9  2016 logstash
drwxrwxr-x.  7   7161 wheel  4096 Feb 22  2016 mysql-router
drwxrwxr-x.  6 root   root   4096 Dec  6 00:38 redis-3.2.6
drwxr-xr-x.  5 root   root   4096 Jan 13 22:57 redis_cluster
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 tar
  • 配置文件
 
[root@localhost mysql-router]# cd /usr/local/soft/mysql-router/
[root@localhost mysql-router]# touch mysqlrouter.ini
[root@localhost mysql-router]# vi mysqlrouter.ini
 
[DEFAULT]
logging_folder = /usr/local/soft/mysql-router/logs
 
[logger]
level = INFO
 
[routing:read_write]
bind_address = 192.168.59.128
bind_port = 8001
destinations = 192.168.59.128:3306
mode = read-write
max_connections = 1024
max_connect_errors = 100
client_connect_timeout = 9
 
[routing:read_only]
bind_address = 192.168.59.128
bind_port = 8002
destinations = 192.168.59.129:3306
mode = read-only
max_connections = 65535
max_connect_errors = 100
client_connect_timeout = 9
 
[root@localhost mysql-router]# mkdir -p /usr/local/soft/mysql-router/logs
 
  • 开发  8001 8002 端口
  • 启动
 
[root@localhost mysql-router]./bin/mysqlrouter -c ./mysqlrouter.ini &
 
  • 监控日志
 
[root@localhost ~]# tail -f /usr/local/soft/mysql-router/logs/mysqlrouter.log
 
  • 连接
 
[root@localhost mysql-router]# mysql -uxiaojf -pxiaojf -P 8001
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.6.28-log MySQL Community Server (GPL)
 
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| elearning          |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
 
mysql>
  • 下载,安装
 
[root@localhost src]# cd /usr/local/src/
[root@localhost src]# tar zxvf mysql-router-2.0.3-linux-glibc2.12-x86-64bit.tar.gz -C /usr/local/soft/
[root@localhost src]# cd /usr/local/soft/
[root@localhost soft]# ll
total 36
drwxr-xr-x.  9 xiaojf xiaojf 4096 Oct 30 00:20 elasticsearch
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 filebeat
drwxr-xr-x.  8 uucp      143 4096 Apr  1  2016 jdk
drwxrwxr-x. 11   1000   1000 4096 Jul 10  2016 kibana
drwxr-xr-x.  6 root   root   4096 Jul  9  2016 logstash
drwxrwxr-x.  7   7161 wheel  4096 Feb 22  2016 mysql-router-2.0.3-linux-glibc2.12-x86-64bit
drwxrwxr-x.  6 root   root   4096 Dec  6 00:38 redis-3.2.6
drwxr-xr-x.  5 root   root   4096 Jan 13 22:57 redis_cluster
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 tar
[root@localhost soft]# mv mysql-router-2.0.3-linux-glibc2.12-x86-64bit mysql-router
[root@localhost soft]# ll
total 36
drwxr-xr-x.  9 xiaojf xiaojf 4096 Oct 30 00:20 elasticsearch
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 filebeat
drwxr-xr-x.  8 uucp      143 4096 Apr  1  2016 jdk
drwxrwxr-x. 11   1000   1000 4096 Jul 10  2016 kibana
drwxr-xr-x.  6 root   root   4096 Jul  9  2016 logstash
drwxrwxr-x.  7   7161 wheel  4096 Feb 22  2016 mysql-router
drwxrwxr-x.  6 root   root   4096 Dec  6 00:38 redis-3.2.6
drwxr-xr-x.  5 root   root   4096 Jan 13 22:57 redis_cluster
drwxr-xr-x.  2 root   root   4096 Jul  9  2016 tar
  • 配置文件
 
[root@localhost mysql-router]# cd /usr/local/soft/mysql-router/
[root@localhost mysql-router]# touch mysqlrouter.ini
[root@localhost mysql-router]# vi mysqlrouter.ini
 
[DEFAULT]
logging_folder = /usr/local/soft/mysql-router/logs
 
[logger]
level = INFO
 
[routing:read_write]
bind_address = 192.168.59.128
bind_port = 8001
destinations = 192.168.59.128:3306
mode = read-write
max_connections = 1024
max_connect_errors = 100
client_connect_timeout = 9
 
[routing:read_only]
bind_address = 192.168.59.128
bind_port = 8002
destinations = 192.168.59.129:3306
mode = read-only
max_connections = 65535
max_connect_errors = 100
client_connect_timeout = 9
 
[root@localhost mysql-router]# mkdir -p /usr/local/soft/mysql-router/logs
 
  • 开发  8001 8002 端口
  • 启动
 
[root@localhost mysql-router]./bin/mysqlrouter -c ./mysqlrouter.ini &
 
  • 监控日志
 
[root@localhost ~]# tail -f /usr/local/soft/mysql-router/logs/mysqlrouter.log
 
  • 连接
 
[root@localhost mysql-router]# mysql -uxiaojf -pxiaojf -P 8001
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.6.28-log MySQL Community Server (GPL)
 
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| elearning          |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
 
mysql>

MysqlRouter 实现mysql5.6读写分离的更多相关文章

  1. Centos 7环境下配置MySQL 5.7读写分离

    1.实验目的: 实现在Centos 7系统环境下,MySQL5.7读写分离. 2.实验条件: MySQL主服务器:Centos 7桌面环境,IP:10.10.11.31 MySQL从服务器:Cento ...

  2. 利用MySQL Router构建读写分离MGR集群

    GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 目录 1. 部署MySQL Router 2. 启动mysqlrouter服务 3. 确认读写分离效果 4. 确认只读负载 ...

  3. MySQL5.6 实现主从复制,读写分离,分散单台服务器压力

    闲来无事,在本地搭建几台虚拟机,准备配一个mysql读写分离的主从配置,版本选用最新版的,mysql.5.6.28 版本,本处使用源码安装(鄙人一向喜欢源码安装,因为centos中鄙人不知道yum安装 ...

  4. MySQL5.6 Replication主从复制(读写分离) 配置完整版

    MySQL5.6 Replication主从复制(读写分离) 配置完整版 MySQL5.6主从复制(读写分离)教程 1.MySQL5.6开始主从复制有两种方式: 基于日志(binlog): 基于GTI ...

  5. Centos7.5部署MySQL5.7基于GTID主从复制+并行复制+半同步复制+读写分离(ProxySQL) 环境- 运维笔记 (完整版)

    之前已经详细介绍了Mysql基于GTID主从复制的概念,原理和配置,下面整体记录下MySQL5.7基于GTID主从复制+并行复制+增强半同步复制+读写分离环境的实现过程,以便加深对mysql新特性GT ...

  6. spring+mybatis+mysql5.7实现读写分离,主从复制

    申明:请尽量与我本博文所有的软件版本保持一致,避免不必要的错误. 所用软件版本列表:MySQL 5.7spring5mybaties3.4.6 首先搭建一个完整的spring5+springMVC5+ ...

  7. 利用mycat实现基于mysql5.5主从复制的读写分离

    整体步骤: 1.准备好两台服务器,一台作为主数据库服务器,一台作为从服务器,并安装好mysql数据库,此处略 2.配置好主从同步 3.下载JDK配置mycat依赖的JAVA环境,mycat采用java ...

  8. MySQL5.6基于mysql-proxy实现读写分离

    已经搭建好MySQL主从架构 10.205.22.185 #mysql-proxy 10.205.22.186 #master 10.205.22.187 #slave 1.安装mysql-proxy ...

  9. MySQL集群(三)mysql-proxy搭建负载均衡与读写分离

    前言 前面学习了主从复制和主主复制,接下来给大家分享一下怎么去使用mysql-proxy这个插件去配置MySQL集群中的负载均衡以及读写分离. 注意:这里比较坑的就是mysql-proxy一直没有更新 ...

随机推荐

  1. AES算法,DES算法,RSA算法JAVA实现

    1     AES算法 1.1    算法描述 1.1.1      设计思想 Rijndael密码的设计力求满足以下3条标准: ① 抵抗所有已知的攻击. ② 在多个平台上速度快,编码紧凑. ③ 设计 ...

  2. Spring+Redis(keyspace notification)实现定时任务(订单过期自动关闭)

    1.起因 最近公司项目要做订单超期未支付需自动关闭,首先想到的是用spring的定时器(@Schedule),结果领导举各种例子说会影响性能,只能作罢.后来想能不能基于redis实现, 学习(baid ...

  3. mui 页面间传值得2种方式

    通过最近得工作开发刚接触mui框架,用到了页面间得传值, 第一种:通过url进行传值 父页面代码: mui.openWindow({ id:'子页面.html', url:'子页面.html?para ...

  4. 浅谈MVC页面之间参数传递

    关于MVC页面之间的传值,有多种方式,下面,我们就Html.RenderAction 方式 和 Html.RenderPartial 方式 来给大家分享一下有什么不同. 一.Html.RenderAc ...

  5. PHP的laravel框架后台实现数据导出excel的功能

    要想在PHP后台实现excel导入导出功能,一种简单有效的方法就是使用phpexcel插件. 要使用phpexcel插件,首先需要下载composer,这个工具是专门用来管理项目中库之间的依赖关系的. ...

  6. 京东商城首页jquery轮播特效

    <!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title> ...

  7. 懵懂oracle之存储过程

    作为一个oracle界和厨师界的生手,笔者想给大家分享讨论下存储过程的知识,因为在我接触的通信行业中,存储过程的使用还是占据了一小块的地位. 存储过程是什么?不得不拿下百度词条的解释来:"存 ...

  8. DirectFB 之 简介

    1. DirectFB概述        首先 DirectFB 类似于桌面中的 XFree86 .桌面中的 XFree86 不需要 Frame Buffer 设备,而 DirectFB 需要.   ...

  9. spark2.0系列《一》—— RDD VS. DataFrame VS. DataSet

    虽说,spark我也不陌生,之前一直用python跑的spark,基本的core和SQL操作用的也是比较熟练.但是这一切的基础都是在RDD上进行操作,即使是进行SQL操作也是将利用SpaekConte ...

  10. linux中重定向的用法

    用法: 1> | > file:标准输出覆盖重定向(先清空文件,后加入内容) 1>> | >> file:标准输出追加重定向(将内容追加到文件的末尾) 2> ...