0. ํ์๊ฐ์
https://www.mongodb.com/cloud/atlas
Managed MongoDB Hosting | Database-as-a-Service
Host MongoDB in the cloud with MongoDB Atlas, the official database-as-a-service, on AWS, Azure and GCP. Try free!
www.mongodb.com
1. ํ๋ก์ ํธ๋ช ์ ๋ ฅ

2. ๊ณต์ ์ ์ ์ค์
: ํ๋ก์ ํธ ์์ฑ ์ดํ์๋ ์์ ํ ์ ์๋ค.

3. Cluster ์์ฑ
์ฌ์ฉ๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ Cluster๋ผ๊ณ ๋ถ๋ฅธ๋ค.


4. User ์ ๋ณด ์ค์ ํ๊ธฐ


๋ค์ Clusters ๋์๋ณด๋๋ก ๋์ด๊ฐ์ Connect๋ฅผ ํด๋ฆญํ์.
UserID๋ฅผ ์ค์ ํ๋ฉด๋๋ค. UserId์ ๋น๋ฐ๋ฒํธ๋ ์ฐ๊ฒฐํ ๋ ์ฐ์ด๋ ๊ฒ์ ๋ช ์ฌํ์.
์ผ์ชฝ Database Access ๋ฉ๋ด๋ฅผ ์ ํํ๊ณ ์ค๋ฅธ์ชฝ์ Add New User ๋ฒํผ์ ๋๋ฅด์. ์ฒ์์ ์ ๋ ฅํ email๊ณผ ๋น๋ฐ๋ฒํธ๋ mongodb.com์ ์ด์ฉํ๊ธฐ ์ํ ํ์๊ฐ์ ์ด๊ณ , ์ฌ๊ธฐ์์ user๋ DB๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํ user์ ๋๋ค. ๋ณ๊ฐ์ ๊ณ์ ์ด๋ค.

์ด๋ ๊ฒ ํ์ ์ด ๋จ๋๋ฐ, username๊ณผ password๋ฅผ ์ค์ ํ๊ณ Add User ๋ฒํผ์ ๋๋ฆ ๋๋ค. ์ด username๊ณผ password๋ DB connection string์ ๋ง๋ค ๋ ์ฌ์ฉ๋๋ฏ๋ก ์ ๊ธฐ์ตํด๋์
5. Network Access IP ์ค์ ํ๊ธฐ



๋ค์์ผ๋ก IP whitelist๋ฅผ ์ค์ ํ๋ค. ๋ณด์์ ์ํด username๊ณผ password๊ฐ ์๋๋ผ๋ ์๋ฌด IP์์๋ ์ ์ํ ์ ์๊ณ , ์ง์ ๋ IP์์๋ง DB์ ์ ๊ทผํ ์ ์๊ฒ ํ๋ ์ค์ ์ด๋ค. mongoDB Atlas๋ ์ด ์ค์ ํ์ง ์์ผ๋ฉด DB๋ฅผ ์ฌ์ฉํ ์ ์๋ค.
์ผ์ชฝ์ ์ํ๋ฆฌํฐ ๋ณด๋ฉด Network Access ์ค์ ํ์ด์ง๋ก ๊ฐ ์ ์๋ค. ๋ง์ฝ ์๋ฒ์ ์์ดํผ๊ฐ ํ์คํ ์ ํด์ก๋ค๋ฉด ์์ดํผ๋ฅผ ์ ๋ ฅํ๋ฉด๋๊ณ , ๊ฐ๋ฐ๋จ๊ณ๋ผ๋ฉด 0.0.0./0 ์ธ ๋ชจ๋ ์์ดํผ ํ์ฉ์ ์ง์ ํด์ฃผ์. (๋๋ ๋ฏธ๋ฆฌ ํด๋์ ์์ง๋ง ์๋ง ๋ฒํผ์ด ๋ฐ๋ก ์์ ๊ฒ์ด๋ค.)
Allow Access From Anywhere ๋ฒํผ์ ๋๋ฅด๋ฉด ์๋์ผ๋ก 0.0.0.0/0์ด ์ ๋ ฅ๋ฉ๋๋ค. ์ด๋ ๊ฒ ์ค์ ํ๋ฉด ์๋ฌด IP์์๋ ์ ์ํ ์ ์์ต๋๋ค. ๋ฌผ๋ก ์ฐ์ต์ฉ์ธ ๊ฒฝ์ฐ์๋ง ์ด๋ ๊ฒ ์ค์ ์ ํ์๊ณ , ์ค์ ์ฌ์ดํธ์์ ์ฌ์ฉํ๋ ค๋ฉด ์ด๋ ๊ฒ ์ค์ ํ๋ฉด ์๋๋ค.
6. ๋ชฝ๊ณ DB ์ฐ๊ฒฐ ๋ฐฉ์ ์ ํํ๊ธฐ


์ฌ๋ฌ๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก DB์ ์ ์ํ ์ ์๋ค. Conect Your Application ๋ฒํผ์ ๋๋ฌ connection string์ ์ป์

DB username๊ณผ password๋ก ๋ฐ๊ฟ์ค๋ค.
<>๊น์ง ์ง์ฐ๊ณ ์ ๋ ฅํ๋ค.
๋ง์ฝ username์ด test_username์ด๊ณ , password๊ฐ test_password๋ผ๋ฉด, connection string์ ๋ค์๊ณผ ๊ฐ์ ํํ๊ฐ ๋ฉ๋๋ค.
mongodb+srv://test_username:test_password@cluster0-jfwrx.mongodb.net/test?retryWrites=true&w=majority
'๐ Back > ๐ MongoDB' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| ์คํค๋ง ๋ง๋ค๊ธฐ: ์คํค๋ง, ๋ชจ๋ธ, ์ปฌ๋ ์ (0) | 2021.02.05 |
|---|---|
| mongoDB ์ฐ๊ฒฐํ๊ธฐ (0) | 2021.02.05 |
| MongoDB ๋? ๋ํ์ ์ธ NOSQL ๋ฐ์ดํฐ๋ฒ ์ด์ค (0) | 2021.01.19 |