Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to support master slave and multiple database? #1055

Closed
kumarsiva07 opened this issue Jun 3, 2016 · 3 comments
Closed

How to support master slave and multiple database? #1055

kumarsiva07 opened this issue Jun 3, 2016 · 3 comments

Comments

@kumarsiva07
Copy link

kumarsiva07 commented Jun 3, 2016

How to support master slave and multiple database?

@levinalex Can you add file config for database connection open with multi shard and master/slave?
like active_record sharding https://github.com/zendesk/active_record_shards

@jinzhu
Copy link
Member

jinzhu commented Apr 18, 2017

you could have a load balancer, and make gorm connect the load balancer

@jinzhu jinzhu closed this as completed Apr 18, 2017
@d4l3k
Copy link

d4l3k commented Jun 6, 2018

Just for future reference in case anyone else stumbles upon this issue, for master slave topologies you can use https://github.com/tsenart/nap to add client side load balancing. For multi-master topologies like CockroachDB I wrote a library https://github.com/d4l3k/go-lbsql.

There's also https://github.com/benthor/clustersql but it seems to have some issues and not be thread safe.

@majuansari
Copy link

@d4l3k Could you please share an example with gorm and tsenart/nap ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants