• 下载,安装
 
[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. Statistical Models and Social Science

    1.1 Statistical Models and Social Reality KEY: complex society v.s statistical models relationship,d ...

  2. jdk动态代理与cglib代理、spring aop代理实现原理

    原创声明:本博客来源与本人另一博客[http://blog.csdn.net/liaohaojian/article/details/63683317]原创作品,绝非他处摘取 代理(proxy)的定义 ...

  3. 使用 Gradle 编译 Java 项目时报错: Could not find Tools.jar

    在使用Android studio进行编译成jar的时候,遇到Gradle 编译错误,听前辈们说是jdk的版本不对,于是乎就更新了一下jdk, 然而可能是我重新安装jdk的时候改变了安装路径, 在pr ...

  4. Spring Boot启动过程(七):Connector初始化

    Connector实例的创建已经在Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动中提到了: Connector是LifecycleMBeanBase的子类,先是设置L ...

  5. 关于mpu6050的几个很好的帖子

    最近在研究6050,真是很磨人啊,这个小东西还挺复杂,一个读取程序竟然需要600多行. 这几天连查资料找到了几个很好的帖子,要是以后有人看到这篇帖子,可以避免误入歧途,也可以省去很多时间. 1.阿西莫 ...

  6. dispatch_group_t 日常使用注意事项

    一.背景简介平时在进行多线程处理任务时,有时候希望多个任务之间存在着一种联系,希望在所有的任务执行完后做一些总结性处理.那么就可以将多个任务放在一个任务组中进行统一管理.dispatch提供了相应的A ...

  7. 基于Hadoop分布式集群YARN模式下的TensorFlowOnSpark平台搭建

    1. 介绍 在过去几年中,神经网络已经有了很壮观的进展,现在他们几乎已经是图像识别和自动翻译领域中最强者[1].为了从海量数据中获得洞察力,需要部署分布式深度学习.现有的DL框架通常需要为深度学习设置 ...

  8. linux操作系统中对大小端的判断

    static union { char c[4]; unsigned long l; } endian_test = { { 'l', '?', '?', 'b' } }; #define ENDIA ...

  9. [移动端] IOS下border-image不起作用的解决办法

    上周五突然接到现场的一个需求,做一个移动端的劳模展示页面.现场美工把原型图发了过来.这个样子的: 说实在的很想吐槽一下我们美工的审美哈,不过这不是重点. 因为边框是需要特殊花纹的所以打算用border ...

  10. [Splay模版1]

    输入 第1行:1个正整数n,表示操作数量,100≤n≤200,000 第2..n+1行:可能包含下面3种规则: 1个字母'I',紧接着1个数字k,表示插入一个数字k到树中,1≤k≤1,000,000, ...