๐Ÿ‘ฆ ๋‚ด์ผ๋ฐฐ์›€์บ ํ”„/TIL(Today I Learned)

TIL_220507_DB ์˜ค๋ฅ˜

  • -

ํ”„๋กœ์ ํŠธ ๊ณผ์ œ ์ค‘์— ๊ฐ‘์ž๊ธฐ..

 

์–ด์ œ๋งŒ ํ•ด๋„ ์ž˜ ๋˜๋˜ mongo DB : robo 3T ๊ฐ€ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ •๋ฆฌํ•˜๋”๋‹ˆ ์ €์žฅ์†Œ๋ฅผ ๋ชป์ฐพ๊ณ 

 

'cannot connect to the mongodb at localhost 27017'

 

์ด๋ผ๋Š” ์˜ค๋ฅ˜๋ฅผ ๋ฑ‰์–ด๋ƒˆ๋‹ค.

 

์ € ์ฆ์ƒ์— ๋Œ€ํ•œ ์˜ค๋ฅ˜๋ฅผ ์ฐพ์•„๋ดค์ง€๋งŒ,

 

ํ„ฐ๋ฏธ๋„์— ๋ฌด์Šจ 'brew services start mongodb-community' ๋ช…๋ น์–ด๋‚˜

 

'~ netstat -an | grep 27017' ๊ณผ ๊ฐ™์€ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ด ํ•ด๊ฒฐํ•˜๋ผ ํ–ˆ์œผ๋‚˜ ๊ฒฐ๊ตญ ๋˜์ง€ ์•Š์•˜๋‹ค.

 

์ฐพ๋Š” ๋์— ์–ด๋–ค ๋ธ”๋กœ๊ทธ๋ฅผ ํ†ตํ•ด์„œ ํ•ด๊ฒฐํ•ด ๋ณผ ์ˆ˜ ์žˆ์—ˆ๋‹ค.

 


 

๊ฐ€์žฅ ๋„์›€์ด ๋œ ๋ธ”๋กœ๊ทธ

https://daydreamx.tistory.com/entry/MongoDB-cannot-connect-to-the-mongodb-at-localhost-27017

 

[MongoDB] cannot connect to the mongodb at localhost 27017

๋ถ„๋ช… ๋ชฉ์š”์ผ๊นŒ์ง€๋งŒ ํ•ด๋„ MongoDB๊ฐ€ ์ œ๋Œ€๋กœ ๋™์ž‘ํ–ˆ๋Š”๋ฐ, ์˜ค๋Š˜ robo3T๋ฅผ ์ผฐ๋”๋‹ˆ cannot connect to the mongodb at localhost 27017 ์ด๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋–ด๋‹ค. ๊ทธ๋ž˜์„œ cmd๋ฅผ ํ†ตํ•ด mongo ๋ช…๋ น์„ ์‹คํ–‰ํ•ด ๋ณด์•˜๋”๋‹ˆ ๋‹ค์Œ๊ณผ ๊ฐ™..

daydreamx.tistory.com

 

๋ฐฉ๋ฒ•์€ ๊ฐ„๋‹จํ–ˆ๋‹ค.

 

db ์ €์žฅ์†Œ์˜ ๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ์ง€์ •ํ•ด์ฃผ๋Š” ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

 

mongod --dbpath <ํด๋” ๊ฒฝ๋กœ>

 

์˜ˆ๋ฅผ ๋“ค์–ด mongoDB ๋ฐ์ดํ„ฐ๊ฐ€ ์ €์žฅ๋œ ๊ฒฝ๋กœ๊ฐ€ 'D:\MyDB\data' ์˜€๋‹ค๋ฉด 'mongod --dbpath D:\MyDB\data' ๋ฅผ ์ž…๋ ฅํ•ด ์„ค์ •ํ•ด์ค€๋‹ค.

 

๊ทธ๋Ÿฌ๋ฉด ๋ง‰ ์•Œ ์ˆ˜ ์—†๋Š” ์˜์–ด๊ฐ€ ๋ง‰ ๋‚˜์˜ค๋ฉด์„œ ์ž‘๋™ํ•˜๋Š” ๋Š๋‚Œ์„ ๋ฐ›์„ ๊ฒƒ์ด๊ณ ,

 

๋‹ค์‹œ robo 3T ๋กœ ํ™•์ธํ•ด๋ณด๋ฉด ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™์„ ํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 


 

๋‹ค๋งŒ ์ด ์œ„์— ๋ฐฉ๋ฒ•์œผ๋กœ ํ–ˆ์„ ๋•Œ ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ ๋˜๋Š” ๊ฒƒ์€

 

๋‚ด ๋…ธํŠธ๋ถ์„ ์žฌ๋ถ€ํŒ…ํ•˜๊ณ  ๋‚œ ์ดํ›„์˜ ์กฐ๊ฑด์ด ๋ถ™๋Š”๋‹ค.

 

๋‚˜๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ์ •๋ฆฌํ•˜๊ณ ์ž ์ตœ์ ํ™” ํ”„๋กœ๊ทธ๋žจ์„ ๋Œ๋ ธ๋Š”๋ฐ,

 

์ดํ›„์— ์ € ๋ฐฉ๋ฒ•์„ ํ†ตํ•ด ๋‚˜ํƒ€๋Š” ์ฆ์ƒ์€ ์ผ๋ถ€ DB ๊ฐ€ ์ง€์›Œ์ ธ์žˆ๋Š”, ๋ญ”๊ฐ€ ์ดˆ๊ธฐ์ƒํƒœ์˜ DB ๋งŒ ๋‚จ์•„์žˆ์—ˆ๋‹ค.

 

ํ˜น์‹œ ๋ชฐ๋ผ ์žฌ๋ถ€ํŒ…์„ ํ†ตํ•ด robo 3T ๋กœ ํ™•์ธํ–ˆ๋Š”๋ฐ,

 

์œ„์˜ ๋ฐฉ๋ฒ•์€ ๊ณ ์‚ฌํ•˜๊ณ  ๊ทธ๋ƒฅ ์ž˜ ๋˜๊ธฐ๋งŒ ํ–ˆ๋‹ค.

 

์ด ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๊ฑฐ๋“  ์‚ฌ์šฉ ์ „์— ๋จผ์ € ์žฌ๋ถ€ํŒ…์„ ํ•ด๋ณด๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•œ๋‹ค.

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.