Docs Menu
Docs Home
/
MongoDB ๋งค๋‰ด์–ผ
/ / / /

SUSE์— MongoDB Community Edition ์„ค์น˜

์ด ํŽ˜์ด์ง€์˜ ๋‚ด์šฉ

  • ๊ฐœ์š”
  • ๊ณ ๋ ค ์‚ฌํ•ญ
  • MongoDB Community Edition ์„ค์น˜
  • MongoDB Community Edition ์‹คํ–‰
  • MongoDB Community Edition ์ œ๊ฑฐ
  • ์ถ”๊ฐ€ ์ •๋ณด

์ฐธ๊ณ 

MongoDB Atlas

MongoDB Atlas ๋Š” ํด๋ผ์šฐ๋“œ์—์„œ ํ˜ธ์ŠคํŒ…๋˜๋Š” MongoDB ์„œ๋น„์Šค ์˜ต์…˜์œผ๋กœ, ์„ค์น˜ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š์œผ๋ฉฐ ํ”„๋ฆฌ ํ‹ฐ์–ด์„ ์ œ๊ณตํ•˜์—ฌ ๋ฐ”๋กœ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด ํŠœํ† ๋ฆฌ์–ผ์„ ํ†ตํ•ด zypper ํŒจํ‚ค์ง€๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ SUSE Linux Enterprise Server์— MongoDB 6.0 MongoDB Community Edition์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

์ด ํŠœํ† ๋ฆฌ์–ผ์—์„œ๋Š” MongoDB 7.0 Community ์—๋””์…˜์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋ฒ„์ „์˜ MongoDB Community๋ฅผ ์„ค์น˜ํ•˜๋ ค๋ฉด ํŽ˜์ด์ง€ ์™ผ์ชฝ ์ƒ๋‹จ์˜ ๋ฒ„์ „ ๋“œ๋กญ๋‹ค์šด ๋ฉ”๋‰ด์—์„œ ํ•ด๋‹น ๋ฒ„์ „์— ๋Œ€ํ•œ ๋ฌธ์„œ๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ฐธ๊ณ 

EOL Notice

  • MongoDB 5.0 MongoDB Community Edition ์€ s390x์—์„œ SLES12 ์— ๋Œ€ํ•œ ์ง€์› ์„ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

MongoDB 6.0 MongoDB Community Edition์€ x86_64 ์•„ํ‚คํ…์ฒ˜์—์„œ ๋‹ค์Œ 64๋น„ํŠธ SUSE Linux Enterprise Server ๋ฆด๋ฆฌ์Šค๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

  • SLES 15

  • SLES 12

MongoDB๋Š” ์ด๋Ÿฌํ•œ ํ”Œ๋žซํผ์˜ 64๋น„ํŠธ ๋ฒ„์ „๋งŒ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

์ž์„ธํ•œ ์ •๋ณด๋Š” ํ”Œ๋žซํผ ์ง€์›์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ”„๋กœ๋•์…˜ MongoDB ๋ฐฐํฌ์— ๋Œ€ํ•œ ์„ฑ๋Šฅ ๊ณ ๋ ค ์‚ฌํ•ญ ๋ฐ ๊ตฌ์„ฑ ๊ถŒ์žฅ ์‚ฌํ•ญ์„ ์ œ๊ณตํ•˜๋Š” ์ž์ฒด ๊ด€๋ฆฌํ˜• ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ํ”„๋กœ๋•์…˜ ๋…ธํŠธ ๋ฌธ์„œ๋ฅผ ๊ฒ€ํ† ํ•œ ์ดํ›„์— ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์— MongoDB๋ฅผ ๋ฐฐํฌํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ๋‹จ๊ณ„์— ๋”ฐ๋ผ zypper ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ์ž๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ MongoDB Community Edition์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

1
sudo rpm --import https://pgp.mongodb.com/server-6.0.asc
2

MongoDB๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ ์ค‘์ธ SUSE ๋ฒ„์ „์— ์ ํ•ฉํ•œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

sudo zypper addrepo --gpgcheck "https://repo.mongodb.org/zypper/suse/15/mongodb-org/6.0/x86_64/" mongodb
sudo zypper addrepo --gpgcheck "https://repo.mongodb.org/zypper/suse/12/mongodb-org/6.0/x86_64/" mongodb

