You are not logged in.
Pages: 1
Hi Arnaud,
is mORMot prepared for this?
I got a connection but auth isn't possible (code 8000).
Connecting with mongo shell shows connecting to 3 servers (1 primary and 2 secondaries)
mongodb://xxxx-shard-00-00.yahvx.mongodb.net:27017,xxxx-shard-00-01.yahvx.mongodb.net:27017,xxxx-shard-00-02.yahvx.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-midqwv-shard-0&ssl=true
connectionstring should be:
"mongodb+srv://username:<password>@clustername.yahvx.mongodb.net/<dbname>?retryWrites=true&w=majority"
I've set hostname to xxxx-shard-00-00.yahvx.mongodb.net
and then OpenAuth('dbname', 'username', 'pass')
but I don't know if this is ok.
Thx,
Daniel
Offline
Now I can connect, but Command to Database results in
'{"ok":0,"errmsg":"user is not allowed to do action [find] on [Rottler.revenuesSalesOrders]","code":8000,"codeName":"AtlasError"}'
but user is Admin and definitely able to to this.
Is there anything other to note or does Database:= OpenAuth() and Database.RunCommand should be enough?
Offline
Primary/secondary servers are somewhat prepared, but we never tested it.
The connection string used by our unit is not following the MongoDB standard.
Perhaps some extension is needed for full testing and support of the connection.
Offline
Now I've understand the field SecondaryHostCSV and looked at the older driver connectionstrings.
There are 3 connections for the replicaSet and mORMot has 3 connections within the TMongoClient.
AuthSource should be admin. OpenAuth seems to work. I got a Database returned.
Now I Database.Client.Connections[0].RunCommand('RealDB',BSONVariant('{aggregate:"revenuesSalesOrders",pipeline:[{$match:{TaskTypeID:2}},],cursor:{}}'),v1);
Here it hangs at line
if not fSocket.TrySockRecv(@Header,HeaderLen) then (procedure TMongoConnection.GetReply(Request: TMongoRequest; out result: TMongoReply))
It would be a very nice, if mORMot could connect to Atlas because for a Share I've to work with 9 machines.
Perhaps you are willing to implement it?
Last edited by danielkuettner (2020-10-25 18:28:38)
Offline
9482 from 2020-06-17
I'll try current version and give you a feedback.
But for cluster we have to use DNS -type=SRV to get the IPs of the replica members. For Windows there is a function in windns.h.
Offline
With current mORMot I get an Exception in 5455 SynMongoDB (Header fields are all 0).
Offline
It seem to work. I can connect, authenticate, insert documents and aggregate them.
But how can I change the Database? The logic is actually OpenAuth and get a Database. Make request on the returned database. But OpenAuth needs database admin?
Last edited by danielkuettner (2020-10-26 10:35:37)
Offline
After upgrade M0 to M10 I cannot do OpenAuth (Error in SynWinSock at 1709 -> HandshakeLoop(aSocket).
The connectionstring hasn't changed generally, but replica set members got different url's (after upgrade to M10).
In server log I've found ->DisabledProtocols: "TLS1_0,TLS1_1"
Any ideas?
Last edited by danielkuettner (2020-10-26 16:40:49)
Offline
TLS version isn't the issue. I've turned back to TLS 1.0 in Atlas and cannot do OpenAuth
When I use free version (M0) in HandshakeLoop (1740) res has 590610 ($00090312).
With M10 res has 590624 ($00090320) -> SEC_I_INCOMPLETE_CREDENTIALS?
@Ab
Possible this link could help?
https://stackoverflow.com/questions/474 … als-unexpe
Sorry, now I've seen your comment in SynWinSock (1748)! This is what I need here.
Last edited by danielkuettner (2020-10-27 07:52:55)
Offline
Now it seems to work. After getting SEC_I_INCOMPLETE_CREDENTIALS I run InitializeSecurityContext again and get SEC_I_CONTINUE_NEEDED (as at using M0 version of Atlas).
Offline
All right!
Offline
But nevertheless I need the possibility for TMongoDatase.RunCommand to select the Databasename over a param.
Otherwise the OpenAuth should do the trick and use the admin database in background.
Offline
I've made a pull request on GitHub #326 to read from Slaves:
MongoDB.Client.Connections[0].RunCommand('DatabaseName', Command, Res, [mqfSlaveOk]);
Offline
I've made another pull request for using all connections of a cluster.
Offline
Pages: 1