Fusis Balancer is a software Layer 4 Load Balancer powered by Linux's IPVS. It is a control plane for IPVS and adds distribution, fault tolerance, self-configuration and a nice JSON API to it.
IPVS is hard. Fusis is an abstraction to make it easier to deal with IPVS and make its way to production without problems.
The goal of this project is to provide a friendly way to use IPVS.
To make sure Fusis does not become a Single Point of Failure in your infrastructure, the Fusis can operate in two modes: Failover
or Distributed
modes.
In this mode, there is always one single instance balancing the traffic, and N
others working as secondary instances. Once the Primary is down, a secondary instance becomes the primary and starts balancing the load.
In this mode, all instances balance the traffic. To distribute the traffic to every instance, we need to make use of ECMP
, so, the router can distribute the traffic equally. Fusis integrates out of the box with BGP without any external dependencies. With a basic configuration, you can peer with your BGP infrastructure and have a distributed load balancer.
[bgp]
as = 100
router-id = "192.168.151.182"
[[bgp.neighbors]]
address = "192.168.151.178"
peer-as = 100
This project it is under heavy development, it is not usable yet, but you can Star ⭐ the project and follow the updates.
- Linux kernel >= 2.6.10 or with IPVS module installed
- libnl 3.X
WIP
-
Install Vagrant
-
Build the VM
vagrant up
Watch the message at the end of vagrant provision process. It will provide you with the user, password and where the project code is.
- Login
vagrant ssh
-
Install Go 1.6 or later
-
Install libnl-3 (Debian based:
apt-get install libnl-3-dev libnl-genl-3-dev
) -
Get this project into $GOPATH:
go get -v github.com/luizbafilho/fusis
Now that you have IPVS and fusis installed, run the project:
# Remember, fusis binary is at $GOPATH/bin/fusis, add it to your $PATH
sudo fusis balancer --bootstrap
You should see something like:
[GIN-debug] Listening and serving HTTP on :8000
From another host, send a HTTP request to the API querying for available services available:
curl -i {IP OF FUSIS HOST}:8000/services
So you should get:
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 testing purposes, lets add a route to a fake IPv4 by running this on the fusis host:
sudo ipvsadm -A -t 10.0.0.1:80 -s rr
Then, make another request:
curl -i {FUSIS_HOST_IPV4}:8000/services
You will get that same route you just created as a 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":[]}]