idealo / mongodb-performance-test

multithreaded test tool to test mongodb performances, such as throughput and latency
GNU Affero General Public License v3.0
85 stars 31 forks source link

Connect to replication set #3

Closed gms-roll-out closed 4 years ago

gms-roll-out commented 4 years ago

Hi,

Is it possible to connect a replication set ?

kagahd commented 4 years ago

Hello, the performance test is designed to run only against a single host. This makes it easier to detect performance differences caused by different mongodb versions or different hardware. However, the open source code can be easily adapted to connect against a replSet.

haveaguess commented 3 years ago

Hi, I tried to run against a single instance (primary) in a replica set but am getting an error is that because I can't do it this way ?

2021-01-28 09:26:23,166 [main] INFO  org.mongodb.driver.cluster - Cluster description not yet available. Waiting for 30000 ms before timing out
2021-01-28 09:26:23,362 [cluster-ClusterId{value='6012833fed763b6497463f6c', description='null'}-cluster0-shard-00-02.wjusn.mongodb.net:27017] INFO  org.mongodb.driver.cluster - Exception in monitor thread while connecting to server cluster0-shard-00-02.wjusn.mongodb.net:27017
com.mongodb.MongoSocketReadException: Prematurely reached end of stream
    at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:112) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:580) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:445) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:299) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:259) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:105) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:62) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:129) ~[mongodb-performance-test.jar:1.1.0]
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongodb-performance-test.jar:1.1.0]
    at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]
kagahd commented 3 years ago

You should be able to connect to a single instance (primary) of the replSet. I just tried it successfully. How is your command line or connection string?

haveaguess commented 3 years ago

Thanks for trying and quick reply

Im using :

java -jar mongodb-performance-test.jar -m insert -o 100 -t 10 20 -db testing -c meeting -u demo_db_user -p XXXX -h cluster0-shard-00-02.wjusn.mongodb.net

But actually having problems connecting using equivalent mongo command to connect to replica set primary

I guess I better go away and figure out why I can't get connected on CLI before bothering you, but open to ideas

Seeing:

ben.ritchie@Bens-MacBook-Pro  ~/Documents/dev/connect4  mongo cluster0-shard-00-02.wjusn.mongodb.net/meteor -u demo_db_user -p XXXX MongoDB shell version v4.4.3 connecting to: mongodb:// cluster0-shard-00-02.wjusn.mongodb.net:27017/meteor?compressors=disabled&gssapiServiceName=mongodb

*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

Error: network error while attempting to run command 'isMaster' on host ' cluster0-shard-00-02.wjusn.mongodb.net:27017' : connect@src/mongo/shell/mongo.js:374:17 @(connect):2:6 exception: connect failed

I've got whitelist as 0.0.0.0/0 and can connect using Compass

I checked auth and it's using SCRAM so I dont think it's SSL

On Thu, Jan 28, 2021 at 3:01 PM Kay Agahd notifications@github.com wrote:

You should be able to connect to a single instance (primary) of the replSet. I just tried it successfully. How is your command line or connection string?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/idealo/mongodb-performance-test/issues/3#issuecomment-769144053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAU6POBL2QJ7U6KBLFDN5LS4F35DANCNFSM4MY6PK7A .

kagahd commented 3 years ago

Using SCRAM does not say anything about using SSL or not. So if you use SSL, just add the parameter -ssl to your command.