![](/img/trans.png)
[英]Google Cloud Platform Connect to PostgreSQL Server from Cloud Functions Using Internal DNS Name
[英]How to connect to my Compute Engine MongoDB instance from Google Cloud Functions using the internal IP?
我的Google Cloud Functions與在Compute Engine VM Instance上運行的MongoDB數據庫完美配合,但前提是我在Function的MongoClient連接字符串中使用實例的外部IP地址。
如果我使用內部IP,我理想情況下更喜歡使用延遲和安全性,它會在30秒后超時並顯示:
document-create 4990695959542 DocumentCreate error: failed to connect to server [10.*.*.*:27017] on first connect [MongoError: connection 1 to 10.*.*.*:27017 timed out] document-create 4990695959542
document-create 4990695959542 Function execution took 30025 ms, finished with status: 'timeout' document-create 4990695959542
document-create 4990695959542 Function execution started document-create 4990695959542
我的mongodb.conf如下:
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,10.*.*.*
顯然, 10.*.*.*
是我的內部計算引擎實例。 我在Google雲端功能中的MongoClient連接字符串中使用的IP相同。
如果我使用我的外部IP並在mongodb.conf中我放了0.0.0.0,它可以工作。 我希望雲功能使用VM的內部IP連接到我的MongoDB計算引擎實例。
有幫助嗎?
目前這是不可能的。 雲功能存在於與項目的專用VPC不同的網絡上,因此只有公共IP訪問可用。
創建一個問題來請求此功能,您可以在其上添加您的請求並訂閱更新。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.