샤드 클러스터 접속

샤드 클러스터는 반드시 mongos 라우터를 통해서 접속해야한다. 클라이언트는 단일 샤드에 접속하여 명령을 날려서는 안된다. 왜냐하면, 샤딩 데이터가 망가질 수 있기 때문이다.

mongos 라우터에 접속하는 방법은 mongod에 접속하는 방법과 동일하다.

You must connect to a mongos router to interact with any collection in the sharded cluster. This includes sharded and unsharded collections. Clients should never connect to a single shard in order to perform read or write operations. You can connect to a mongos the same way you connect to a mongod, such as via the mongo shell or a MongoDB driver.