- mongod: ํต์ฌ ๋ฐ์ดํฐ๋ฒ ์ด์ค ํ๋ก์ธ์ค
- mongos: ์ค๋ฉ๋ ํด๋ฌ์คํฐ์ฉ ์ปจํธ๋กค๋ฌ ๋ฐ ์ฟผ๋ฆฌ ๋ผ์ฐํฐ
- mongosh: interactive shell
mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.
This document provides a complete overview of all command line options for mongod. These command line options are primarily useful for testing: In common operation, use the configuration file options to control the behavior of your database.
mongod๋ MongoDB ์์คํ
์ ๊ธฐ๋ณธ ๋ฐ๋ชฌ ํ๋ก์ธ์ค.
๋ฐ์ดํฐ ์์ฒญ์ ์ฒ๋ฆฌํ๊ณ ๋ฐ์ดํฐ ์ก์ธ์ค๋ฅผ ๊ด๋ฆฌํ๋ฉฐ ๋ฐฑ๊ทธ๋ผ์ด๋ ๊ด๋ฆฌ ์์
์ ์ํ.
config ํ์ผ์ ์ด์ฉํ์ฌ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๋์์ ์ ์ด.
For a sharded cluster, the mongos instances provide the interface between the client applications and the sharded cluster. The mongos instances route queries and write operations to the shards. From the perspective of the application, a mongos instance behaves identically to any other MongoDB instance.
mongos instance ๋ผ๊ณ Document ์์๋ ์ค๋ช
ํ๋๋ฐ ์ค๋ฉ๋ ๋
ธ๋(machine)๋ผ๊ณ ์๊ฐํ๋ฉด ์ฌ์.
์ค๋ฉ๋ ํด๋ฌ์คํฐ์ ๊ฒฝ์ฐ mongos ์ธ์คํด์ค๋ ํด๋ผ์ด์ธํธ ์ ํ๋ฆฌ์ผ์ด์
๊ณผ ์ค๋ฉ๋ ํด๋ฌ์คํฐ ๊ฐ์ ์ธํฐํ์ด์ค ์ ๊ณต.
mongos ์ธ์คํด์ค๋ ์ฟผ๋ฆฌ ๋ฐ ์ฐ๊ธฐ ์์
์ ์ค๋๋ก ๋ผ์ฐํ
.
์ ํ๋ฆฌ์ผ์ด์
์ ๊ด์ ์์ mongos ์ธ์คํด์ค๋ ๋ค๋ฅธ MongoDB ์ธ์คํด์ค์ ๋์ผํ๊ฒ ์๋!
- ๊ทผ๋ฐ ์๊ธฐ์
์ค๋ฉ
์ด๋?
์ค๋ฉ
์๋ฐ์ดํฐ๋ฅผ ์ฌ๋ฌ ์๋ฒ์ ๋ถ์ฐํด์ ์ ์ฅํ๊ณ ์ฒ๋ฆฌํ ์ ์๋ ๊ธฐ์
์ ๋ปํจ! ๋ณต์ (Replication)์์ ์ฐจ์ด์ ์ด ์๋ค๋ฉด ๋ณต์ ๋ ๊ณ ๊ฐ์ฉ์ฑ์ ์ํ ์๋ฃจ์ ,์ค๋ฉ์ ๋ถ์ฐ์ฒ๋ฆฌ๋ฅผ ์ํ ์๋ฃจ์
! (๋ชฝ๊ณ ๋๋น์์๋ ๊ณ ๊ฐ์ฉ์ฑ๊ณผ ๋์ฉ๋ ๋ถ์ฐ ์ฒ๋ฆฌ๋ฅผ ์ํด ๋ณต์ +์ค๋ฉ ๋ชจ๋ ์ฌ์ฉ!
)- ๋ถ์ฐ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ์ 2๊ฐ์ง vertical scaling(์์งํ์ฅ), horizontal scaling(์ํํ์ฅ)!
๋ชฝ๊ณ ๋๋น์์๋ ์ค๋ฉ์ ํตํด ์ํํ์ฅ์ ์ง์
The MongoDB Shell, mongosh, is a fully functional JavaScript and Node.js 14.x REPL environment for interacting with MongoDB deployments. You can use the MongoDB Shell to test queries and operations directly with your database.
MongoDB shell ์ธ mongosh๋ MongoDB ๋ฐฐํฌ์ ์ํธ ์์ฉํ๊ธฐ ์ํ ๋ชจ๋ ๊ธฐ๋ฅ์ ๊ฐ์ถ JavaScript ๋ฐ Node.js 14.x REPL ํ๊ฒฝ.
MongoDB ์
ธ์ ์ฌ์ฉํ์ฌ ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ ์ง์ ์ฟผ๋ฆฌ ๋ฐ ์์
.
SQL์์ ์ฐ๋ ๊ฐ๋
๋ฐ ์ฉ์ด, MongoDB ์์ ์ฐ๋ ์ฉ์ด ๋ฐ ๊ฐ๋
์ด ๋น์ทํ๋ฉด์ ๊ฝค ๋ค๋ฅด๋น ! ์ ๋ฆฌ๋ฅผ ํด๋ณผ๊น....?๐ฅ
1) insert
db.collection.insertOne()
db.collection.insertMany()
# ์ฌ๊ธฐ์ collection์ ํ
์ด๋ธ์ ๋ปํ๊ณ , ๊ธฐ์กด์ ์๋ table์ด๋ผ๋ฉด ๊ฑฐ๊ธฐ์ ๊ฐ์ด ๋ค์ด๊ฐ๊ณ ์๋ table์ด๋ผ๋ฉด ์๋ก ์์ฑ๋์ด์ ๋ค์ด๊ฐ!
# ์ ๊ธฐํ๊ฒ ํ๋๋ง ๋ฃ๋ ๋ช
๋ น์ด๊ฐ ๋ฐ๋ก, ์ฌ๋ฌ๊ฐ ๋ฃ๋ ๋ช
๋ น์ด๊ฐ ๋ฐ๋ก์!
2) read
-> find๋ผ๋ ํจ์๋ฅผ ํตํด ๋์์ ์ํ
db.collection.find()
ex)
db.mango.insertOne({x:'starbucks'})
db.mango.find({x:'starbucks'}) # ์ด๊ฑด ํน์ ๊ฐ ์กฐํ
db.mango.find({}) # ์ด๊ฑด ์ ์ฒด ์กฐํ
# ํด๋น ๊ฐ์ด ์์ผ๋ฉด ์๋ฌด๊ฒ๋ ๋ฆฌํด ์ํจ
select
update
delete
์ฐธ๊ณ 1: https://docs.mongodb.com/manual/reference/program/mongod/#mongodb-binary-bin.mongod
์ฐธ๊ณ 2: https://junghwanta.tistory.com/30?category=857330