How writes will be distributed across different shards when I use only mongoimport for write activity…?

StackOverflow https://stackoverflow.com/questions/9280211

  •  29-04-2021
  •  | 
  •  

Pergunta

we are going to use mongo db for an alert monitoring application.

We thought first to write the data to files and then to write it onto mongodb using mongoimport utility. Each file will have 1Mill records on an average.

Here my question is "shall we sharding here...?"

I guess mongoimport is not aware of sharding. How does sharding works when writes are happening by mongoimport...?

Foi útil?

Solução

If your collection exists and is sharded and you run mongoimport against a mongos router, then it will respect sharding rules (writes will be distributed according to chunk location).

Footnote

If you have a mongodb cluster, you have to have mongos daemon(s) in there. mongos reads your cluster configuration from config servers and knows where to route requests from your app. In a cluster configuration you should never talk to mongod servers directly, only via mongos. Read more about cluster configuration here.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top