정의
hello버전 4.2에 추가 되었습니다.
helloreturns a document that describes the role of themongodinstance. If the optional fieldsaslSupportedMechsis specified, the command also returns anarray of SASL mechanismsused to create the specified user's credentials.If the instance is a member of a replica set, then
helloreturns a subset of the replica set configuration and status including whether or not the instance is the primary of the replica set.When sent to a
mongodinstance that is not a member of a replica set,helloreturns a subset of this information.MongoDB drivers and clients use
helloto determine the state of the replica set members and to discover additional members of a replica set.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
참고
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { hello: 1 } )
The hello command accepts optional fields saslSupportedMechs: <db.user> to return an additional field hello.saslSupportedMechs in its result and comment <any> to add a log comment associated with the command.
db.runCommand( { hello: 1, saslSupportedMechs: "<db.username>", comment: <any> } )
The db.hello() method in mongosh provides a wrapper around hello.
행동
클라이언트 연결 해제
If the client that issued hello disconnects before the operation completes, MongoDB marks hello for termination using killOp.
출력
모든 인스턴스
The following hello fields are common across all roles:
hello.isWritablePrimary이 노드가 쓰기 가능한 시점을 보고하는 부울 값입니다.
true인 경우, 이 인스턴스는 복제본 세트의 프라이머리 인스턴스이거나mongos인스턴스 또는 독립형mongod입니다.인스턴스가 복제본 집합의 보조 멤버이거나 멤버가 복제본 집합의 중재자인 경우 이 필드는
false이(가) 됩니다.
hello.maxBsonObjectSizemongod프로세스에 대한BSON 객체의 최대 허용 크기(바이트)입니다. 제공되지 않을 경우 클라이언트는 최대 크기가 '16 * 1024 * 1024'인 것으로 가정해야 합니다.
hello.maxMessageSizeBytesBSON 유선 프로토콜 메시지의 최대 허용 크기입니다. 기본값은
48000000바이트입니다.
hello.maxWriteBatchSize쓰기 배치에 허용되는 최대 쓰기 작업 수입니다. 배치가 이 제한을 초과하면 클라이언트 드라이버는 배치를 이 필드 값보다 작거나 같은 수의 작은 그룹으로 나눕니다.
이 제한값은
100,000회 쓰기입니다.
hello.localTime로컬 서버 시간을 UTC로 반환합니다. 이 값은 ISO 날짜입니다.
hello.logicalSessionTimeoutMinutes세션이 가장 최근에 사용한 후 활성 상태로 유지되는 시간 (분). 클라이언트로부터 새 읽기/쓰기 작업을 받지 못했거나 이 임계값 내에서
refreshSessions로 새로 고쳐지지 않은 세션은 캐시에서 지워집니다. 만료된 세션과 관련된 상태는 언제든지 서버에 의해 정리될 수 있습니다.featureCompatibilityVersion이(가)"3.6"이상인 경우에만 사용할 수 있습니다.
hello.minWireVersion이
mongod또는mongos인스턴스가 클라이언트와 통신하는 데 사용할 수 있는 유선 프로토콜의 최신 버전입니다.Clients may use
minWireVersionto help negotiate compatibility with MongoDB.
hello.maxWireVersion이
mongod또는mongos인스턴스가 클라이언트와 통신하는 데 사용할 수 있는 유선 프로토콜의 최신 버전Clients may use
maxWireVersionto help negotiate compatibility with MongoDB.
hello.compression클라이언트와
mongod또는mongos인스턴스 간의 통신을 압축하는 데 사용되었거나 사용 가능한 압축 알고리즘(즉, 클라이언트와mongod또는mongos인스턴스 모두에 공통)을 나열하는 배열입니다.이 필드는 압축을 사용하는 경우에만 사용할 수 있습니다. 예시:
If the
mongodis enabled to use both thesnappy,zlibcompressors and a client has specifiedzlib, thecompressionfield would contain:"compression": [ "zlib" ] If the
mongodis enabled to use both thesnappy,zlibcompressors and a client has specifiedzlib,snappy, thecompressionfield would contain:"compression": [ "zlib", "snappy" ] If the
mongodis enabled to use thesnappycompressor and a client has specifiedzlib,snappy, thecompressionfield would contain :"compression": [ "snappy" ] mongod이(가)snappy압축기를 사용하도록 활성화되어 있고 클라이언트가zlib을(를) 지정했거나 클라이언트가 압축기를 지정하지 않은 경우 이 필드는 생략됩니다.
즉, 클라이언트가 압축을 지정하지 않거나 클라이언트가 연결된
mongod또는mongos인스턴스에 대해 활성화되지 않은 압축기를 지정하는 경우 필드가 반환되지 않습니다.
샤드 인스턴스
mongos instances add the following field to the hello response document:
복제본 세트
hello 은(는) 복제본 세트의 멤버가 반환할 때 다음 필드를 포함합니다.
hello.hosts숨김, 수동 또는 중재자가 아닌 복제본 세트의 모든 멤버를 나열하는
"[hostname]:[port]"형식의 문자열 배열입니다.Drivers use this array and the
hello.passivesto determine which members to read from.
hello.passivesmembers[n].priority이(가)0인 복제본 세트의 모든 멤버를 나열하는"[hostname]:[port]"형식의 문자열 배열입니다.이 필드는
members[n].priority가0인 멤버가 한 명 이상 있는 경우에만 표시됩니다.Drivers use this array and the
hello.hoststo determine which members to read from.
hello.arbiters중재자인 복제본 세트의 모든 구성원을 나열하는
"[hostname]:[port]"형식의 문자열 배열입니다.이 필드는 복제본 세트에 중재자가 한 명 이상 있는 경우에만 표시됩니다.
hello.primary복제본 세트의 현재 프라이머리 멤버를 나열하는
"[hostname]:[port]"형식의 문자열
hello.arbiterOnlyA boolean value that , when
true, indicates that the current instance is an arbiter. ThearbiterOnlyfield is only present, if the instance is an arbiter.
hello.passiveA boolean value that, when
true, indicates that the current instance is passive. Thepassivefield is only present for members with amembers[n].priorityof0.
hello.hiddenA boolean value that, when
true, indicates that the current instance is hidden. Thehiddenfield is only present for hidden members.
hello.tagstags문서에는 복제본 세트 멤버를 위한 사용자 정의 태그 필드와 값 쌍이 포함되어 있습니다.{ "<tag1>": "<string1>", "<tag2>": "<string2>",... } 읽기 작업의 경우, 읽기 설정에서 태그 세트를 지정하여 지정된 해당 태그가 있는 복제본 세트 멤버에게 작업을 지시할 수 있습니다.
쓰기 작업의 경우,
settings.getLastErrorModes및settings.getLastErrorDefaults를 사용하여 사용자 지정 쓰기 고려를 생성할 수 있습니다.
자세한 내용은 복제본 세트 태그 세트 구성에서 확인하세요.
hello.meThe
[hostname]:[port]of the member that returnedhello.
hello.electionIdA unique identifier for each election. Included only in the output of
hellofor the primary. Used by clients to determine when elections occur.
hello.lastWrite데이터베이스의 가장 최근 쓰기 작업에 대한 optime 및 날짜 정보가 포함된 문서입니다.
hello.lastWrite.opTime마지막 쓰기 작업의 optime을 제공하는 객체입니다.
hello.lastWrite.majorityWriteDatemajority읽기로 읽을 수 있는 마지막 쓰기 작업 시간을 포함하는 날짜 객체입니다.
ok 상태 필드, operationTime 필드, $clusterTime 필드에 대한 자세한 내용은 명령 응답을 참조하세요.