• 下载,安装
 
[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. 编译MangosZero

    最近研究了一下魔兽世界模拟器MangosZero,花了两天时间终于编译成功!现在把编译的过程做个完整的记录,以便让想要学习编译的同学们少走弯路! 服务器端运行界面: 客户端运行界面: 一:下载源程序 ...

  2. 如何修改Xampp服务器上的mysql密码

    今天自己在搞php的过程中发现,如果我们使用Xampp服务器自带数据库mysql,就必须先修改mysql的密码,大家都知道,mysql的初始面为空,但是如果连接数据库是密码为空就会报错,在网上查找了很 ...

  3. C语言基础知识点整理(函数/变量/常量/指针/数组/结构体)

    函数 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...

  4. java多线程基本概述(十三)——Executor

    1:Executor接口 public interface Executor 执行已提交的 Runnable 任务的对象.此接口提供一种将任务提交与每个任务将如何运行的机制(包括线程使用的细节.调度等 ...

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

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

  6. angular 实现自定义样式下拉菜单

    自己闲着没事写了一个自定义的下拉菜单希望和大家交流一下!望能和大神们成为朋友. 下面上代码: <!doctype html> <html lang="en" ng ...

  7. java运算符 与(&)、非(~)、或(|)、异或(^)

    最近看HashMap源码,遇到了这样一段代码: static final int hash(Object key) { int h; return (key == null) ? 0 : (h = k ...

  8. 使用 PHPStorm + Xdebug 实现断点调试(二)

    一.配置 Xdebug 配置 Xdebug 相关参数,在 php.ini 文件中新增如下配置,如果没安装的,请参考<PHP 安装 Xdebug扩展>: [xdebug] xdebug.re ...

  9. UML总结(对九种图的认识和如何使用Rational Rose 画图)

    UML是一种建模语言,是系统建模的标准.我们之所以建模是因为大规模的系统设计时相当复杂的,当系统比较复杂时就会涉及到以下这几个问题: 开发人员如何与用户进行沟通来了解系统的需求? 开发人员之间如何沟通 ...

  10. js,jQuery和DOM操作的总结(二)

    jQuery的基本操作 (1)遍历键值对和数组 , , , , , ]; $.map(arr, function (ele, index) { alert(ele + '===' + index); ...