-
Notifications
You must be signed in to change notification settings - Fork 235
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
Open() to connect to multiple db servers #43
Comments
I ended up just instantiating the It works great. Except I had to fork/write a See: ..I looked at the mysql, postgres, ql and sqlite adapters as well to see if upper/db could reasonably support someone instantiating their own connection as long as it adheres to db.Database. It can definitely be done, but the |
Hi Peter! I agree with you on the importance of this proposal. I was thinking on modifying the type Settings struct {
...
Replica []Settings
} All I believe this master -> slave concept can also be mapped to MongoDB, as we see here: http://docs.mongodb.org/manual/core/replica-set-members/, so it definitely can be done. We could also add a I'm not sure about adding a I think I like the idea of What do you think? Would any of these options solve your current case? |
Ah yea issue #36 is the same to this, exactly. The issue with your proposal of I'm not sure how the postgres and mysql drivers work, and if they have this "cluster" configuration ability. what if you made the
then someone could just do: .. so both are supported actually :) and even backward compatible. You could add a |
the other option I see.. is BYOC (Bring Your Own Connection) .. and allow developers to create a Connection interface (aka Source) object to that adapter, and connect themselves like I did with the hack above.. |
Sounds great, I really like your suggestion for As for MySQL and PostgreSQL, there are lots of solutions for this problem, but the most common pattern that does not require additional middleware is routing the queries to master or slave in each case I'll work on the |
BTW, if you'd like to test something you could use this vm: https://github.com/upper/db-vagrant |
👍 |
We're advancing a bit here, now we have support for a If you're using the var settings = mongo.ConnectionURL{
Address: db.Cluster(db.Host("1.2.3.4"), db.Host("5.6.7.8"), ...),
Database: "dbname",
} There is also a var settings = mongo.ParseURL(`mongodb://foo:bar@1.2.3.4,5.6.7.8/dbname`) The |
I see.. I guess db.Cluster() was a new function added for the purposes of configuring these hosts..? what is the form to specify a node being read-only? |
I would have to think about it more.. but why not go with |
I guess the connection string url is a single point, but offers flexibility in the configuration via a url to a particular db.. I guess if there would be so many options this could be better.. but how many kind of options would there be.. |
Hi Peter, The recently introduced Support for The |
I forgot to close this one, but this has been in mongodb and upper for some time now:
|
I really like the design of upper/db, it's super clean and minimal. However, I believe
db.Open()
should accept an array of settings objects. For example, it's common with mongodb to pass a bunch of hosts which are in a cluster and then the client will determine the master, etc. etc. I presume MySQL / Postgresl would have something similar in a master/slave arrangement. Thoughts?The text was updated successfully, but these errors were encountered: