문서 메뉴

문서 홈애플리케이션 개발MongoDB 매뉴얼

명령줄 옵션을 YAML로 변환하기

MongoDB 4.2부터 mongodmongos--outputConfig 명령줄 옵션을 허용하여 mongod / mongos 인스턴스에서 사용하는 구성을 출력합니다.

이 옵션을 사용하여 명령줄 옵션을 YAML 구성으로 변환할 수 있습니다.

명령줄 옵션을 사용하는 다음 mongod 호출을 고려하세요.

mongod --shardsvr --replSet myShard --dbpath /var/lib/mongodb --bind_ip localhost,My-Example-Hostname --fork --logpath /var/log/mongodb/mongod.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file

--outputConfig 명령줄 옵션을 포함하여 해당 YAML 파일을 생성합니다.

mongod --shardsvr --replSet myShard --dbpath /var/lib/mongodb --bind_ip localhost,My-Example-Hostname --fork --logpath /var/log/mongodb/mongod.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file --outputConfig

mongod 는 다음 YAML을 stdout 로 출력하고 종료합니다.

net:
bindIp: localhost,My-Example-Hostname
tls:
CAFile: /path/to/my/CA/file
certificateKeyFile: /path/to/my/certificate/file
clusterFile: /path/to/my/cluster/membership/file
mode: requireTLS
outputConfig: true
processManagement:
fork: true
replication:
replSet: myShard
security:
clusterAuthMode: x509
sharding:
clusterRole: shardsvr
storage:
dbPath: /var/lib/mongodb
systemLog:
destination: file
path: /var/log/mongodb/mongod.log

구성 파일을 만들려면 생성된 콘텐츠를 파일에 복사하고 YAML에서 outputConfig 설정을 삭제합니다.

명령줄 옵션을 사용하는 다음 mongos 호출을 고려하세요.

mongos --configdb myCSRS/cfg1.example.net:27019,cfg2.example.net:27019 --bind_ip localhost,My-Example-MONGOS-Hostname --fork --logpath /var/log/mongodb/mongos.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file

--outputConfig 명령줄 옵션을 포함하여 mongos 인스턴스에 해당하는 YAML을 생성합니다.

mongos --configdb myCSRS/cfg1.example.net:27019,cfg2.example.net:27019 --bind_ip localhost,My-Example-MONGOS-Hostname --fork --logpath /var/log/mongodb/mongos.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file --outputConfig

mongos 는 다음 YAML을 stdout 로 출력하고 종료합니다.

net:
bindIp: localhost,My-Example-MONGOS-Hostname
tls:
CAFile: /path/to/my/CA/file
certificateKeyFile: /path/to/my/certificate/file
clusterFile: /path/to/my/cluster/membership/file
mode: requireTLS
outputConfig: true
processManagement:
fork: true
security:
clusterAuthMode: x509
sharding:
configDB: myCSRS/cfg1.example.net:27019,cfg2.example.net:27019
systemLog:
destination: file
path: /var/log/mongodb/mongos.log

구성 파일을 만들려면 생성된 콘텐츠를 파일에 복사하고 YAML에서 outputConfig 설정을 삭제합니다.

← 외부에서 가져온 구성 파일 값