Red Hat ๋๋ CentOS์ MongoDB Enterprise Edition ์ค์น
์ด ํ์ด์ง์ ๋ด์ฉ
์ฐธ๊ณ
MongoDB Atlas
MongoDB Atlas ๋ ํด๋ผ์ฐ๋์์ ํธ์คํ ๋๋ MongoDB ์๋น์ค ์ต์ ์ผ๋ก, ์ค์น ์ค๋ฒํค๋๊ฐ ํ์ํ์ง ์์ผ๋ฉฐ ํ๋ฆฌ ํฐ์ด์ ์ ๊ณตํ์ฌ ๋ฐ๋ก ์์ํ ์ ์์ต๋๋ค.
๊ฐ์
์ด ํํ ๋ฆฌ์ผ์ ํตํด yum
ํจํค์ง ๊ด๋ฆฌ์๋ฅผ ์ฌ์ฉํ์ฌ Red Hat Enterprise Linux, CentOS Linux ๋๋ Oracle Linux [1] ์ MongoDB 6.0 Enterprise Edition์ ์ค์นํฉ๋๋ค.
MongoDB Enterprise Edition์ ์ผ๋ถ ํ๋ซํผ์์ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ ๋ณด์ ๋ฐ ๋ชจ๋ํฐ๋ง๊ณผ ๊ด๋ จ๋ ์ฌ๋ฌ ๊ธฐ๋ฅ์ ์ง์ํฉ๋๋ค.
MongoDB ๋ฒ์
์ด ํํ ๋ฆฌ์ผ์์๋ MongoDB 6.0 Enterprise Edition์ ์ค์นํฉ๋๋ค. ๋ค๋ฅธ ๋ฒ์ ์ MongoDB Enterprise๋ฅผ ์ค์นํ๋ ค๋ฉด ํ์ด์ง ์ผ์ชฝ ์๋จ์ ๋ฒ์ ๋๋กญ๋ค์ด ๋ฉ๋ด์์ ํด๋น ๋ฒ์ ์ ๋ํ ๋ฌธ์๋ฅผ ์ ํํ์ธ์.
๊ณ ๋ ค ์ฌํญ
ํ๋ซํผ ์ง์
์ฐธ๊ณ
EOL Notice
MongoDB 5.0 Enterprise Edition์ x86_64์์ RHEL /CentOS/Oracle 6์ ๋ํ ์ง์์ ์ ๊ฑฐํฉ๋๋ค.
MongoDB Enterprise Edition์ ๋ฒ์ 4.0๊ณผ 5.0 ์ฌ์ด์์ RHEL 7/CentOS/Oracle PPC64LE ์ ๋ํ ์ง์์ ์ ๊ฑฐํ์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด๋ฌํ ์ํคํ ์ฒ๋ 5.0.X ๋ฒ์ ์์ ์ง์๋ฉ๋๋ค.
MongoDB 6.0 Enterprise ์๋์ ์ x86_64 ์ํคํ ์ฒ์์ ๋ค์ 64๋นํธ ๋ฒ์ ์ Red Hat Enterprise Linux (RHEL), CentOS Linux, Oracle Linux [1] , Rocky Linux ๋ฐ AlmaLinux [2] ๋ฅผ ์ง์ํฉ๋๋ค.
RHEL / CentOS / Oracle / Rocky / AlmaLinux 9(MongoDB 6.0.4๋ถํฐ)
RHEL / CentOS / Oracle / Rocky / Alma 8
RHEL /CentOS/Oracle 7
MongoDB 6.0 Enterprise Edition์ RHEL /CentOS/Oracle/Rocky/AlmaLinux 8์์ ARM64 ์ํคํ ์ฒ๋ ์ง์ํฉ๋๋ค.
์์ธํ ์ ๋ณด๋ ํ๋ซํผ ์ง์์์ ํ์ธํ ์ ์์ต๋๋ค.
[1] | (1, 2) MongoDB๋ Red Hat ํธํ ์ปค๋(RHCK)์ ์คํํ๋ Oracle Linux๋ง ์ง์ํฉ๋๋ค. MongoDB๋ UEK(Unbreakable Enterprise Kernel)๋ฅผ ์ง์ํ์ง ์์ต๋๋ค . |
[2] | RHEL ๋ฒ์ 8.0 ์ด์์ ์ง์ํ๋๋ก ์ถ์๋ MongoDB ์จํ๋ ๋ฏธ์ค ์ ํ์ ํด๋น ๋ฐฐํฌํ์ด ์์ ํ RHEL ํธํ์ฑ์ ์ ๊ณตํ ์๋ฌด๋ฅผ ์ถฉ์กฑํ๋ ๊ฒฝ์ฐ Rocky Linux ๋ฒ์ 8.0 ์ด์๊ณผ AlmaLinux ๋ฒ์ 8.0 ์ด์์ ํธํ ๋ฐ ์ง์ํฉ๋๋ค. |
ํ๋ก๋์ ์ ๋ณด
ํ๋ก๋์ MongoDB ๋ฐฐํฌ์ ๋ํ ์ฑ๋ฅ ๊ณ ๋ ค ์ฌํญ ๋ฐ ๊ตฌ์ฑ ๊ถ์ฅ ์ฌํญ์ ์ ๊ณตํ๋ ์์ฒด ๊ด๋ฆฌํ ๋ฐฐํฌ๋ฅผ ์ํ ํ๋ก๋์ ๋ ธํธ ๋ฌธ์๋ฅผ ๊ฒํ ํ ์ดํ์ ํ๋ก๋์ ํ๊ฒฝ์ MongoDB๋ฅผ ๋ฐฐํฌํฉ๋๋ค.
MongoDB Enterprise Edition ์ค์น
๋ค์ ๋จ๊ณ์ ๋ฐ๋ผ yum
ํจํค์ง ๊ด๋ฆฌ์๋ฅผ ์ฌ์ฉํ์ฌ MongoDB Enterprise Edition์ ์ค์นํฉ๋๋ค.
๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๊ตฌ์ฑํฉ๋๋ค.
yum
๋ฅผ ์ฌ์ฉํ์ฌ MongoDB Enterprise๋ฅผ ์ง์ ์ค์นํ๋ ค๋ฉด /etc/yum.repos.d/mongodb-enterprise-6.0.repo
ํ์ผ์ ์์ฑํฉ๋๋ค.
[mongodb-enterprise-6.0] name=MongoDB Enterprise Repository baseurl=https://repo.mongodb.com/yum/redhat/9/mongodb-enterprise/6.0/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-6.0.asc
[mongodb-enterprise-6.0] name=MongoDB Enterprise Repository baseurl=https://repo.mongodb.com/yum/redhat/8/mongodb-enterprise/6.0/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-6.0.asc
[mongodb-enterprise-6.0] name=MongoDB Enterprise Repository baseurl=https://repo.mongodb.com/yum/redhat/7/mongodb-enterprise/6.0/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-6.0.asc
์ฐธ๊ณ
์ด์ ์ MongoDB๋ฅผ ์ค์นํ๋ ๊ณผ์ ์์ mongodb-enterprise.repo
ํ์ผ์ด ์ด ๋๋ ํ ๋ฆฌ์ ์กด์ฌํ๋ ๊ฒฝ์ฐ ํด๋น ํ์ผ์ ์ ๊ฑฐํด์ผ ํฉ๋๋ค. MongoDB 6.0์ ์ค์นํ๋ ค๋ฉด ์์ mongodb-enterprise-6.0.repo
ํ์ผ์ ์ฌ์ฉํฉ๋๋ค.
MongoDB ๋ฆฌํฌ์งํ ๋ฆฌ์์
.rpm
ํ์ผ์ ์ง์ ๋ค์ด๋ก๋ํ ์๋ ์์ต๋๋ค. ๋ค์ด๋ก๋๋ Red Hat/CentOS ๋ฒ์ (์: 9
), MongoDB ๋ฆด๋ฆฌ์ค ๋ฒ์ (์: 6.0
), ์ํคํ
์ฒ(์: x86_64
) ์์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค.
MongoDB 5.0 ์ด์ ์๋ 4.3
๋ฑ MongoDB์ ํ์ ๋ฆด๋ฆฌ์ค ๋ฒ์ ์ด ๊ฐ๋ฐ ๋ฆด๋ฆฌ์ค์์ต๋๋ค. MongoDB 5.1๋ถํฐ MongoDB๋ ๋ถ๊ธฐ๋ณ๋ก ๋น ๋ฅธ ๋ฆด๋ฆฌ์ค๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ ์ํ ์ง์ ๋ฆด๋ฆฌ์ค์ ์ฅ๊ธฐ ์ง์ ๋ฆด๋ฆฌ์ค์ ์ฐจ์ด์ ์ ๋ํ ์์ธํ ๋ด์ฉ์ MongoDB ๋ฒ์ ๊ด๋ฆฌ์์ ํ์ธ ๊ฐ๋ฅํฉ๋๋ค.
MongoDB ์ํฐํ๋ผ์ด์ฆ ์๋ฒ๋ฅผ ์ค์นํฉ๋๋ค.
์์ ์ ์ธ ์ต์ MongoDB Enterprise 6.0 ๋ฒ์ ์ ์ค์นํ๋ ค๋ฉด ๋ค์ ๋ช ๋ น์ ์คํํ์ธ์.
sudo yum install -y mongodb-enterprise
ํน์ ๋ฆด๋ฆฌ์ค๋ฅผ ์ค์นํ๋ ค๋ฉด ๋ค์ ์์์ ๊ฐ์ด ๊ฐ ๊ตฌ์ฑ ์์ ํจํค์ง๋ฅผ ๊ฐ๋ณ์ ์ผ๋ก ์ง์ ํ๊ณ ํจํค์ง ์ด๋ฆ์ ๋ฒ์ ๋ฒํธ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
sudo yum install -y mongodb-enterprise-6.0.17 mongodb-enterprise-database-6.0.17 mongodb-enterprise-server-6.0.17 mongodb-enterprise-mongos-6.0.17 mongodb-enterprise-tools-6.0.17
์ฐธ๊ณ
์ด์ฉ ๊ฐ๋ฅํ ๋ชจ๋ MongoDB Enterprise ๋ฒ์ ์ ์ง์ ํ ์ ์์ง๋ง ์ต์ ๋ฒ์ ์ ์ฌ์ฉํ ์ ์๋ ๊ฒฝ์ฐ yum
์ด ํจํค์ง๋ฅผ ์
๊ทธ๋ ์ด๋ํฉ๋๋ค. ์๋ํ์ง ์์ ์
๊ทธ๋ ์ด๋๋ฅผ ๋ฐฉ์งํ๋ ค๋ฉด /etc/yum.conf
ํ์ผ์ ๋ค์ exclude
์ง์๋ฌธ์ ์ถ๊ฐํ์ฌ ํจํค์ง๋ฅผ ๊ณ ์ ํฉ๋๋ค.
exclude=mongodb-enterprise,mongodb-enterprise-database,mongodb-enterprise-server,mongodb-enterprise-shell,mongodb-enterprise-mongos,mongodb-enterprise-tools
์ฐธ๊ณ
์์คํ ์ OpenSSL์ ์ฌ์ฉํ๋ MongoDB Shell์ ์ค์นํ ์๋ ์์ต๋๋ค. ์์คํ ์ OpenSSL์ ์ค์นํ ์ดํ์ ์ด ๋ฒ์ ์ MongoDB Shell์ ์ค์นํด์ผ ํฉ๋๋ค.
๋จผ์ MongoDB Shell์ ์ ๊ฑฐํ์ง ์์๋ ๋ชจ๋ MongoDB Enterprise ํจํค์ง์ ์์คํ OpenSSL์ ์ฌ์ฉํ๋ MongoDB Shell์ ์ค์นํ ์ ์์ต๋๋ค. ๊ทธ ์์๋ ์๋์ ๊ฐ์ต๋๋ค.
sudo yum install -y mongodb-enterprise mongodb-mongosh-shared-openssl11
๋ค์ ์์์์๋ MongoDB Shell์ ์ ๊ฑฐํ ๋ค์ ์์คํ ์ OpenSSL 1.1์ ์ฌ์ฉํ๋ MongoDB Shell์ ์ค์นํฉ๋๋ค.
sudo yum remove -y mongodb-mongosh && sudo yum install -y mongodb-mongosh-shared-openssl11
๋ค์ ์์์์๋ MongoDB Shell์ ์ ๊ฑฐํ ๋ค์ ์์คํ ์ OpenSSL 3์ ์ฌ์ฉํ๋ MongoDB Shell์ ์ค์นํฉ๋๋ค.
sudo yum remove -y mongodb-mongosh && sudo yum install -y mongodb-mongosh-shared-openssl3
์ค์นํ MongoDB ํจํค์ง๋ฅผ ์ ํํ ์๋ ์์ต๋๋ค.
๋ค์ ์์์์๋ MongoDB Enterprise์ ๋๊ตฌ, ์์คํ ์ OpenSSL 1.1์ ์ฌ์ฉํ๋ MongoDB Shell์ ์ค์นํฉ๋๋ค.
sudo yum install -y mongodb-enterprise-database mongodb-enterprise-tools mongodb-mongosh-shared-openssl11
๋ค์ ์์์์๋ MongoDB Enterprise์ ๋๊ตฌ, ์์คํ ์ OpenSSL 3์ ์ฌ์ฉํ๋ MongoDB Shell์ ์ค์นํฉ๋๋ค.
sudo yum install -y mongodb-enterprise-database mongodb-enterprise-tools mongodb-mongosh-shared-openssl3
MongoDB Enterprise Edition ์คํ
์ ์ ์กฐ๊ฑด
ulimit
๋๋ถ๋ถ์ Unix ๊ณ์ด ์ด์ ์ฒด์ ๋ ํ๋ก์ธ์ค ๊ฐ ์ฌ์ฉํ ์ ์๋ ์์คํ
๋ฆฌ์์ค๋ฅผ ์ ํํฉ๋๋ค. ์ด๋ฌํ ์ ํ์ MongoDB ์์
์ ๋ถ์ ์ ์ธ ์ํฅ ์ ์์ผ๋ฏ๋ก ์กฐ์ ํด์ผ ํฉ๋๋ค. ํ๋ซํผ์ ๊ถ์ฅ ๋๋ ์ค์ ์ ์์ฒด ๊ด๋ฆฌ ๋ฐฐํฌ์๋ฒ๋ฅผ ์ํ UNIX ulimit
์ค์ ์ ์ฐธ์กฐํ์ธ์.
์ฐธ๊ณ
์ด๋ ค ์๋ ํ์ผ ์์ ulimit
๊ฐ์ด 64000
๋ฏธ๋ง์ธ ๊ฒฝ์ฐ MongoDB๊ฐ ์์ ๊ฒฝ๊ณ ๋ฅผ ์์ฑํฉ๋๋ค.
๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก
๋ค์๊ณผ ๊ฐ์ด ๊ธฐ๋ณธ ๋๋ ํฐ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ธ์.
๊ธฐ๋ณธ์ ์ผ๋ก MongoDB๋ mongod
์ฌ์ฉ์ ๊ณ์ ์ ์ฌ์ฉํ์ฌ ์คํ๋๋ฉฐ ๋ค์ ๊ธฐ๋ณธ ๋๋ ํ ๋ฆฌ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
/var/lib/mongo
(๋ฐ์ดํฐ ๋๋ ํ ๋ฆฌ)/var/log/mongodb
(๋ก๊ทธ ๋๋ ํ ๋ฆฌ)
ํจํค์ง ๊ด๋ฆฌ์๋ ์ค์น ๊ณผ์ ์์ ๊ธฐ๋ณธ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค. ์์ ์ ๋ฐ ๊ทธ๋ฃน ์ด๋ฆ์ mongod
์
๋๋ค.
๊ธฐ๋ณธ ๋๋ ํ ๋ฆฌ ์ฌ์ฉ
๊ธฐ๋ณธ ๋๋ ํ ๋ฆฌ ์ด์ธ์ ๋ฐ์ดํฐ ๋๋ ํ ๋ฆฌ ๋ฐ ๋ก๊ทธ ๋๋ ํ ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๋ค์์ ์คํํฉ๋๋ค.
์ ๋๋ ํ ๋ฆฌ๋ฅผ ํ๋ ์ด์ ์์ฑํฉ๋๋ค.
๊ตฌ์ฑ ํ์ผ
/etc/mongod.conf
๋ฅผ ํธ์งํ๊ณ ๊ทธ์ ๋ฐ๋ผ ๋ค์ ํ๋๋ฅผ ์์ ํฉ๋๋ค.storage.dbPath
๋ก ์๋ก์ด ๋ฐ์ดํฐ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก ์ง์ (์:/some/data/directory
)systemLog.path
๋ก ์๋ก์ด ๋ก๊ทธ ํ์ผ ๊ฒฝ๋ก ์ง์ (์:/some/log/directory/mongod.log
)
MongoDB๋ฅผ ์คํํ๋ ์ฌ์ฉ์๊ฐ ๋๋ ํ ๋ฆฌ์ ์ก์ธ์คํ ์ ์๋์ง ํ์ธํฉ๋๋ค.
sudo chown -R mongod:mongod <directory> MongoDB ํ๋ก์ธ์ค๋ฅผ ์คํํ๋ ์ฌ์ฉ์๋ฅผ ๋ณ๊ฒฝํ๋ ค๋ฉด ์๋ก์ด ์ฌ์ฉ์์๊ฒ ๋๋ ํ ๋ฆฌ ์ก์ธ์ค ๊ถํ์ ๋ถ์ฌํด์ผ ํฉ๋๋ค.
์ ์ฉ๋๋ ๊ฒฝ์ฐ SELinux๋ฅผ ๊ตฌ์ฑํฉ๋๋ค. SELinux ๊ตฌ์ฑ์ ์ฐธ๊ณ ํฉ๋๋ค.
SELinux ๊ตฌ์ฑ
MongoDB 5.0๋ถํฐ ๋ค์๊ณผ ๊ฐ์ MongoDB ์ค์น์ ์๋ก์ด SELinux ์ ์ฑ ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
.rpm
์ค์น ํ๋ก๊ทธ๋จ์ ์ฌ์ฉํฉ๋๋ค.๊ธฐ๋ณธ ๊ตฌ์ฑ ์ค์ ์ ์ฌ์ฉํฉ๋๋ค.
RHEL7 ๋๋ RHEL8์์ ์คํํฉ๋๋ค.
LDAP ์ธ์ฆ์ ์ฌ์ฉํ๋ MongoDB Enterprise ์ค์น์ ๊ฒฝ์ฐ ๋ค์์ ์ถ๊ฐ์ ์ธ SELinux ์ ์ฑ ์ ์ ์ฉํด์ผ ํฉ๋๋ค:
OS ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํตํด LDAP ์ธ์ฆ์ ์ฌ์ฉํ๋ ๋ฐฐํฌ์๋ฒ์ ๊ฒฝ์ฐ MongoDB๊ฐ
tcontext=system_u:object_r:ldap_port_t:s0
LDAP ํฌํธ์ ์ก์ธ์คํด์ผ ํฉ๋๋ค.setsebool -P authlogin_nsswitch_use_ldap 1
์ ์คํํ์ฌ ์ก์ธ์ค๋ฅผ ํ์ฑํํ ์ ์์ต๋๋ค.saslauthd๋ฅผ ์ด์ฉํ LDAP ์ธ์ฆ์ ์ฌ์ฉํ๋ ๋ฐฐํฌ์๋ฒ์ ๊ฒฝ์ฐ,
sudo setsebool -P daemons_enable_cluster_mode 1
์ ์คํํ์ฌ ํด๋ฌ์คํฐ ๋ชจ๋๋ฅผ ํ์ฑํํด์ผ ํฉ๋๋ค.
์ค์น ๊ณผ์ ์ด ์ด๋ฌํ ์๊ตฌ ์ฌํญ์ ๋ถํฉํ์ง ์๋ ๊ฒฝ์ฐ .tgz
ํจํค์ง์ ๋ํ SELinux ์ง์นจ์ ํ์ธํฉ๋๋ค.
์ฐธ๊ณ
MongoDB ๋ฐฐํฌ์๋ฒ์์ ๋ค์์ ํ๋๋ผ๋ ํด๋นํ๋ ์ฌ์ฉ์ ์ ์ ์ค์ ์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ
MongoDB์์ ์ ๊ณตํ๋ SELinux ์ ์ฑ
์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก์ ์ฌ์ฉ์ ์ ์ SELinux ์ ์ฑ
์ ๋ง๋ค ์ ์์ง๋ง, ๋ถ์ ์ ํ๊ฒ ์์ฑ๋ ์ฌ์ฉ์ ์ ์ ์ ์ฑ
์ ๋ณด์ ์์ค์ด ๋ฎ๊ฑฐ๋ mongod
์ธ์คํด์ค์ ์๋์ ์ค์ง์ํฌ ์ ์์ต๋๋ค.
SELinux ์ ์ฑ ์ค์น
๋ค์ ํจํค์ง๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํฉ๋๋ค.
git
make
checkpolicy
policycoreutils
selinux-policy-devel
sudo yum install git make checkpolicy policycoreutils selinux-policy-devel ์ ์ฑ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ค์ด๋ก๋ํฉ๋๋ค.
git clone https://github.com/mongodb/mongodb-selinux ์ ์ฑ ์ ๊ตฌ์ถํฉ๋๋ค.
cd mongodb-selinux make ์ ์ฑ ์ ์ ์ฉํฉ๋๋ค.
sudo make install
์ค์
์ด์ ๋ฒ์ ๊ณผ ํธํ๋์ง ์๋ ๊ธฐ๋ฅ
MongoDB 5.1๋ถํฐ๋ ์ด์ ์ SELinux ์ ์ฑ ์ ๋ณต์ ํ ๋๋ ํ ๋ฆฌ์์ ๋ค์ ๋ช ๋ น์ ์คํํด์ผ ์ด์ MongoDB ๋ฒ์ ์ผ๋ก ๋ค์ด๊ทธ๋ ์ด๋ํ ์ ์์ต๋๋ค.
sudo make uninstall
SELinux ์ ์ฑ ๊ณ ๋ ค ์ฌํญ
SELinux ์ ์ฑ ์ ํ์ค MongoDB
.rpm
ํจํค์ง ์ค์น์ ๋ฐ๋ฅธ ๊ตฌ์ฑ๊ณผ ํจ๊ป ์๋ํ๊ธฐ ์ํ ๊ฒ์ ๋๋ค. ์์ธํ ๋ด์ฉ์ ํ์ค ์ค์น ๊ฐ์ ์ ์ฐธ์กฐํ์ธ์.SELinux ์ ์ฑ ์
mongod
์๋ฒ์ฉ์ผ๋ก ๊ณ ์๋์์ต๋๋ค. ๋ค์๊ณผ ๊ฐ์ ๋ค๋ฅธ MongoDB ๋ฐ๋ชฌ์ด๋ ๋๊ตฌ์๋ ์ ์ฉ๋์ง ์์ต๋๋ค.SELinux ํ๋ก์ ํธ์์ ์ ๊ณตํ๋ ์ฐธ์กฐ ์ ์ฑ ์๋
mongodb_admin
๋งคํฌ๋ก๊ฐ ํฌํจ๋์ด ์์ต๋๋ค. ์ด ๋งคํฌ๋ก๋ MongoDB SELinux ์ ์ฑ ์ ํฌํจ๋์ง ์์ต๋๋ค.unconfined_t
๋๋ฉ์ธ์ ๊ด๋ฆฌ์๋mongod
๋ฅผ ๊ด๋ฆฌํ ์ ์์ต๋๋ค.
์ ์ฑ ์ ์ ๊ฑฐํ๋ ค๋ฉด ์ ์ฑ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ค์ด๋ก๋ํ ๋๋ ํ ๋ฆฌ๋ก ์ด๋ํ์ฌ ๋ค์์ ์คํํฉ๋๋ค.
sudo make uninstall
์ ์ฐจ
๋ค์ ๋จ๊ณ์ ๋ฐ๋ผ ์์คํ ์์ MongoDB Enterprise 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 (service) ํญ์ ์ ํํฉ๋๋ค.
MongoDB๋ฅผ ์์ํฉ๋๋ค.
๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๋ฅผ ์์ํ ์ ์์ต๋๋ค:
sudo systemctl start mongod
mongod
์์ ์ ๋ค์๊ณผ ์ ์ฌํ ์ค๋ฅ๊ฐ ํ์๋๋ ๊ฒฝ์ฐ:
Failed to start mongod.service: Unit mongod.service not found.
๋จผ์ ๋ค์ ๋ช ๋ น์ ์คํํฉ๋๋ค:
sudo systemctl daemon-reload
๊ทธ๋ฐ ๋ค์ ์์ ์์ ๋ช ๋ น์ ๋ค์ ์คํํฉ๋๋ค.
MongoDB๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์์๋์๋์ง ํ์ธํฉ๋๋ค.
๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์์๋์๋์ง ํ์ธํ ์ ์์ต๋๋ค:
sudo systemctl status mongod
์ ํ์ ์ผ๋ก ๋ค์ ๋ช ๋ น์ ์คํํ์ฌ ์์คํ ์ฌ๋ถํ ํ MongoDB๊ฐ ์์๋๋๋ก ํ ์ ์์ต๋๋ค.
sudo systemctl enable mongod
MongoDB๋ฅผ ์ค์งํฉ๋๋ค.
ํ์์ ๋ฐ๋ผ ๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๋ฅผ ์ค์งํ ์ ์์ต๋๋ค.
sudo systemctl stop mongod
MongoDB๋ฅผ ๋ค์ ์์ํฉ๋๋ค.
๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๋ฅผ ๋ค์ ์์ํ ์ ์์ต๋๋ค:
sudo systemctl restart mongod
/var/log/mongodb/mongod.log
ํ์ผ์ ์ถ๋ ฅ์ ํ์ธํ์ฌ ์ค๋ฅ๋ ์ค์ํ ๋ฉ์์ง์ ๋ํ ํ๋ก์ธ์ค ์ํ๋ฅผ ๋ฐ๋ฅผ ์ ์์ต๋๋ค.
MongoDB ์ฌ์ฉ์ ์์ํฉ๋๋ค.
mongod
์ ๋์ผํ ํธ์คํธ ๋จธ์ ์์
mongosh
์ธ์
์ ์์ํฉ๋๋ค. ๋ช
๋ น์ค ์ต์
์์ด
mongosh
๋ฅผ ์คํํ์ฌ ๊ธฐ๋ณธ ํฌํธ 27017์์ localhost์์ ์คํ ์ค์ธ mongod
์ ์ฐ๊ฒฐํ ์ ์์ต๋๋ค.
mongosh
๋ค๋ฅธ ํธ์คํธ ๋ฐ/๋๋ ํฌํธ์์ ์คํํ๋ mongod
์ธ์คํด์ค์ ์ฐ๊ฒฐํ๋ ๋ฑ
mongosh
(์)๋ฅผ ์ฌ์ฉํ์ฌ ์ฐ๊ฒฐํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ๋ด์ฉ์ mongosh ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ธ์.
MongoDB๋ ์ฌ์ฉ์ ์์ํ๋ ๋ฐ ๋์์ด ๋๋๋ก ๋ค์ํ ๋๋ผ์ด๋ฒ ์๋์ ์ ๋ํด ์์ ๊ฐ์ด๋๋ฅผ ์ ๊ณตํฉ๋๋ค. ๋๋ผ์ด๋ฒ ์ค๋ช ์๋ MongoDB๋ก ๊ฐ๋ฐ ์์ํ๊ธฐ๋ฅผ ์ฐธ์กฐํ์ธ์.
MongoDB๋ฅผ ์์ํฉ๋๋ค.
๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๋ฅผ ์์ํ ์ ์์ต๋๋ค:
sudo service mongod start
MongoDB๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์์๋์๋์ง ํ์ธํฉ๋๋ค.
/var/log/mongodb/mongod.log
์ ๋ก๊ทธ ํ์ผ ๋ด์ฉ์ ํ์ธํ์ฌ
mongod
ํ๋ก์ธ์ค๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์์๋์๋์ง ํ์ธํ ์ ์์ต๋๋ค.
[initandlisten] waiting for connections on port <port>
์ฌ๊ธฐ์ <port>
๋ ๊ธฐ๋ณธ์ ์ผ๋ก /etc/mongod.conf
, 27017
์ ๊ตฌ์ฑ๋ ํฌํธ์
๋๋ค.
์ ํ์ ์ผ๋ก ๋ค์ ๋ช ๋ น์ ์คํํ์ฌ ์์คํ ์ฌ๋ถํ ํ MongoDB๊ฐ ์์๋๋๋ก ํ ์ ์์ต๋๋ค.
sudo chkconfig mongod on
MongoDB๋ฅผ ์ค์งํฉ๋๋ค.
ํ์์ ๋ฐ๋ผ ๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๋ฅผ ์ค์งํ ์ ์์ต๋๋ค.
sudo service mongod stop
MongoDB๋ฅผ ๋ค์ ์์ํฉ๋๋ค.
๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๋ฅผ ๋ค์ ์์ํ ์ ์์ต๋๋ค:
sudo service mongod restart
/var/log/mongodb/mongod.log
ํ์ผ์ ์ถ๋ ฅ์ ํ์ธํ์ฌ ์ค๋ฅ๋ ์ค์ํ ๋ฉ์์ง์ ๋ํ ํ๋ก์ธ์ค ์ํ๋ฅผ ๋ฐ๋ฅผ ์ ์์ต๋๋ค.
MongoDB ์ฌ์ฉ์ ์์ํฉ๋๋ค.
mongod
์ ๋์ผํ ํธ์คํธ ๋จธ์ ์์
mongosh
์ธ์
์ ์์ํฉ๋๋ค. ๋ช
๋ น์ค ์ต์
์์ด
mongosh
๋ฅผ ์คํํ์ฌ ๊ธฐ๋ณธ ํฌํธ 27017์์ localhost์์ ์คํ ์ค์ธ mongod
์ ์ฐ๊ฒฐํ ์ ์์ต๋๋ค.
mongosh
๋ค๋ฅธ ํธ์คํธ ๋ฐ/๋๋ ํฌํธ์์ ์คํํ๋ mongod
์ธ์คํด์ค์ ์ฐ๊ฒฐํ๋ ๋ฑ
mongosh
(์)๋ฅผ ์ฌ์ฉํ์ฌ ์ฐ๊ฒฐํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ๋ด์ฉ์ mongosh ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ธ์.
MongoDB๋ ์ฌ์ฉ์ ์์ํ๋ ๋ฐ ๋์์ด ๋๋๋ก ๋ค์ํ ๋๋ผ์ด๋ฒ ์๋์ ์ ๋ํด ์์ ๊ฐ์ด๋๋ฅผ ์ ๊ณตํฉ๋๋ค. ๋๋ผ์ด๋ฒ ์ค๋ช ์๋ MongoDB๋ก ๊ฐ๋ฐ ์์ํ๊ธฐ๋ฅผ ์ฐธ์กฐํ์ธ์.
MongoDB ์ ๊ฑฐ
์์คํ ์์ MongoDB๋ฅผ ์์ ํ ์ ๊ฑฐํ๋ ค๋ฉด MongoDB ์ ํ๋ฆฌ์ผ์ด์ ์์ฒด์ ๊ตฌ์ฑ ํ์ผ ๋ฐ ๋ฐ์ดํฐ์ ๋ก๊ทธ๊ฐ ํฌํจ๋ ๋ชจ๋ ๋๋ ํ ๋ฆฌ๋ฅผ ์ ๊ฑฐํด์ผ ํฉ๋๋ค. ๋ค์ ์น์ ์์๋ ํ์ํ ๋จ๊ณ๋ฅผ ์๋ดํฉ๋๋ค.
๊ฒฝ๊ณ
์ด ํ๋ก์ธ์ค๋ MongoDB์ ๊ทธ ๊ตฌ์ฑ, ๋ชจ๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์์ ํ ์ ๊ฑฐํฉ๋๋ค. ์ด ํ๋ก์ธ์ค๋ ๋๋๋ฆด ์ ์์ผ๋ฏ๋ก ๋ชจ๋ ๊ตฌ์ฑ๊ณผ ๋ฐ์ดํฐ์ ๋ฐฑ์ ์ฌ๋ถ๋ฅผ ํ์ธํ ์ดํ์ ์งํํด์ผ ํฉ๋๋ค.
MongoDB๋ฅผ ์ค์งํฉ๋๋ค.
๋ค์ ๋ช
๋ น์ ์คํํ์ฌ mongod
ํ๋ก์ธ์ค๋ฅผ ์ค์งํฉ๋๋ค.
sudo service mongod stop
์ถ๊ฐ ์ ๋ณด
๊ธฐ๋ณธ ๋ก์ปฌ ํธ์คํธ ๋ฐ์ธ๋ฉ
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.
์ด ๊ฐ์ ๋ค์ ์ค ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก ๊ตฌ์ฑํ ์ ์์ต๋๋ค.
๊ฒฝ๊ณ
๋ก์ปฌ ํธ์คํธ๊ฐ ์๋ ์ ๋ฐ์ธ๋ฉํ๊ธฐ ์ ์(์: ๊ณต๊ฐ์ ์ผ๋ก ์ก์ธ์คํ ์ ์๋) IP ์ฃผ์ ์ธ ๊ฒฝ์ฐ ๋ฌด๋จ ์ก์ธ์ค ๋ก๋ถํฐ ํด๋ฌ์คํฐ ๋ฅผ ๋ณดํธํ๋์ง ํ์ธํฉ๋๋ค. ๋ณด์ ๊ถ์ฅ ์ฌํญ์ ์ ์ฒด ๋ชฉ๋ก์ ์์ฒด ๊ด๋ฆฌ ๋ฐฐํฌ์๋ฒ๋ฅผ ์ํ ๋ณด์ ์ฒดํฌ๋ฆฌ์คํธ๋ฅผ ์ฐธ์กฐํ์ธ์. ์ต์ํ ์ธ์ฆ ์ ํ์ฑํ ํ๊ณ ๋คํธ์ํฌ ์ธํ๋ผ๋ฅผ ๊ฐํํ๋ ๊ฒ์ ๊ณ ๋ คํ์ธ์.
bindIp
๊ตฌ์ฑ์ ๋ํ ์์ธํ ๋ด์ฉ ์ ์์ฒด ๊ด๋ฆฌ ๋ฐฐํฌ์๋ฒ์ IP ๋ฐ์ธ๋ฉ์ ์ฐธ์กฐํ์ธ์.
MongoDB Enterprise Edition ํจํค์ง
MongoDB Enterprise Edition์ ์ ์ฉ ๋ฆฌํฌ์งํ ๋ฆฌ์์ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ, ๋ค์๊ณผ ๊ฐ์ ๊ณต์ ์ง์ ํจํค์ง๋ฅผ ํฌํจํ๊ณ ์์ต๋๋ค.
ํจํค์ง ์ด๋ฆ | ์ค๋ช
| ||||||||
---|---|---|---|---|---|---|---|---|---|
|
| ||||||||
|
| ||||||||
| MongoDB Shell( | ||||||||
| ์ปดํจํฐ์ ์ด๋ฏธ ์ค์น๋ OpenSSL ๋ฒ์ ์ ์ฌ์ฉํ๋ MongoDB Shell( | ||||||||
|
|