WEBBOOK CHAPTER

MongoDB 8.2, 입문에서 시니어까지: 2장. mongosh와 Replica Set 로컬

2장. mongosh와 Replica Set 로컬

transaction과 change stream 실습을 위해 standalone이 아닌 single-node replica set으로 시작한다. docker compose up -d --wait는 database health 뒤 별도 mongo-init service가 rs.initiate를 실행하고 primary가 될 때까지 기다린 다음 seed를 넣는다. database entrypoint에서 initiate 직후 쓰면 election 전 not primary 경쟁 조건이 생기기 때문이다. host 기본 port는 57017이며 MONGO_PORT로 바꿀 수 있다. rs.status, db.runCommand({ping:1})를 이해한다.

production과 local 인증·TLS 차이를 문서화한다. compose volume 삭제는 데이터 삭제다.