• 下载,安装
 
[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. css form表单样式清除

    开发项目中表单常用的清楚样式: 1.改变placeholder默认字体颜色 ::-webkit-input-placeholder{color: #333;} :-moz-placeholder{co ...

  2. 由if-else,switch代替方案引起的思考

    关键词:条件判断,多态,策略模式,哈希表,字典map 笔者在用python实现事件驱动后,发现python是没有提供switch语句,python官方推荐多用字典来代替switch来实现,这让我就觉得 ...

  3. iOS多线程的三种方法

    前言 在多线程简介中,我已经说明过了,为了提高界面的流畅度以及用户体验.我们务必要把耗时的操作放到别的线程中去执行,千万不要阻塞主线程.iOS中有以下3种多线程编程方法: NSThread Grand ...

  4. winfrom 实现条形码批量打印以及将条形码信息生成PDF文件

    最近,老大让给客户做个邮包管理程序.其中,包括一些基本信息的增.删.查和改,这些倒不是很难搞定它分分钟的事.其主要难点就在于如何生成条形码.如何批量打印条形码以及将界面条形码信息批量生成以其各自的 b ...

  5. js 数组方法总结

    Array数组: length属性 可通过array.length增加或者减少数组的长度,如;array.length=4(数组长3,第四位为undefined),也可单纯获得长度.array[arr ...

  6. JS绑定种类汇总

    这里是<你不知道的JS>中常见的this绑定种类分享: 1)默认绑定: function foo(){ console.log(this.a); } var a = 2; foo(); 解 ...

  7. 腾讯云无法绑定公网IP问题解释与解决方案。

    http://blog.csdn.net/chenggong2dm/article/details/51475222 解释:公网IP并不直接配置在服务器上,而是在服务器外部的路由上,通过某种映射连接. ...

  8. 【翻译】FreeMarker——入门

    原文传送门 1. Template + data-model = output data-model是一个树状模型,通常是一个java对象. 2.data-model 入门 hashes(散列):目录 ...

  9. PDO(数据访问抽象层)、pdo事务功能和预处理功能---2017-05-05

    之前所学的数据访问都是用mysqli做成类来访问的,但是mysqli这个类只是针对mysql这个数据库的:那么如果访问其他类型的数据库呢? 那么这就用到了PDO(数据访问抽象层). 一.关于PDO基本 ...

  10. Activity设置全屏显示的两种方式及系统自带theme属性解析

    转载说明:原贴地址:http://blog.csdn.net/a_running_wolf/article/details/50480386 设置Activity隐藏标题栏.设置Activity全屏显 ...