4.0 ์™€ ๊ฐ™์€ ์ด์ „ ์ถœ์‹œํ•˜๋‹ค ์‹œ๋ฆฌ์ฆˆ ์˜ MongoDB ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜๋ ค๋ฉด ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ๊ตฌ์„ฑ์—์„œ ์ถœ์‹œํ•˜๋‹ค ์‹œ๋ฆฌ์ฆˆ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด, SUSE 12 ์‹œ์Šคํ…œ์„ 4.0 ๋ฆด๋ฆฌ์Šค ์‹œ๋ฆฌ์ฆˆ๋กœ ์ œํ•œํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

sudo zypper addrepo --no-gpgcheck "https://repo.mongodb.org/zypper/suse/12/mongodb-org/4.0/x86_64/" mongodb
3

์ตœ์‹  ๋ฒ„์ „์˜ MongoDB๋ฅผ ์„ค์น˜ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์„ธ์š”.

sudo zypper -n install mongodb-org

ํŠน์ • ๋ฆด๋ฆฌ์Šค์˜ MongoDB๋ฅผ ์„ค์น˜ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๊ฐ™์ด ๊ฐ ๊ตฌ์„ฑ ์š”์†Œ ํŒจํ‚ค์ง€๋ฅผ ๊ฐœ๋ณ„์ ์œผ๋กœ ์ง€์ •ํ•˜๊ณ  ํŒจํ‚ค์ง€ ์ด๋ฆ„์— ๋ฒ„์ „ ๋ฒˆํ˜ธ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

sudo zypper install mongodb-org-6.0.17 mongodb-org-database-6.0.17 mongodb-org-server-6.0.17 mongodb-org-mongos-6.0.17 mongodb-org-tools-6.0.17

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  ๋ฒ„์ „์˜ MongoDB๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ zypper์€(๋Š”) ์ตœ์‹  ๋ฒ„์ „์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜๋ฉด ํŒจํ‚ค์ง€๋ฅผ ์—…๊ทธ๋ ˆ์ด๋“œํ•ฉ๋‹ˆ๋‹ค. ์˜๋„ํ•˜์ง€ ์•Š์€ ์—…๊ทธ๋ ˆ์ด๋“œ๋ฅผ ๋ฐฉ์ง€ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ ํŒจํ‚ค์ง€๋ฅผ ๊ณ ์ •ํ•˜์„ธ์š”.

sudo zypper addlock mongodb-org-6.0.17 mongodb-org-database-6.0.17 mongodb-org-server-6.0.17 mongodb-org-mongos-6.0.17 mongodb-org-tools-6.0.17

์ด์ „ ๋ฒ„์ „์˜ MongoDB ํŒจํ‚ค์ง€๋Š” ๋‹ค๋ฅธ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์œ„์น˜๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ ์ค‘์ธ MongoDB ๋ฒ„์ „์— ๋งž๋Š” ๋ฌธ์„œ ๋ฒ„์ „์„ ์ฐธ์กฐํ•˜์„ธ์š”.

ulimit ๊ณ ๋ ค ์‚ฌํ•ญ
๋Œ€๋ถ€๋ถ„์˜ Unix ๊ณ„์—ด ์šด์˜ ์ฒด์ œ๋Š” ํ”„๋กœ์„ธ์Šค ๊ฐ€ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์‹œ์Šคํ…œ ๋ฆฌ์†Œ์Šค๋ฅผ ์ œํ•œํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ œํ•œ์€ MongoDB ์ž‘์—…์— ๋ถ€์ •์ ์ธ ์˜ํ–ฅ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์กฐ์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ”Œ๋žซํผ์— ๊ถŒ์žฅ ๋˜๋Š” ์„ค์ •์€ ์ž์ฒด ๊ด€๋ฆฌ ๋ฐฐํฌ์„œ๋ฒ„๋ฅผ ์œ„ํ•œ UNIX ulimit ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.

์ฐธ๊ณ 

