반응형
MongoDB 간단하게 보기 위해 ReplicaSet 설정 진행
- 따로 샤딩 설정은 하지 않고, 설정들도 대부분 기본 값으로 설정한 내용
몽고디비 ReplicaSet 설정 방법
https://www.mongodb.com/docs/manual/administration/install-on-linux/
Install (Ubutun 20.04)
#!/bin/sh
wget -qO - <https://www.mongodb.org/static/pgp/server-5.0.asc> | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] <https://repo.mongodb.org/apt/ubuntu> focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl enable mongod
sudo systemctl start mongod
sudo systemctl status mongod
mongo.conf (/etc/mongo.conf)
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27017
bindIp: 0.0.0.0
processManagement:
timeZoneInfo: /usr/share/zoneinfo
replication:
replSetName: "{{REPLICATION 이름}}"
Mongo 한 노드에 접속해서→ replica set 초기화
rs.initiate( {
_id : "{{REPLICATION 이름}}",
members: [
{ _id: 0, host: "{{IP&DOMAIN+PORT}}" }, # 10.0.0.1:27017
{ _id: 1, host: "{{IP&DOMAIN+PORT}}" },
{ _id: 2, host: "{{IP&DOMAIN+PORT}}" }
]
})
반응형
'DBMS > MongoDB' 카테고리의 다른 글
[MongoDB] MongoDB 배포 형태 (0) | 2022.03.18 |
---|---|
[MongoDB] MongoDB - 복제 (1) (0) | 2022.02.09 |
[MongoDB] 샤딩 개념 (0) | 2022.02.08 |