简体   繁体   English

Cloud Run 中的 Node Js 和存储在 Cloud Storage 中的 Sqlite

[英]Node Js in Cloud Run and Sqlite stored in Cloud Storage

So I wanted to create a simple Node API using Express and using Sqlite as the database.所以我想使用Express创建一个简单的节点 API并使用Sqlite作为数据库。

I wanted to host the Node API in GCP Cloud Run but I can't store the sqlite database file.我想在GCP Cloud Run中托管节点 API,但我无法存储 sqlite 数据库文件。 I though of first putting the Node JS Application and Sqlite file in a instance in compute engine.我首先将 Node JS 应用程序和 Sqlite 文件放在计算引擎的实例中。

But then I though since sqlite only needs the sqlite file to run, I could just host the Node Js API in Cloud Run and store the sqlite database file in Cloud Storage and since the database in not really going to be accessed a lot and have a lot of data. But then I though since sqlite only needs the sqlite file to run, I could just host the Node Js API in Cloud Run and store the sqlite database file in Cloud Storage and since the database in not really going to be accessed a lot and have a很多数据。 I API is only used 3 people during work hours 9-5 5 days a week for my Client.我 API 仅在每周 5 天 9 到 5 天的工作时间内为我的客户使用3个人。

I was wondering if this is possible and if this is the cheapest option.我想知道这是否可行,以及这是否是最便宜的选择。

No you cannot do that.不,你不能那样做。 That's not how DBs work.这不是数据库的工作方式。 Sqlite doesn't just 'need' the DB file it needs a proepr filesystem to provide safe and performant read write access. Sqlite 不仅“需要”数据库文件,还需要一个 proepr 文件系统来提供安全和高性能的读写访问。

You can try mounting filestore to cloud run and have sqlite there and that might be the closest to what you want https://cloud.google.com/run/docs/tutorials/network-filesystems-filestore您可以尝试将文件存储安装到云运行并在那里安装 sqlite ,这可能最接近您想要的https://cloud.google.com/run/docs/tutorials/network-filesystems-filestore

You are better off having an instance that has the app and sqlite together or write your data to a cloud DB like google's managed DBs, yugabyte, cockroachdb etc您最好拥有一个具有应用程序和 sqlite 的实例,或者将您的数据写入云数据库,如谷歌的托管数据库、yugabyte、cockroachdb 等

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

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