I would like to measure the performance of MongoDb Atlas with the YCSB benchmark.For testing, I first performed the benchmark on ubuntu on a localhost mongo db instance, which works fine, so the benchmark seems to be set up correctly. Now I wanted to benchmark MongoDb in the cloud (MongoDb Atlas), but I am having problems connecting to the server. Since the YCSB benchmark is based on java, I wanted to use the java connection string of my cluster for the benchmark, which is
mongodb+srv://<user>:<password>@cluster0.swk7mjl.mongodb.net/?retryWrites=true&w=majority
(I have set and to my user credentials)
I tried to load the data for the benchmark with the following command:
./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb+srv://user:password@cluster0.swk7mjl.mongodb.net/?retryWrites=true&w=majority -p mongodb.auth="true" -p recordcount=1000 > outputLoad.txt
This generated the following error message:
ERROR: Invalid URL: 'mongodb+srv://cluster0.swk7mjl.mongodb.net/?retryWrites=true'. Must be of the form 'mongodb://<host1>:<port1>,<host2>:<port2>/database?options'. http://docs.mongodb.org/manual/reference/connection-string/
so I left out the srv
part and tried the command again:
./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://user:password@cluster0.swk7mjl.mongodb.net/?retryWrites=true&w=majority -p mongodb.auth="true" -p recordcount=1000 > outputLoad.txt
But this leads to the following error:
Exception while trying bulk insert with 0com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches PrimaryServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=cluster0.swk7mjl.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: cluster0.swk7mjl.mongodb.net}, caused by {java.net.UnknownHostException: cluster0.swk7mjl.mongodb.net}}]
I have also tried a variant with leaving out the credentials in the URL and setting them as the parameters mongodb.username
and mongodb.password
:
./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://cluster0.swk7mjl.mongodb.net/?retryWrites=true&w=majority -p mongodb.username=user -p mongodb.password=password -p mongodb.auth="true" -p recordcount=1000 > outputLoad.txt
But this leads to the same error.
In the network access of the MongoDb Atlas cluster, the IP address 0.0.0.0/0 is whitelisted, so access from everywhere should be possible. I can also connect to the cluster via the Mongo shell.
Does anyone has experience with the YCSB benchmark and knows what the correct connection string for the mongodb.url
parameter is or if I am missing something else?