Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb 从本地PC连接到docker容器中的数据库_Mongodb_Docker_Meteor_Digital Ocean_Meteor Up - Fatal编程技术网

Mongodb 从本地PC连接到docker容器中的数据库

Mongodb 从本地PC连接到docker容器中的数据库,mongodb,docker,meteor,digital-ocean,meteor-up,Mongodb,Docker,Meteor,Digital Ocean,Meteor Up,我有一个MeteorJs应用程序,我已经使用MeteorUp部署到Digital Ocean。如何从本地windows计算机使用MongoDB客户端连接到MongoDB数据库?我尝试使用MyDigitalOceanIP:27017,但出现“连接失败”错误 错误: Connection failed. SERVER [MyDigitalOceanIP:27017] (Type: UNKNOWN) CONNECTING Details: Timed out after 5000 ms while w

我有一个MeteorJs应用程序,我已经使用MeteorUp部署到Digital Ocean。如何从本地windows计算机使用MongoDB客户端连接到MongoDB数据库?我尝试使用MyDigitalOceanIP:27017,但出现“连接失败”错误

错误:

Connection failed.
SERVER [MyDigitalOceanIP:27017] (Type: UNKNOWN) CONNECTING
Details:
Timed out after 5000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=MyDigitalOceanIP:27017, type=UNKNOWN, state=CONNECTING}]
docker容器ls

CONTAINER ID        IMAGE                                  COMMAND                  CREATED             STATUS              PORTS                        NAMES
91502fe2c115        mup-todousingreactandmeteorjs:latest   "/bin/sh -c 'bash $M…"   12 minutes ago      Up 12 minutes       0.0.0.0:80->80/tcp           ToDoUsingReactAndMeteorJs
2d4be51b46a2        mongo:3.4.1                            "/entrypoint.sh mong…"   21 minutes ago      Up 21 minutes       127.0.0.1:27017->27017/tcp   mongodb
更新日期:2019年9月2日: 我现在收到一个
用尽了可用的身份验证方法的
错误

SSH Tunnel error: authentication failed: Exhausted available authentication methods    
Stacktrace:
|_/ SSH Tunnel error: authentication failed: Exhausted available authentication methods
|____/ SSH Tunnel error: Exhausted available authentication methods
这是我试过的

a. Copied public key from my local machine to ~/.ssh/authorized_keys folder in my Digital Ocean VM.
b. updated PasswordAuthentication, ChallengeResponseAuthentication, PubkeyAuthentication to yes in /etc/ssh/sshd_config.
c. In my local PC, created a standard connection with 
c.1. server localhost and port 27017, 
c.2. Authentication Mode None
c.3. Use SSL protocol to connect as unchecked. 
c.4. Use SSH tunnel to connect with ssh address as my public IP, port 22, SSH user name as the root user name. I tried with both ssh auth mode as private key(in OpenSSH format) and password. 

有两种可能性:

  • 端口27017不可公开使用(请参阅防火墙规则以打开端口)
  • 计算机没有公共IP地址

  • 检查您的防火墙规则,确保您正在连接到公共ip(而不是内部ip)

    谢谢@Mikkel。我已经决定设置Adminer,这样我就不必打开我的液滴上的输入端口。