Mongoose: ๋ชฝ๊ตฌ์Šค์—์„œ `--authenticationDatabase`๋ฅผ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?

์— ๋งŒ๋“  2016๋…„ 02์›” 23์ผ  ยท  6์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: Automattic/mongoose

์…ธ์—์„œ ์ž‘๋™:

$ mongo -u monguser -p mongpass 192.168.2.2/ps --authenticationDatabase=admin
MongoDB shell version: 3.2.3
connecting to: 192.168.2.2/ps
Server has startup warnings: 
2016-02-23T01:59:10.522+0000 I CONTROL  [initandlisten] 
2016-02-23T01:59:10.522+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-02-23T01:59:10.522+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-02-23T01:59:10.522+0000 I CONTROL  [initandlisten] 
2016-02-23T01:59:10.522+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-02-23T01:59:10.522+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-02-23T01:59:10.522+0000 I CONTROL  [initandlisten] 
> db.foo.insert({can:'haz'})
WriteResult({ "nInserted" : 1 })

๋ชฝ๊ตฌ์Šค์—์„œ ์‹คํŒจ:

'use strict';

const mongoose = require('mongoose');

const uri = 'mongodb://monguser:[email protected]:27017/ps'

console.log('mongoose.connect =', mongoose.connect(uri, (err) => {
    err && console.log('err =', err);
}));
// For `mongoose.connect` output, see: https://gist.github.com/SamuelMarks/dedd863742f90cf2f333
err = { [MongoError: Authentication failed.]
  name: 'MongoError',
  message: 'Authentication failed.',
  ok: 0,
  code: 18,
  errmsg: 'Authentication failed.' }

๋”ฐ๋ผ์„œ authenticationDatabase ๊ฐ€ ์–ด๋–ป๊ฒŒ๋“  ์„ค์ •๋˜์–ด์•ผ ํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์•„๋งˆ๋„ config ๋งค๊ฐœ๋ณ€์ˆ˜์— ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. _๊ตฌ๋ฌธ์€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?_

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

๊ฐ€์žฅ ์‰ฌ์šด ๋ฐฉ๋ฒ•์€ uri์— authSource ๋ฅผ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

const uri = 'mongodb://monguser:[email protected]:27017/ps?authSource=admin';

๋ชจ๋“  6 ๋Œ“๊ธ€

๊ฐ€์žฅ ์‰ฌ์šด ๋ฐฉ๋ฒ•์€ uri์— authSource ๋ฅผ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

const uri = 'mongodb://monguser:[email protected]:27017/ps?authSource=admin';

๊ฐ์‚ฌ ํ•ด์š”

@vkarpov15 ๋‹น์‹ ์ด ๋‚ด ํ•˜๋ฃจ๋ฅผ ๊ตฌํ–ˆ์Šต๋‹ˆ๋‹ค. ์ •๋ง ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

mongodump ๋ช…๋ น์„ ์‚ฌ์šฉํ•  ๋•Œ authSource๋ฅผ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•„๋Š” ์‚ฌ๋žŒ์ด ์žˆ์Šต๋‹ˆ๊นŒ? :]

@ORESoftware mongodump๋Š” authenticationDatabase ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. https://docs.mongodb.com/manual/reference/program/mongodump/#cmdoption -authenticationdatabase

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