KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
balancer
★ 8
Open GitHub ↗
No description available.
Download README (.md)
Explore Similar Repositories
play-redis
:
Redis Module for Play Framework
fzf-mru.vim
:
FZF MRU(Most Recently Used) File List Vim/NeoVim Plugin
d3v-new-esemu
:
Latest C++ version of the ESEmu Project emulator, developed mostly by d3vil401 (now incomplete and messy!)
defugger
:
Minimal debugging console for javascript web apps.
ionic-input-clearable
:
An Ionic AngularJS directive for adding a clear button to an input element.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
balancer
?
Download (.md)
## MySQL Load Balancer [](https://travis-ci.org/StudioSol/balancer) [](https://codecov.io/gh/StudioSol/balancer) [](https://godoc.org/github.com/StudioSol/balancer) [](https://goreportcard.com/report/github.com/StudioSol/balancer) ### Usage ```go package main import ( "fmt" "log" "github.com/StudioSol/balancer" ) func main() { config := balancer.Config{ // Time in seconds in wich the health of the slaves is going to be checked CheckInterval: 3, // Wether the balancer should start checking health StartCheck: true, // Wether the queries executed by the balancer server should be logged TraceOn: false, // A balancer.Logger interface implementation Logger: log, // ReplicationMode // Use ReplicationModeSingleSource when slave status and seconds Behind Master is available // Use ReplicationModeMultiSource when uses wsrep as multi master solution ReplicationMode: balancer.ReplicationModeSingleSource, // Slave servers' configuration ServersSettings: []balancer.ServerSettings{ balancer.ServerSettings{ // Name of the MySQL Slave Server Name: "slave 1", // Connection string of the MySQL user used for reading DSN: "user:password@tcp(127.0.0.1:3306)/database", // Connection string of the MySQL user used for status. The chosen // user must have "REPLICATION STATUS" permission ReplicationDSN: "replication_user:password@tcp(127.0.0.1:3306)/", // Maximum idle connections MaxIdleConns: 0, // Maximum open connections MaxOpenConns: 10, }, // ... } db := balancer.New(config) server := db.PickServer() if server != nil { fmt.Println("No Server avaliable", server) } // Be happy! :) server.GetConnection().SelectOne( // ... ) } ```