mongodb / mongo-perf

performance tools for mongodb
350 stars 139 forks source link

[DOCS] Create More Detailed Installation and Usage Instructions #159

Open jspeed-meyers opened 4 months ago

jspeed-meyers commented 4 months ago

:wave: I'd be grateful for more detailed installation and usage instructions. I've been struggling to use the container that is created from the Dockerfile and I can't figure out if it's my own fault (user error) or a bug. I suspect that part of my confusion stems from sparse installation and usage instructions. Thank you for creating this cool project!

jspeed-meyers commented 4 months ago

I thought I would provide my intent, the steps I was following, and the error I encountered.

My intent: I am trying to connect the container built with the Dockerfile in this repo to a container running an instance of MongoDB.

The steps I followed:

I create a network for the containers to share.

docker network create my_network

I then start a mongo instance on this network.

docker run --name some-mongo -d -p 27017:27017 --network my_network mongo:latest

I build the image for the testing tool with the Dockerfile.

git clone https://github.com/mongodb/mongo-perf && cd mongo-perf

docker build --tag=mongo-perf/mongo-perf:test . 

I then run the newly created container.

docker run -it --network my_network mongo-perf/mongo-perf:test -f  testcases/simple_insert.js -t 1 2 4 --host localhost

The error:

MongoDB shell version v5.0.8
connecting to: mongodb://localhost:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server localhost:27017, connection attempt failed: SocketException: Error connecting to localhost:27017 (127.0.0.1:27017) :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
Error: Command '['mongo', '--norc', '--host', 'localhost', '--port', '27017', '--eval', "print('db version: ' + db.version()); db.serverBuildInfo().gitVersion;"]' returned non-zero exit status 1.

There’s a connection error. I’ve tried and failed to debug it.

I'm running this on an Apple M1 Pro (Sonoma 14.5) with Docker version 20.10.21, build baeda1f.

lsantosdemoura commented 3 months ago

Hey pal!

Your host is wrong, you should be using the name of your mongo container as host, in your case should be something like docker run -it --network my_network mongo-perf/mongo-perf:test -f testcases/simple_insert.js -t 1 2 4 --host some-mongo

That's all I can help though, I've been stuck in some other tests here, but as the README said its supposed to be an internal tool, I don't know if they are going to give any support for this

jspeed-meyers commented 3 months ago

Thank you, @lsantosdemoura!