[SailsJS / sails-mongo]SNI name - mongodb

I'm trying to configure a MongoDB connection in SailsJS through sails-mongo, but no matter how I configure it, I'm getting this error.
MongoError: no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.
Could you assist me please?

The answer is in the error message. You are using a pre 3.4 driver. A v3.2 or v3.3 will not send the proper information to a v3.4 server instance.

Related

How to disable sniffing of elasticsearch in Monstache

I'm getting this error while using Monstache:
Unable to create Elasticsearch client: health check timeout: no Elasticsearch node available
I applied these lines to Monstache configuration:
elasticsearch-validate-pem-file = false
elasticsearch-healthcheck-timeout-startup = 200
elasticsearch-healthcheck-timeout = 200
However, I still encounter the mentioned error. When I searched about it, I found that the problem is due to sniffing in elasticsearch client. But I don't know where and how exactly I must change it?
I should denote that I studied this tutorial for this problem, but I'm still full of ambiguities.
The problem has been solved when I installed Monstache on the same local server on which the ELK stack was installed. Also, the MongoDB database on the remote server has been changed to a single node replica set to be able to connect to Monstache.
let's try to use
elastic.SetSniff(false)

How can I connect to an Atlas cluster with the SRV connection string format using ReactiveMongo?

I have a play scala app and i have an atlas cluster which i am trying to connect. According to the ReactiveMongo this is possible. I can add my connection string gotten from Atlas to my app via
mongodb.uri
In my application.conf file. I have tried everything based on the instructions from reactivemongo and atlas db but i am still unable to connect to the cluster. using my mongoshell however, i am able to connect and have access to my db but it simply refuses to connect via my app.
Mongo simply returns an error "MongoError['No primary node is available! (Supervisor-13/Connection-14)']" } and logs a warning in my console Some options were ignored because they are not supported (yet): w, retryWrites. I am using scala version 2.12 and reactivemongo 0.12.6 with play 2.6.
My connection string is mongodb+srv://<username>:<password>#my-cluster.abo25.mongodb.net/my-db?retryWrites=true&w=majority
Any info or help would be greatly appreciated.
Solved my problem. It turns out the +srv string format works seamlessly from reactivemongo version 0.17 and i was initially on 0.16. After i upgraded (and also upgraded my code), i was able to connect to my cluster. I also found out one of the user credentials i was using was wrong so that plus the upgrade got me up and running.

MongoDB Connection Error

When i try to connect to mongodb (after setting Database, Username, Password, Server and Port values) with FDConnection i get [FireDAC][Phys][Mongo]The authentication mechanism "SCRAM-SHA-1" is not supported.. error.
If I set UseSSL option to True and try again this time I get [FireDAC][Phys][Mongo]SSL is not enabled in this build of mongo-c-driver.. error.
In the same computer I can connect to MongoDB with MongoBooster (with Basic Authentication)
SCRAM-SHA-1 authentication mechanism
Upgrade to the latest mongo-c-driver (or at least version 1.1.0) because the one you use does not support SCRAM-SHA-1 authentication mechanism (which is what the driver exception says). And since it was introduced and became default authentication mechanism in MongoDB 3.0, you must be using old driver against new DBMS.
MONGODB-CR authentication mechanism
Upgrade to the latest mongo-c-driver (or at least version 1.1.0) for reason desribed above. Since MONGODB-CR is no longer default authentication mechanism, you need to explicitly specify it by setting authMechanism to MONGODB-CR.
So if you want basic authentication, you need to specify this in the MongoAdvanced parameter:
...
FDConnection1.Params.Add('MongoAdvanced=authMechanism=MONGODB-CR');
FDConnection1.Connected := True;
Evidence about outdated driver
Following links point to corresponding source code lines where you can find evidence about your outdated driver:
version 1.0.2 - The authentication mechanism "SCRAM-SHA-1" is not supported message will be returned due to missing SCRAM-SHA-1 mechanism.
version 1.1.0 - no such message will be shown, because SCRAM-SHA-1 mechanism exists.
version 1.6.3 - in current version, the message sounds Unknown authentication mechanism.
So, that message The authentication mechanism "SCRAM-SHA-1" is not supported you can get with driver version older than 1.1.0. Build the driver from the latest stable source and set the library path to the VendorLib property of your physical driver link component.
Something like this (don't be confused by the version in the library name, authors keep it outdated, but it may change in the future):
FDPhysMongoDriverLink1.VendorLib := 'C:\PathToDriver\libmongoc-1.0.dll';

Mongo Spark connector with several hosts

I try to connect Spark to MongoDB using mongo-spark-connector_2.10-2.0.0 but it doesn't work when I have several hosts in the URI
My URI looks like that :
mongodb://login:password#cluster0-shard-0xxxxx:27017,cluster0-shard-0yyyyy:27017,cluster0-shard-0zzzzz:27017/database?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin
and I get errors like this
Command failed with error 8000: &apos;no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.&apos; on server cluster0-shard-0xxxxx
It works fine with other URIs that only have 1 host.
The problem was that I was using Atlas Free tier that requires SNI, which is not supported by the Mongo Java driver currently used by mongo-spark-connector_2.10-2.0.0.

Error trying to load driver for generic database configuration in Mule

I am using Mule 3.6 and would like to use the bulk insert option on the Generic Database Configuration to load data into mongodb 3.0.8.
I have entered the URL as:
jdbc:mongo://localhost:27017/test
and have tried a number of different Mongo and JDBC drivers but keep receiving the message "Test connection failed. Error trying to load driver..."
How can I configure the Generic Database Connector in Mule to connect to Mongo?
As already stated in this post, there is no official JDBC driver for MongoDB but one the suggested alternatives is using UnityJDBC.
If you decide to follow the UnityJDBC approach, then:
Download and install the driver by executing the following command:
java -jar UnityJDBC_Trial_Install.jar
Go to the installation folder and copy mongodb_unityjdbc_full.jar to the classpath of your Mule app.
Configure the URL and Driver in the Global Element of your Generic Database component (the values you provided are OK):
URL: jdbc:mongo://<host>:<port>/<database>
Driver Class Name: mongodb.jdbc.MongoDriver
If not, use the MongoDB Connector as suggested by #JoostD.
You need to use the MongoDB connector, it should be included in studio.
Otherwise install it from the Anypoint Exchange:
https://www.mulesoft.com/exchange/#!/mongodb-integration-connector
Also see some example on it:
https://www.mulesoft.com/exchange/#!/importing-csv-into-mongodb