简体   繁体   English

在 Azure VM 中对 mongoDB 运行定期代码

[英]Run periodic codes to mongoDB in Azure VM

I have the following :我有以下几点:

  1. Azure VM (Windows). Azure 虚拟机 (Windows)。
  2. Installed MongoDB in the VM.在 VM 中安装了 MongoDB。

My plan :我的计划 :

  1. Write python script to run periodically (say every 5 minutes) to pump the data into MongoDB.编写 python 脚本定期运行(比如每 5 分钟)将数据泵入 MongoDB。
  2. Initial plan is to use WebJob to run the script periodically then I realised I am not sure how to access MongoDB VM through Azure portal最初的计划是使用WebJob定期运行脚本然后我意识到我不确定如何通过 Azure 门户访问 MongoDB VM

My question :我的问题 :

  1. Is it possible to connect MongoDB VM through Azure portal?是否可以通过 Azure 门户连接 MongoDB VM? How?如何?
  2. What other services may be more suitable in this case?在这种情况下,还有哪些其他服务可能更合适?

Is it possible to connect MongoDB VM through the Azure portal?是否可以通过 Azure 门户连接 MongoDB VM? How?如何?

The Azure portal can only help you control the VM and the related resources, such as network, disk and etc. But it cannot help you to connect to the application inside the VM. Azure 门户只能帮助您控制虚拟机和相关资源,例如网络、磁盘等,而不能帮助您连接到虚拟机内部的应用程序。 What you can do is like the things you normally do.你能做的就像你平时做的一样。 Give the interface to access outside the VM.提供接口以在 VM 外部访问。 Treat the VM as a DB server like physically do.像物理一样将 VM 视为数据库服务器。 In addition, you need to open the port is the NSG if you create it and associate it with the VM nic or subnet.另外,如果创建NSG并将其与VM nic或子网关联,则需要打开该端口。

What other services may be more suitable in this case?在这种情况下,还有哪些其他服务可能更合适?

Maybe you can use the MongoDB Atlas on Azure and the WebJob.也许您可以使用Azure 上MongoDB Atlas和 WebJob。 But I think that install the MongoDB in the VM is also suitable.但我认为在VM中安装MongoDB也很合适。 You can follow the steps in Integrate your app with an Azure Virtual Network to combine your WebJob with the Vnet which you VM in so that your WebJob can connect with the MongoDB in the VM a private network.您可以按照将您的应用程序与 Azure 虚拟网络集成中的步骤将您的 WebJob 与您 VM 所在的 Vnet 相结合,以便您的 WebJob 可以与 VM 中的 MongoDB 连接到专用网络。

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

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