码迷,mamicode.com
首页 > 数据库 > 详细

玩玩TCPCOPY+ intercept+mysql-replay-module(未成功)

时间:2015-05-30 15:15:50      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:

TCPCOPY+ intercept这两个模拟流量转发倒简单。

但,想实现一个mysql-replay-module模块时,失败了。(我现在仔细想想,这个方案,在我们现在的场景里,实用性不大,但弄好点专业些。)

 

https://github.com/session-replay-tools/mysql-replay-module

https://github.com/session-replay-tools/tcpcopy

 

技术分享

安装=================================

一,在assistant server上安装intercept:

 

  1. git clone git://github.com/session-replay-tools/intercept.git
  2. cd intercept
  3. ./configure --with-resp-payload
  4. make
  5. make install

二,在ONLINE SERVER上安装TCPCOPY:

  1. git clone git://github.com/session-replay-tools/tcpcopy.git
  2. cd tcpcopy
  3. git clone git://github.com/session-replay-tools/mysql-replay-module.git
  4. ./configure --set-protocol-module=mysql-replay-module
  5. make
  6. make install

配置====================================

一,在TARGET SERVER上配置路由:

    For example:

       Assume 10.110.12.18 is the IP address of the assistant server and 
    10.110.12.15 is the MySQL client IP address. We set the following route 
    command to route all responses to the 10.110.12.15 to the assistant server.

       route add -host 10.110.12.15 gw 10.110.12.18

二,在assistant server上配置端口过滤:

  For example:

      ./intercept -i eth0 -F ‘tcp and src port 3306‘ -d

      intercept will capture response packets of the TCP based application which 
  listens on port 3306 from device eth0 

三,在ONLINE SERVER上启动TCPCOPY:

a) set user password pair in conf/plugin.conf in the installion directory

    Format:
       user user1@password1,user2@password2,...,userN@passwordN;

    For example:
       user root@123456;    

  b) start tcpcopy
    ./tcpcopy -x localServerPort-targetServerIP:targetServerPort -s <intercept server,> 

    For example(assume 10.110.12.17 is the IP address of the target server):

      ./tcpcopy -x 3306-10.110.12.17:3306 -s 10.110.12.18 

      tcpcopy would capture MySQL packets(assume MySQL listens on 3306 port) on current 
  server, do the necessary modifications and send these packets to the target port 
  ‘3306‘ on ‘10.110.12.17‘(the target MySQL), and connect 10.110.12.18 for asking 
  intercept to pass response packets to it.


最后,一份转两份,真实服务器上有,测试服务器上也有流量。用过压力或冒烟测试,蛮好的。

技术分享

玩玩TCPCOPY+ intercept+mysql-replay-module(未成功)

标签:

原文地址:http://www.cnblogs.com/aguncn/p/4540368.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!