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

cant connect mlab replicaset #48

Closed
sezgin-zz opened this issue Oct 13, 2016 · 23 comments
Closed

cant connect mlab replicaset #48

sezgin-zz opened this issue Oct 13, 2016 · 23 comments

Comments

@sezgin-zz
Copy link

this example is my problem
server = try Server("mongodb://heroku_xxxxx:xxxxxxx@serveraddress.mlab.com:23372,serveraddress-a1.mlab.com:23372/xxxxxxx?replicaSet=rs-xxxxxx", automatically: true)
thow error, MongoDB is not available on the given host and port Socket failed with code 61 ("No data available") [connectFailed] "Unknown error"

@Joannis
Copy link
Member

Joannis commented Oct 13, 2016

Sorry about this @sezgin, we didn't implement replica support yet. I can start working on the feature tomorrow afternoon at best. But I'll need to set up a replica first, which is going to cost me some time as well. Best case scenario we'll have the feature implemented somewhere next week... but in MongoKitten's beta branch. We've been (re)working/optimising a lot lately, and backporting this would be a major pain.

@Joannis
Copy link
Member

Joannis commented Oct 13, 2016

Which MLab subscription are you using? This might be useful information for me if I decide on hiring a testing bench.

@sezgin-zz
Copy link
Author

sezgin-zz commented Oct 13, 2016

https://www.mlab.com/plans/
Dedicated
Cluster plans

Thanks all.

@Joannis
Copy link
Member

Joannis commented Oct 13, 2016

I definitely can't afford one of those 😬 But I'll have a look if I can manage to afford a shared replica for 15 dollars a month. I'm unsure if success on my side would translate into a success on your scale as well... but that's a worry for later.

@sezgin-zz
Copy link
Author

its same not free plans. you can test it, i think it give same result other plans, and mongokitten good now but it will be amazing 👍

@Joannis
Copy link
Member

Joannis commented Oct 13, 2016

Are you using SSL on your server? If that's the case then you should be using our beta 2.0.0. It'll be changing a lot in the coming days still. So if you're using this I'd recommend not running a production environment. But it'll have support for SSL when using swift build -c release -Xswiftc -DTLS on the CLI or when placing a TLS flag in the compiler conditions in your Xcode project as described here

@gabriellanata
Copy link
Contributor

gabriellanata commented Dec 3, 2016

Was this implemented? I am also trying to connect to a replica set on mlab. Using one of the $15 a month plans in mLab.

@Joannis
Copy link
Member

Joannis commented Dec 3, 2016

@gabriellanata it's not implemented as I don't have the financial capabilities to fund any (replica) servers at the moment.

@gabriellanata
Copy link
Contributor

I can create a mlab database with a replica set so you can use it for a few weeks to develop this functionality, if that is something you'd be willing to do. I know this is a feature that many users will not need, but i'd be very grateful as it is something we need to be able to scale in the future.

@Joannis
Copy link
Member

Joannis commented Dec 3, 2016

That would be really helpful for me! I could definitely use that to develop Replica Set functionality.

@gabriellanata
Copy link
Contributor

Sure! How can I contact you to share the details privately?

@Joannis
Copy link
Member

Joannis commented Dec 3, 2016

Using my email address at joannis@orlandos.nl

@Joannis Joannis self-assigned this Dec 4, 2016
@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

Working on it now! Thanks @gabriellanata

@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

@gabriellanata I've got connection string parsing working now and am able to connect to the first host in the replica set. I'll continue now to implement selecting the secondary. And I'm thinking of adding support for efficient querying so that read-only queries will not be sent exclusively to the primary but also to the secondaries, since they should have the same data.

@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

Which MongoKitten version do you run @gabriellanata ?

@gabriellanata
Copy link
Contributor

Awesome! mLab is running the latest version it allows: 3.2.11

@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

Are you using MongoKitten directly? Is there a need to back port these features to an earlier MongoKitten version? I'm working on the soon-to-be-released MongoKitten 3 branch for this feature now.

@gabriellanata
Copy link
Contributor

Oh sorry I thought you meant mongoDB version. I am currently running MongoKitten 2, would you consider MongoKitten 3 stable enough right now? We're still in a beta stage until the end of the year so I don't need this feature right this second. I have no problem with upgrading to version 3 as soon as it is available.

@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

I wouldn't consider MongoKitten 3 to be stable yet in every way. Aggregates are being worked on hard currently. The rest should be good to go. I'll work this into MongoKitten 3 now 👍

I've been able to query the collections now and am working on the more advanced parts of replica set support.

Amazing entries into the collection! 😂 Everyone around me look up when I laughed at that 😛

{"_id":{"$oid":"5843394fa18ccfaccc22ca5b"},"name":"Soft kitty"},
{"_id":{"$oid":"5843394fa18ccfaccc22ca5c"},"name":"Warm kitty"},
{"_id":{"$oid":"5843394fa18ccfaccc22ca5d"},"name":"Little ball of fur"},
{"_id":{"$oid":"5843394fa18ccfaccc22ca5e"},"name":"Happy kitty"},
{"_id":{"$oid":"5843394fa18ccfaccc22ca5f"},"name":{"$oid":"536c65657079204b69747479"}},
{"_id":{"$oid":"5843394fa18ccfaccc22ca60"},"name":"Purr purr purr"}

@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

@gabriellanata it's working!

@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

@gabriellanata If you'd like you can test MongoKitten alpha4 using .Package(url: "https://github.com/OpenKitten/MongoKitten.git", "3.0.0-alpha4").

I'll need to experiment a bit more before I'd mark it as "working", specifically with MongoKitten 3 coming soon with many changes still happening. More advanced features have not been tested yet using replicas for example. But I'll work towards it and I'll poke you when it works so that my testing instance can be disabled again.

@Joannis
Copy link
Member

Joannis commented Dec 4, 2016

I'm having trouble with emulating a disconnected primary server scenario. MongoDB should search for the primary again in the available provided servers.

@gabriellanata
Copy link
Contributor

I just sent you an email with info on how to access the mlab account and simulate a fail over

@Joannis Joannis closed this as completed Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants