Search code examples
mongodbsslibm-cloudmongoimportcompose-db

MongoImport Error: X509_STORE_add_cert:cert already in hash table


I am currently trying to import a group of JSON files containing data into my mongo database hosted on IBM Bluemix/Compose.

I have a script that runs through the files creating and then running a mongoimport command to import the files into the database, this works great against my local database(and indeed occasionally against the Compose database) however most of the time I get the following error -

2017-05-09T14:59:02.508+0100 Failed: error connecting to db server: SSL errors: x509 certificate routines:X509_STORE_add_cert:cert already in hash table x509 certificate

2017-05-09T14:59:02.508+0100 imported 0 documents

My mongoimport command looks like this -

mongoimport --batchSize 100 --ssl --sslAllowInvalidCertificates --host *censored* --collection Personnel --file data/TestData/Personnel_WICS.json -u admin -p *censored* -d MY_DB --authenticationDatabase admin

Is this a mongoimport error? Perhaps an issue with Compose? Or am I doing something incorrectly with the command?

I should note that the files I am importing range in size from 3mb-100mb, but even reducing the larger file sizes down by splitting them up does not seem to help.

My import script runs one import command immediately following the completion of the previous one, is there maybe some issue in running several back to back imports like this?


Solution

  • For anyone finding this in future - it looks like this may have been caused by a mismatch in mongo versions between the machine I'm running the mongoimport command from and the mongo database hosted in compose.

    Compose DB Version: 3.2

    Build server machine(running mongoimport): 3.4

    Downgrading the build server version has resolved the issue.