简体   繁体   中英

Connecting to Mongodb atlas from Node.js docker services

So I am learning node.js,docker and mongodb.And I have a few doubts. I have three tasks of a service(replicas) (node.js in docker services).The service is supposed to access a mongodb database.I have two options:

  1. Use atlas-this sounds simple to me as I am a beginner.
  2. Use mongodb containers-Which I believe could be a little more work.

So the question is if I use MongoDB atlas and connect to the database hosted on atlas is the transfer of data between node.js and atlas secure by default?what should be done to "secure" the transfer of data between the node.js container service and the Mongodb atlas? If I choose the second option above should all three replicas/tasks communicate with only ONE mongodb container?

is the transfer of data between node.js and atlas secure by default?

Without knowing your application environment, I can't comment about security on your side of the network.

However for MongoDB Atlas , it's using TLS/SSL and authentication ( SCRAM ) enabled by default (and cannot be disabled).

Traffic from clients to Atlas is authenticated and encrypted in-transit, and traffic between the customer's internally managed MongoDB nodes is also authenticated and encrypted in-transit using TLS/SSL.

Also depending on which cloud provider you would choose in Atlas (AWS, GCP, or Azure) they each provides different encryption at rest features ( transparent disk encryption ).

Please note that there are other security features provided by MongoDB Atlas, ie IP Whitelisting . See also MongoDB Atlas: Security Features and Setup and MongoDB Atlas Security Controls .

If I choose the second option above should all three replicas/tasks communicate with only ONE mongodb container?

I'm not sure I understand this question. The purpose of having a replica set is to provide High Availability (in the case of a primary failover, the other will automatically take over). Having all three nodes of replica set deployed into a single Docker container will defeat this purpose.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM