AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

db.shutdownServer() (mongosh 메서드)

버전 5.0에서 변경되었습니다.

db.shutdownServer()

Shuts down the current mongod or mongos process cleanly and safely. You must issue the db.shutdownServer() operation against the admin database.

db.shutdownServer() 에는 다음 구문이 있습니다.

db.shutdownServer({
force: <boolean>,
timeoutSecs: <int>
})

이 메서드는 다음과 같은 필드를 사용합니다.

필드
설명

선택 사항. mongod 또는 mongos 강제로 종료하려면 true로 지정합니다. 강제 종료는 mongod 또는 mongos에서 진행 중인 모든 작업을 중단하며, 예기치 않은 동작을 초래할 수 있습니다.

You can pause and resume in-progress index builds using force. See db.shutdownServer() on Replica Set Members for more information.

선택 사항.

MongoDB 5.0부터 mongod 및 mongos는 종료하기 전에 진행 중인 모든 데이터베이스 작업이 완료될 수 있도록 정지 기간을 입력합니다.

mongod 프라이머리가 종료 요청을 받으면 프라이머리는 다음을 수행합니다.

  1. 세컨더리로 단계를 낮추려고 시도합니다.

    강등이 실패하는 경우

  2. 휴지기에 들어갑니다.

  3. 남은 모든 데이터베이스 작업을 종료합니다.

  4. 종료합니다.

mongod 세컨더리 또는 mongos 종료 요청의 경우, 종료가 요청된 후 정지 기간이 입력됩니다.

정지 기간은 다음과 같이 지정됩니다.

클라이언트는 종료되는 mongod 또는 mongos에 대해 새 연결을 열 수 없습니다.

timeoutSecs specifies a time period in seconds. The default is:

  • MongoDB 5.0에서 15초.

  • MongoDB 5.0 이전 버전에서는 10초입니다.

mongod uses timeoutSecs as follows:

  • If the current node is the primary node of a replica set, mongod waits for a period of up to the number of seconds specified by the timeoutSecs field for an electable node to catch up before stepping down the primary node. For details about the catch up time, see replication lag.

  • If the current node is in the SECONDARY state after stepping down from being the primary, any remaining time specified in timeoutSecs is used for a quiesce period, which allows existing operations to complete. New operations are sent to other replica set nodes.

Starting in MongoDB 5.0, mongos uses timeoutSecs as a quiesce period, which allows existing operations to complete. New operations are sent to other mongos nodes. In MongoDB versions earlier than 5.0, mongos shuts down immediately and does not use timeoutSecs.

이 작업은 shutdown 명령 주위에 래퍼(wrapper)를 제공합니다.

이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

중요

This command is not supported in MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

For a mongod started with Authentication on Self-Managed Deployments, you must run db.shutdownServer() over an authenticated connection. See Access Control for more information.

For a mongod started without Authentication on Self-Managed Deployments, you must run db.shutdownServer() from a client connected to the localhost interface. For example, run mongosh with the --host "127.0.0.1" option on the same host machine as the mongod.

db.shutdownServer() fails if the mongod replica set member is running certain operations such as index builds. You can specify force: true to save index build progress to disk. The mongod recovers the index build when it restarts and continues from the saved checkpoint.

MongoDB 5.0부터 mongod 및 mongos는 종료하기 전에 진행 중인 모든 데이터베이스 작업이 완료될 수 있도록 정지 기간을 입력합니다.

mongod 프라이머리가 종료 요청을 받으면 프라이머리는 다음을 수행합니다.

  1. 세컨더리로 단계를 낮추려고 시도합니다.

    강등이 실패하는 경우

  2. 휴지기에 들어갑니다.

  3. 남은 모든 데이터베이스 작업을 종료합니다.

  4. 종료합니다.

mongod 세컨더리 또는 mongos 종료 요청의 경우, 종료가 요청된 후 정지 기간이 입력됩니다.

정지 기간은 다음과 같이 지정됩니다.

클라이언트는 종료되는 mongod 또는 mongos에 대해 새 연결을 열 수 없습니다.

timeoutSecs specifies a time period in seconds. The default is:

  • MongoDB 5.0에서 15초.

  • MongoDB 5.0 이전 버전에서는 10초입니다.

mongod uses timeoutSecs as follows:

  • If the current node is the primary node of a replica set, mongod waits for a period of up to the number of seconds specified by the timeoutSecs field for an electable node to catch up before stepping down the primary node. For details about the catch up time, see replication lag.

  • If the current node is in the SECONDARY state after stepping down from being the primary, any remaining time specified in timeoutSecs is used for a quiesce period, which allows existing operations to complete. New operations are sent to other replica set nodes.

Starting in MongoDB 5.0, mongos uses timeoutSecs as a quiesce period, which allows existing operations to complete. New operations are sent to other mongos nodes. In MongoDB versions earlier than 5.0, mongos shuts down immediately and does not use timeoutSecs.

경고

프라이머리 계정을 강제 종료하면 아직 세컨더리 계정으로 복제되지 않은 모든 쓰기가 롤백될 수 있습니다.

To run db.shutdownServer() on a mongod enforcing Authentication on Self-Managed Deployments, the authenticated user must have the db.shutdownServer() privilege. For example, a user with the built-in role hostManager has the appropriate permissions.

db.getSiblingDB("admin").shutdownServer()
db.getSiblingDB("admin").shutdownServer({ "force" : true })
db.getSiblingDB("admin").shutdownServer({ "timeoutSecs": 60 })
이 페이지 평가하기