Mongo Spark connector with several hosts - mongodb

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: 'no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.' 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.

Related

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.

Connecting to AWS Managed Cassandra with Perl

I am trying to connect to AWS Managed Cassandra using Perl. It's not working due to a vague error Error 0: Internal Server Error.
Using the DBD::Cassandra Library, I can connect to self hosted Cassandra clusters, but not AWS Cassandra. I think I have the AWS Root CA correct because it verifies with openssl s_client -connect cassandra.us-east-1.amazonaws.com:9142
DBI->connect("dbi:Cassandra:host=cassandra.us-east-1.amazonaws.com;port=9142;tls=1;keyspace=keyspace",
"**username**", "**password**");
The error response from the connection is
Unable to connect to any Cassandra server.
Last error: On cassandra.us-east-1.amazonaws.com:
Error 0: Internal Server Error
I can also connect using the cqlsh client and verified that the connection details are correct.
Any hints or a working example would be very helpful.
The issue appears to be setting the keyspace. Doing this either on the connection or subsequently with use keyspace results in a Error 0: Internal Server Error response from the server.
Also note that AWS Managed Cassandra only supports consistency local_quorum. The following will result in a valid connection:
DBI->connect("dbi:Cassandra:host=cassandra.us-east-1.amazonaws.com;
port=9142;tls=1;consistency=local_quorum",
"**username**", "**password**");
Since there are issues setting the keyspace, tables must be referenced using keyspace.tablename in queries.

Authentication DB setting not working using mongoDB URI configuration

I am triyng to connect pyeve with a MongoDB Atlas replica set (https://cloud.mongodb.com/). I've connected successfully DB management tools from the same host, to make sure the deployment is working OK.
One particularity is that using Atlas, all users must authenticate against auth database, I cannot put my users in the application database, so I need to set authSource in MONGO_URI.
Now, when defining the MONGO_URI for the replica set, in settings.py, like this:
MONGO_URI = mongodb://<USER>:<PASS>#my-shard-00-00-tlati.mongodb.net:27017,my-shard-00-01-tlati.mongodb.net:27017,my-shard-00-02-tlati.mongodb.net:27017/<MY_DB>?ssl=true&replicaSet=my-shard-0&authSource=admin
The authSource=admin parameter seems to be ignored, (I've checked debugging pymongo's auth and the authentication source used is None).
MONGO_AUTH_SOURCE could be used to set the authorization database, but it has no effect since MONGO_URI is used in preference of the other configuration variables, according to eve's documentation.
Is this an issue or am I doing it wrong?
Found out that the problem was that I was using version 0.4.1 for flask-pymongo. Updating it to version 0.5.1 fixed the problem.

[SailsJS / sails-mongo]SNI name

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.

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