์—ด๋ ค ์žˆ๋Š” ํŒŒ์ผ ์ˆ˜์˜ ulimit ๊ฐ’์ด 64000 ๋ฏธ๋งŒ์ธ ๊ฒฝ์šฐ MongoDB๊ฐ€ ์‹œ์ž‘ ๊ฒฝ๊ณ ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
๋””๋ ‰ํ† ๋ฆฌ
๊ธฐ๋ณธ์ ์œผ๋กœ MongoDB ์ธ์Šคํ„ด์Šค๋Š” ๋‹ค์Œ์„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
  • ๋ฐ์ดํ„ฐ ํŒŒ์ผ: /var/lib/mongo

  • ๋กœ๊ทธ ํŒŒ์ผ: /var/log/mongodb

ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ์ž๋ฅผ ํ†ตํ•ด ์„ค์น˜ํ•œ ๊ฒฝ์šฐ ์ด๋Ÿฌํ•œ ๊ธฐ๋ณธ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์„ค์น˜ ์ค‘์— ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ํƒ€๋ฅด๋ณผ์„ ๋‹ค์šด๋กœ๋“œํ•˜์—ฌ ์ˆ˜๋™์œผ๋กœ ์„ค์น˜ํ•œ ๊ฒฝ์šฐ MongoDB๋ฅผ ์‹คํ–‰ํ•  ์‚ฌ์šฉ์ž์— ๋”ฐ๋ผ mkdir -p <directory> ๋˜๋Š” sudo mkdir -p <directory> ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ( mkdir ๋ฐ sudo ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ Linux ๋งค๋‰ด์–ผ ํŽ˜์ด์ง€๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.)๊ธฐ๋ณธ์ ์œผ๋กœ MongoDB๋Š” mongod ์‚ฌ์šฉ์ž ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜์—ฌ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค. MongoDB ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์‚ฌ์šฉ์ž ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒฝ์šฐ /var/lib/mongo ๋ฐ /var/log/mongodb ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•œ ๊ถŒํ•œ๋„ ์ˆ˜์ •ํ•˜์—ฌ ์ด ์‚ฌ์šฉ์ž์—๊ฒŒ ์ด๋Ÿฌํ•œ ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•œ ์•ก์„ธ์Šค ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋กœ๊ทธ ํŒŒ์ผ ๋””๋ ‰ํ† ๋ฆฌ์™€ ๋ฐ์ดํ„ฐ ํŒŒ์ผ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ง€์ •ํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ํŽธ์ง‘ํ•ฉ๋‹ˆ๋‹ค. systemLog.path ๋ฐ storage.dbPath ์„ค์ •์„ /etc/mongod.conf ์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. MongoDB๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์‚ฌ์šฉ์ž์—๊ฒŒ ์ด ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•œ ์•ก์„ธ์Šค ๊ถŒํ•œ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

๋‹ค์Œ ๋‹จ๊ณ„์— ๋”ฐ๋ผ MongoDB Community Edition์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์ด ์ง€์นจ์—์„œ๋Š” ๊ธฐ๋ณธ ์„ค์ •์„ ์‚ฌ์šฉํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค.

init ์‹œ์Šคํ…œ

mongod์„ ์‹คํ–‰ํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์šด์˜ ์ฒด์ œ์— ๋‚ด์žฅ๋œ init ์‹œ์Šคํ…œ์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ตœ์‹  ๋ฒ„์ „์˜ Linux๋Š” systemctl ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜๋Š” systemd๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝํ–ฅ์ด ์žˆ๋Š” ๋ฐ˜๋ฉด, ๊ตฌ๋ฒ„์ „์€ service ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜๋Š” System V init๋ฅผ ์ฃผ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

ํ”Œ๋žซํผ์—์„œ ์‚ฌ์šฉํ•˜๋Š” init ์‹œ์Šคํ…œ์„ ์ •ํ™•ํžˆ ์•Œ ์ˆ˜ ์—†๋‹ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

ps --no-headers -o comm 1

์ดํ›„ ๊ฒฐ๊ณผ์— ๋”ฐ๋ผ ์•„๋ž˜์—์„œ ์ ์ ˆํ•œ ํƒญ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  • systemd - ์•„๋ž˜์˜ systemd(systemctl) ํƒญ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  • init - ์•„๋ž˜์˜ System V Init(์„œ๋น„์Šค) ํƒญ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.


