Google 클라우드 컴퓨팅 인스턴스에 mongodb를 설정 했으므로 원격으로 연결하려고합니다. 내 mongod.conf 파일은 다음과 같다 :MongoDB 원격 서버에 연결할 수 없습니다.
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
#processManagement:
security:
authorization: 'enabled'
내가 설정을 인스턴스를 태그와 IP가 0.0.0.0/0
범위에 대한 tcp:27017
를 엽니 다 내 Google 클라우드 콘솔에서 방화벽 규칙을 가지고있다. 이 몽고처럼 보이는 포트 27017에서 확인
듣고있다 :
sudo netstat -tulpn | grep 27017
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 3781/mongod
전체 포트 27017가 열려처럼도 보인다
netstat --listen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:27017 *:* LISTEN
...
인스턴스 I 설치 관리자와 관리자 데이터베이스에 사용자 :
>use admin
>db.createUser(
{
user: 'admin',
pwd: 'somepass',
roles: [{ role: "userAdminAnyDatabase", db: "admin" }]
}
)
또한 테스트 데이터베이스 사용자 :
>use test
>db.createUser(
{
user: 'tester',
pwd: 'apassword',
roles: [{ role: "readWrite", db: "test" },
{ role: "read", db: "reporting" }]
}
)
이 사용자가 로컬로 작동합니다 그러나
>use test
>db.auth('tester', 'apassword')
1
내가 연결하려고 할 때 원격으로 실패 :
$ mongo -u tester -p apassword 12.345.67.890/test
MongoDB shell version v3.4.1
connecting to: mongodb://12.345.67.890/test
2017-11-14T12:47:07.369-0700 W NETWORK [main] Failed to connect to 12.345.67.890:27017 after 5000ms milliseconds, giving up.
2017-11-14T12:47:07.370-0700 E QUERY [main] Error: couldn't connect to server 12.345.67.890:27017, connection attempt failed :
[email protected]/mongo/shell/mongo.js:234:13
@(connect):1:6
exception: connect failed
나는 내가 거의 소진 한 네트워킹 전문가가 아니에요 이 시점에서 내 지식과 어떻게 진행 해야할지 모르겠다.
무엇이 누락 되었습니까? mongod.conf
? 방화벽을 잘못 설치 했습니까? 어떤 도움을 주셔서 감사합니다.