So, to start of, I have 2 machines; 1 with the file that is to be imported, and the other hosting a MongoDB instance.
The MongoDB instance is native and running on port 27017. There is no clustering, no SSL enabled. The machine with the file can successfully telnet HOST 27017 without any issues.
To confirm that there are no problems with the machine with the file connecting to the MongoDB instance, I can successfully run the following:
mongosh --host=HOST_IP --port=27017 --username=USERNAME --password="PASSWORD" --authenticationDatabase=admin
All that is left is to actually do the import, so I run the following:
mongoimport --host=HOST_IP --port=27017 --username=USERNAME --password="PASSWORD" --authenticationDatabase=admin --db=DATABASE --collection=COLLECTION --numInsertionWorkers=3 --type=csv --mode=insert --headerline --file=FILENAME.csv
However, at this stage, it fails. This is the result when I run the above with a -vvvvv flag:
using 4 decoding workers
using 3 insert workers
filesize: 123456 bytes
using fields: A,B,C
will listen for SIGTERM, SIGINT, and SIGKILL
[........................] DATABASE.COLLECTION 4.00KB/123KB (0.7%)
[........................] DATABASE.COLLECTION 4.00KB/123KB (3.25%)
Failed: error connecting to db server: no reachable servers
imported 0 documents
How strange. I can mongosh in just fine, but the mongoimport fails. I changed the connection arguments into a URI just to try it out, but it doesn't help. Curious if the MongoDB instance is even detecting a connection attempt, I check the logs, and I see records which matches the time that come in pairs with the messages Connection accepted followed by Connection ended.
Since I have access to both devices at this point in time, I transfer the file over and run the same command, but I change the host to 127.0.0.1, with every other argument remaining the same. And that works without any issues whatsoever.
But I can't do so on said machine moving forward; it needs to be a remote import. But I've hit a wall here, and I have no clue what else to try. Has anybody encountered this issue before, or have any suggestion on what I can try? Any help would be appreciated. Thanks.
Edit: As requested, here is the mongo.conf file with the comments removed:
storage:
dbPath: C:\Program Files\MongoDB\Server\6.0\data
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: C:\Program Files\MongoDB\Server\6.0\log\mongod.log
net:
port: 27017
bindIp: 0.0.0.0
security:
authorization: "enabled"