1

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

sudo systemctl start mongod

mongod ์‹œ์ž‘ ์‹œ ๋‹ค์Œ๊ณผ ์œ ์‚ฌํ•œ ์˜ค๋ฅ˜๊ฐ€ ํ‘œ์‹œ๋˜๋Š” ๊ฒฝ์šฐ:

Failed to start mongod.service: Unit mongod.service not found.

๋จผ์ € ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:

sudo systemctl daemon-reload

๊ทธ๋Ÿฐ ๋‹ค์Œ ์œ„์˜ ์‹œ์ž‘ ๋ช…๋ น์„ ๋‹ค์‹œ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

2

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ์‹œ์ž‘๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

sudo systemctl status mongod

์„ ํƒ์ ์œผ๋กœ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ ์‹œ์Šคํ…œ ์žฌ๋ถ€ํŒ… ํ›„ MongoDB๊ฐ€ ์‹œ์ž‘๋˜๋„๋ก ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

sudo systemctl enable mongod
3

ํ•„์š”์— ๋”ฐ๋ผ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๋ฅผ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

sudo systemctl stop mongod
4

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

sudo systemctl restart mongod

/var/log/mongodb/mongod.log ํŒŒ์ผ์˜ ์ถœ๋ ฅ์„ ํ™•์ธํ•˜์—ฌ ์˜ค๋ฅ˜๋‚˜ ์ค‘์š”ํ•œ ๋ฉ”์‹œ์ง€์— ๋Œ€ํ•œ ํ”„๋กœ์„ธ์Šค ์ƒํƒœ๋ฅผ ๋”ฐ๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

5

mongod์™€ ๋™์ผํ•œ ํ˜ธ์ŠคํŠธ ๋จธ์‹ ์—์„œ mongosh ์„ธ์…˜์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. ๋ช…๋ น์ค„ ์˜ต์…˜ ์—†์ด mongosh๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๊ธฐ๋ณธ ํฌํŠธ 27017์—์„œ localhost์—์„œ ์‹คํ–‰ ์ค‘์ธ mongod์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

mongosh

๋‹ค๋ฅธ ํ˜ธ์ŠคํŠธ ๋ฐ/๋˜๋Š” ํฌํŠธ์—์„œ ์‹คํ–‰ํ•˜๋Š” mongod ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐํ•˜๋Š” ๋“ฑ mongosh(์„)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์—ฐ๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ mongosh ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

MongoDB๋Š” ์‚ฌ์šฉ์„ ์‹œ์ž‘ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋˜๋„๋ก ๋‹ค์–‘ํ•œ ๋“œ๋ผ์ด๋ฒ„ ์—๋””์…˜์— ๋Œ€ํ•ด ์‹œ์ž‘ ๊ฐ€์ด๋“œ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋“œ๋ผ์ด๋ฒ„ ์„ค๋ช…์„œ๋Š” MongoDB๋กœ ๊ฐœ๋ฐœ ์‹œ์ž‘ํ•˜๊ธฐ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

1

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

sudo service mongod start
2

/var/log/mongodb/mongod.log ์˜ ๋กœ๊ทธ ํŒŒ์ผ ๋‚ด์šฉ์„ ํ™•์ธํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ์‹œ์ž‘๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

[initandlisten] waiting for connections on port <port>

์—ฌ๊ธฐ์„œ <port>๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ /etc/mongod.conf, 27017์— ๊ตฌ์„ฑ๋œ ํฌํŠธ์ž…๋‹ˆ๋‹ค.

์„ ํƒ์ ์œผ๋กœ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ ์‹œ์Šคํ…œ ์žฌ๋ถ€ํŒ… ํ›„ MongoDB๊ฐ€ ์‹œ์ž‘๋˜๋„๋ก ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

sudo chkconfig mongod on
3

ํ•„์š”์— ๋”ฐ๋ผ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๋ฅผ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

sudo service mongod stop
4

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

sudo service mongod restart

