Skip to content
/ glber Public

Simple lightweight load balancer written in golang

License

Notifications You must be signed in to change notification settings

hlts2/glber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glber License: MIT GoDoc Go Report Card Join the chat at https://gitter.im/hlts2/glber

glber is a simple lightweight load balancer written in golang.

Requirement

Go (>= 1.9)

Installation

go get github.com/hlts2/glber

Example

Config file

Config file config.yml describes configuration of load balancer. The following is a setting example.

host: 0.0.0.0
port: 80
balancing: round-robin
tls:
  enabled: true
  cert_key: ./cert.key
  key_key: ./key.key
servers:
  - scheme: http
    host: 192.168.33.11
    port: 1111
  - scheme: http
    host: 192.168.33.11
    port: 2222
  - scheme: http
    host: 192.168.33.11

Balancing Algorithm

There are three possible algorithms for balancing

Please write algorithm name in balancing field of config.yml file

balancing: round-robin # or ip-hash or least-connections

Basic Example

$ glber serve -s config.yml

CLI Usage

$ glber --help
NAME:
   glber - Load Balancer

USAGE:
   glber [global options] command [command options] [arguments...]

VERSION:
   v1.0.0

COMMANDS:
     serve    serve load balancer
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Serve command

$ glber serve --help
NAME:
   glber serve - serve load balancer

USAGE:
   glber serve [command options] [arguments...]

OPTIONS:
   --set value, -s value  set the configuration file (default: "config.yml")

TODO

  • Helth check of service

Author

hlts2

LICENSE

glber released under MIT license, refer LICENSE file.

Releases

No releases published

Packages

No packages published

Languages