Code Monkey home page Code Monkey logo

tcp-proxy's Introduction

tcp-proxy

Genel TCP Proxy using Java NIO ,simple and fast

学习Mycat核心,学习NIO编程,都可以从这个代码来理解。可以用来实现如下目标: 高性能HTTP Proxy 高性能FTP Proxy 高性能WebService 网关

如果代码看不懂,建议去看看《架构解密》中关于NIO的内容,或者报名Leader us私塾 中间件研发课程,QQ 群 106088787

目前已实现的特性:

  • 基于Nio实现,有效管理线程,解决高并发问题。
  • 自动集群功能。
  • 支持SQL92标准。
  • 支持单库内任意sql。
  • 前后端共享buffer,支持全透传和半透传,极致提升内核性能,稳定性 和 兼容性。

集群配置说明

  • 非集群模式

    • 修改mycat.yml中的clusterEnable: false
  • 集群模式

    • 修改mycat.yml中的clusterEnable: true
    • myNodeId需要在集群中唯一
    • 集群模式下,只有在集群状态下才提供代理服务,在脱离集群状态下将暂时无法提供代理服务

运行方式:

一 下载

1.1 window 环境 下载 mycat2-0.1-20170906223147-win.tar.gz
1.2 linux 环境 下载 mycat2-0.1-20170906223147-linux.tar.gz

二 修改配置文件

2.1 需要修改 conf 目录下 schema.yml datasource.yml 两个配置文件。
2.2 schema.yml中 需要设置 default-db (默认数据库), default-rep (默认复制组) 属性。
2.3 datasource.yml 中 需要设置 ip port user password min-con max-con 属性。

三 运行

3.1 运行的方式与 1.6 相同。
3.2 linux 环境 运行 bin 目录下 ./mycat {console | start | stop | restart | status | dump }
3.3 window 环境 运行 bin 目录下 startup_nowrap.bat
3.4 运行成功后, 使用 root 账号登录,登录密码 123456 登录, 端口号 8066

四 启动第二个mycat,并自动加入集群。

4.1 集群相关配置文件 conf 目录下, mycat1.yml,mycat2.yml,mycat3.yml 三个配置文件,分别为集群中三个节点的配置文件。
配置文件名称格式为: mycat[unique id]. conf
配置文件中 cluster.allnodes 属性 需要将集群中,所有节点的信息配置上。

    `conf` 目录下, 设置 `wrapper.conf` 配置文件中,<br>
    `wrapper.app.parameter.2` 参数的值 为  mycat[`unique id`]. yml 中的  `unique id` 。<br>
    确定从哪个mycat[unique id]. conf 配置文件中 读取配置。<br>

4.2 需要注意的是,每个节点一套mycat程序。
4.3 配置完成后 按照第三步 启动mycat. 新启动的mycat 将自动加入集群中。

tcp-proxy's People

Contributors

apachemycat avatar yanjunli avatar junwen12221 avatar kkzfl22 avatar ynfeng avatar zwyqz avatar ishotoli avatar k-darker avatar sse-xmli avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.