/var/log/mongodb/mongod.log ํŒŒ์ผ์˜ ์ถœ๋ ฅ์„ ํ™•์ธํ•˜์—ฌ ์˜ค๋ฅ˜๋‚˜ ์ค‘์š”ํ•œ ๋ฉ”์‹œ์ง€์— ๋Œ€ํ•œ ํ”„๋กœ์„ธ์Šค ์ƒํƒœ๋ฅผ ๋”ฐ๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

5

mongod์™€ ๋™์ผํ•œ ํ˜ธ์ŠคํŠธ ๋จธ์‹ ์—์„œ mongosh ์„ธ์…˜์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. ๋ช…๋ น์ค„ ์˜ต์…˜ ์—†์ด mongosh๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๊ธฐ๋ณธ ํฌํŠธ 27017์—์„œ localhost์—์„œ ์‹คํ–‰ ์ค‘์ธ mongod์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

mongosh

๋‹ค๋ฅธ ํ˜ธ์ŠคํŠธ ๋ฐ/๋˜๋Š” ํฌํŠธ์—์„œ ์‹คํ–‰ํ•˜๋Š” mongod ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐํ•˜๋Š” ๋“ฑ mongosh(์„)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์—ฐ๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ mongosh ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

MongoDB๋Š” ์‚ฌ์šฉ์„ ์‹œ์ž‘ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋˜๋„๋ก ๋‹ค์–‘ํ•œ ๋“œ๋ผ์ด๋ฒ„ ์—๋””์…˜์— ๋Œ€ํ•ด ์‹œ์ž‘ ๊ฐ€์ด๋“œ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋“œ๋ผ์ด๋ฒ„ ์„ค๋ช…์„œ๋Š” MongoDB๋กœ ๊ฐœ๋ฐœ ์‹œ์ž‘ํ•˜๊ธฐ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์‹œ์Šคํ…œ์—์„œ MongoDB๋ฅผ ์™„์ „ํžˆ ์ œ๊ฑฐํ•˜๋ ค๋ฉด MongoDB ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ž์ฒด์™€ ๊ตฌ์„ฑ ํŒŒ์ผ ๋ฐ ๋ฐ์ดํ„ฐ์™€ ๋กœ๊ทธ๊ฐ€ ํฌํ•จ๋œ ๋ชจ๋“  ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ œ๊ฑฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ์„น์…˜์—์„œ๋Š” ํ•„์š”ํ•œ ๋‹จ๊ณ„๋ฅผ ์•ˆ๋‚ดํ•ฉ๋‹ˆ๋‹ค.

๊ฒฝ๊ณ 

์ด ํ”„๋กœ์„ธ์Šค๋Š” MongoDB์™€ ๊ทธ ๊ตฌ์„ฑ, ๋ชจ๋“  ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์™„์ „ํžˆ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค. ์ด ํ”„๋กœ์„ธ์Šค๋Š” ๋˜๋Œ๋ฆด ์ˆ˜ ์—†์œผ๋ฏ€๋กœ ๋ชจ๋“  ๊ตฌ์„ฑ๊ณผ ๋ฐ์ดํ„ฐ์˜ ๋ฐฑ์—… ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•œ ์ดํ›„์— ์ง„ํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

1

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ mongod ํ”„๋กœ์„ธ์Šค๋ฅผ ์ค‘์ง€ํ•ฉ๋‹ˆ๋‹ค.

sudo service mongod stop
2

์ด์ „์— ์„ค์น˜ํ•œ MongoDB ํŒจํ‚ค์ง€๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

sudo zypper remove $(rpm -qa | grep mongodb-org)
3

MongoDB database ๋ฐ ๋กœ๊ทธ ํŒŒ์ผ์„ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo

By default, MongoDB launches with bindIp set to 127.0.0.1, which binds to the localhost network interface. This means that the mongod can only accept connections from clients that are running on the same machine. Remote clients will not be able to connect to the mongod, and the mongod will not be able to initialize a replica set unless this value is set to a valid network interface which is accessible from the remote clients.

์ด ๊ฐ’์€ ๋‹ค์Œ ์ค‘ ํ•œ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์œผ๋กœ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • MongoDB ๊ตฌ์„ฑ ํŒŒ์ผ์—์„œ bindIp๋ฅผ ํ†ตํ•ด

  • ๋ช…๋ น์ค„ ์ธ์ˆ˜๋ฅผ ํ†ตํ•ด --bind_ip

