简体   繁体   English

是否有将 AWS lightail mongoDB 与 mongo Compass 连接的过程?

[英]Is there an process to connect AWS lightsail mongoDB with mongo Compass?

I'm created lightsail instance for MEAN stack web app.我为 MEAN 堆栈 web 应用程序创建了 lightsail 实例。 So I watched the tutorial, they use rockmongo with GUI login.所以我看了教程,他们使用 Rockmongo 和 GUI 登录。 I created MongoDB database and user to access the database.我创建了 MongoDB 数据库和访问数据库的用户。 So I can use it only using the ssh command line.所以我只能使用 ssh 命令行来使用它。 So are there any process to connect the lightsail MongoDB with MongoDB compass?那么有没有什么程序可以将 lightsail MongoDB 与 MongoDB 罗盘连接起来?

I do it by following these steps:我按照以下步骤进行操作:

Accessing MongoDB using Rockmongo The MEAN instance includes Rockmongo, a web-based GUI for MongoDB.使用 Rockmongo 访问 MongoDB MEAN 实例包括 Rockmongo,这是一个用于 MongoDB 的基于 Web 的 GUI。 However, by defauit it can only be accessed via connections from localhost or hosts with the IP address of 127.0.0.1.但是,默认情况下,它只能通过来自 localhost 或 IP 地址为 127.0.0.1 的主机的连接来访问。

Because your web browser is running on your local machine, you'll need to establish an SSH tunnel between your local machine and the Lightsail instance.由于 web 浏览器正在本地计算机上运行,因此您需要在本地计算机和 Lightsail 实例之间建立 SSH 隧道。

Note: Step 1 below is for Mac and/or Linux users - if you're on Windows using Putty please see the instructions on the Bitnami page.注意:下面的第 1 步适用于 Mac 和/或 Linux 用户 - 如果您在 Windows 上使用 Putty,请参阅 Bitnami 页面上的说明。 Once you've configured Putty, pick up the instructions below at step 2.配置完 Putty 后,请在第 2 步中获取以下说明。

In your terminal open a second window and make sure you're in the directory with your default.pem file and create the SSH tunnel by entering the following command:在您的终端中打开第二个 window 并确保您位于包含 default.pem 文件的目录中,并通过输入以下命令创建 SSH 隧道:

ssh -N -L 8888:127.0.0.1:8080 -i default.pem bitnami@<instance_ip> ssh -N -L 8888:127.0.0.1:8080 -i default.pem bitnami@<instance_ip>

This command instructs your system to tunnel any requests to http://127.0.0.1:8888/ port 8080 on your Lightsail instance.此命令指示您的系统将任何请求通过隧道传输到 Lightsail 实例上的http://127.0.0.1:8888/端口 8080。

Note: Be sure to substitute your Lightsail instance's IP address where it says <isntance_ip>.注意:请务必将您的 Lightsail 实例的 IP 地址替换为 <isntance_ip>。

Note: There is no output from this command the cursor will just appear below the command line and sit there.注意:此命令中没有 output,cursor 只会出现在命令行下方并坐在那里。

In your web browser navigate to http://127.0.0.1:8888/rockmongo/在您的 web 浏览器中导航到http://127.0.0.1:8888/rockmongo/

Log in using the same credentials you used to access the MongoDB CLI previously.使用您之前用于访问 MongoDB CLI 的相同凭据登录。

You should be presented w/ the Rockmongo web UI.您应该看到 Rockmongo web UI。

Credit: https://github.com/mikegcoleman/todo信用: https://github.com/mikegcoleman/todo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM