Code Monkey home page Code Monkey logo

fusis's Introduction

Fusis Balancer

Fusis Balancer is a dynamic Layer 4 Load Balancer powered by IPVS and Serf.

Running the Fusis Agent in your servers, lets the balancer detect new nodes and add new routes to them.

There is also a HTTP API to manages your services dynamically.

IPVS

IPVS (IP Virtual Server) implements transport-layer load balancing directly in the Linux Kernel. It's being aroung since 1999 and its very stable and battle tested. Used by many companies like Google, Facebook, Github, Soundcloud and many others.

IPVS it is a amazing piece of software that few people really know of it, and that is probably because its not that easy to use. It requires some knowledge about networking and its necessary to do some network configuration in order to make it work correctly.

Serf

Serf is solution for distributed cluster management, message delivery and failure detection. It is one of the bases of Consul.

Why?

The whole goal of this project it is to bring a accessible way to use IPVS.

Fusis Balancer will be responsible for detecting new/failed nodes and add/remove routes to it. It will automatically configure the network in order to make everything work.

State

This project it's under heavy development, it's not usable yet, but you can Star โญ the project and follow the updates.

Installation

There is compilation and runtime dependency on libnl. On a Debian/Ubuntu style system, you should be able to prepare for building by running:

apt-get install libnl-3-dev libnl-genl-3-dev

Get this project into GOPATH:

go get -v github.com/luizbafilho/fusis

Also, get these projects:

go get -v github.com/hashicorp/errwrap
go get -v github.com/hashicorp/go-multierror
go get -v github.com/miekg/dns

Install govendor and get the dependencies.

go get github.com/kardianos/govendor
govendor add +e

You will need at least Go 1.5.

Installing IPVS

IPVS is a Kernel module. Install it using modprobe to enable it on the kernel:

# Enables ipvs on kernel
$> modprobe ip_vs

# Also install the IPVS command line tool
$> sudo apt-get install ipvsadm

To use IPVS, you must enable the IP forwarding parameter for kernel

$> sudo sysctl -w net.ipv4.ip_forward=1

Running the project

Now that you have IPVS and fusis installed, run the project:

# Remenber, fusis binary is at $GOPATH/bin/fusis. Add it to system PATH
$> sudo fusis balancer --iface eth0

You should see something like:

[GIN-debug] Listening and serving HTTP on :8000

Now, from another host send a request asking for what services do we have available behind the fusis router:

$> curl -i {IP OF FUSIS HOST}:8000/services

You should see an answer like:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Thu, 07 Apr 2016 21:23:18 GMT
Content-Length: 3

[]

Just for a test, lets add some route to any fake IP. At the fusis host type:

$> sudo ipvsadm -A -t 10.0.0.1:80 -s rr

Then, make another request:

$> curl -i {IP OF FUSIS HOST}:8000/services

You will see that there is a new route on response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Thu, 07 Apr 2016 22:08:42 GMT
Content-Length: 94

[{"Name":"","Host":"10.0.0.1","Port":80,"Protocol":"tcp","Scheduler":"rr","Destinations":[]}]

fusis's People

Contributors

aitherios avatar luizbafilho avatar pantuza avatar

Watchers

 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.