서버 세션
개요
MongoDB's server sessions, or logical sessions, are the underlying framework used by client sessions to support Causal Consistency and retryable writes.
중요
Applications use client sessions to interface with server sessions.
Server sessions are available for replica sets and sharded clusters only.
Command Options
Starting in 3.6, MongoDB drivers associate all operations with a server session, with the exception of unacknowledged writes. The following options are available for all commands to support association with a server session:
중요
mongosh
and the drivers assign these options
to the commands in the session.
옵션 | 유형 | 설명 |
---|---|---|
| 문서 | The document that specifies the unique ID of the session
associated with the command. If the |
| 64비트 정수 | A strictly increasing non-negative number that uniquely identifies the command in the command's session. If specified, the command must also include the |
For the delete
, insert
, and update
commands that take an array of statements, the following option is also
available:
중요
Do not manually set stmtIds
. MongoDB sets the stmtIds
to be strictly increasing non-negative numbers.
옵션 | 유형 | 설명 |
---|---|---|
| Array of 32-bit integers | Array of numbers that uniquely identify their respective write operations within the write command. |
세션 명령
The following commands can be used to list, manage, and kill server sessions throughout MongoDB clusters:
명령. | 설명 |
---|---|
Expires specified server sessions. | |
Kills all server sessions. | |
Kills all server sessions that match the specified pattern. | |
Kills specified server sessions. | |
Refreshes idle server sessions. | |
Starts a new server session. |
Sessions and Access Control
If the deployment enforces authentication/authorization, the user must be authenticated to start a session, and only that user can use the session.
인증 사용자(Kerberos, LDAP 또는 X.사용자)와 함께 클라이언트 세션 및 인과적 일관성 보장을 $external
509 사용하려면 사용자 이름이 10k 바이트를 초과할 수 없습니다.
If the deployment does not enforce authentication/authorization, a created session has no owner and can be used by any user on any connection. If a user authenticates and creates a session for a deployment that does not enforce authentication/authorization, that user owns the session. However, any user on any connection may use the session.
If the deployment transitions to authentication without any downtime, any sessions without an owner cannot be used.