๊ฒฝ๊ณ 

๋กœ์ปฌ ํ˜ธ์ŠคํŠธ๊ฐ€ ์•„๋‹Œ ์— ๋ฐ”์ธ๋”ฉํ•˜๊ธฐ ์ „์—(์˜ˆ: ๊ณต๊ฐœ์ ์œผ๋กœ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋Š”) IP ์ฃผ์†Œ ์ธ ๊ฒฝ์šฐ ๋ฌด๋‹จ ์•ก์„ธ์Šค ๋กœ๋ถ€ํ„ฐ ํด๋Ÿฌ์Šคํ„ฐ ๋ฅผ ๋ณดํ˜ธํ–ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๋ณด์•ˆ ๊ถŒ์žฅ ์‚ฌํ•ญ์˜ ์ „์ฒด ๋ชฉ๋ก์€ ์ž์ฒด ๊ด€๋ฆฌ ๋ฐฐํฌ์„œ๋ฒ„๋ฅผ ์œ„ํ•œ ๋ณด์•ˆ ์ฒดํฌ๋ฆฌ์ŠคํŠธ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”. ์ตœ์†Œํ•œ ์ธ์ฆ ์„ ํ™œ์„ฑํ™” ํ•˜๊ณ  ๋„คํŠธ์›Œํฌ ์ธํ”„๋ผ๋ฅผ ๊ฐ•ํ™”ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•˜์„ธ์š”.

bindIp ๊ตฌ์„ฑ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ ์€ ์ž์ฒด ๊ด€๋ฆฌ ๋ฐฐํฌ์„œ๋ฒ„์˜ IP ๋ฐ”์ธ๋”ฉ์„ ์ฐธ์กฐํ•˜์„ธ์š”.

MongoDB Community Edition์€ ์ž์ฒด ์ „์šฉ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ณต์‹ ์ง€์› ํŒจํ‚ค์ง€๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

ํŒจํ‚ค์ง€ ์ด๋ฆ„
์„ค๋ช…
mongodb-org
metapackage๋Š” ์•„๋ž˜ ๋‚˜์—ด๋œ ๊ตฌ์„ฑ์š”์†Œ ํŒจํ‚ค์ง€๋ฅผ ์ž๋™์œผ๋กœ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
mongodb-org-database

metapackage๋Š” ์•„๋ž˜ ๋‚˜์—ด๋œ ๊ตฌ์„ฑ์š”์†Œ ํŒจํ‚ค์ง€๋ฅผ ์ž๋™์œผ๋กœ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

ํŒจํ‚ค์ง€ ์ด๋ฆ„
์„ค๋ช…
mongodb-org-server
mongod ๋ฐ๋ชฌ, ๊ด€๋ จ init ์Šคํฌ๋ฆฝํŠธ ๋ฐ ๊ตฌ์„ฑ ํŒŒ์ผ(/etc/mongod.conf)์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. ์ดˆ๊ธฐํ™” ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌ์„ฑ ํŒŒ์ผ๋กœ mongod ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์œ„์˜ 'MongoDB Community Edition ์‹คํ–‰' ์„น์…˜์—์„œ ํ™•์ธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
mongodb-org-mongos
mongos ๋ฐ๋ชฌ์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.
mongodb-mongosh
MongoDB Shell(mongosh)์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.
mongodb-org-tools

metapackage๋Š” ์•„๋ž˜ ๋‚˜์—ด๋œ ๊ตฌ์„ฑ ์š”์†Œ ํŒจํ‚ค์ง€๋ฅผ ์ž๋™์œผ๋กœ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

ํŒจํ‚ค์ง€ ์ด๋ฆ„
์„ค๋ช…
mongodb-database-tools

๋‹ค์Œ MongoDB database ๋„๊ตฌ๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

mongodb-org-database-tools-extra
install_compass ์Šคํฌ๋ฆฝํŠธ ํฌํ•จ

๋Œ์•„๊ฐ€๊ธฐ

.tgz ํƒ€๋ณผ์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์น˜