DB for AppEngine?

blov · · 488 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I decided on a whim to convert something I&#39;m working on to an AppEngine app, just for practice. Failed at the first hurdle because apparently BoltDB imports <code>syscall</code>, which AppEngine doesn&#39;t like.</p> <p>On investigation this appears to be a security choice on Google&#39;s end, which is fair enough, but that being so, what K/V store is recommended for use with AppEngine and how much of a pain is moving over likely to be? I would very much rather not use different databases in development and production, if at all possible. (This final constraint is what rules out Cloud Datastore, Cloud SQL, BigTable etc, which I can&#39;t use when developing offline.)</p> <hr/>**评论:**<br/><br/>TheMerovius: <pre><p>The whole idea of a Platform as a service like AppEngine is that you use the platform provided. Your choices are <a href="https://cloud.google.com/datastore/" rel="nofollow">Datastore</a> (<em>very</em> likely what you want), <a href="https://cloud.google.com/sql/" rel="nofollow">Cloud SQL</a> or <a href="https://cloud.google.com/bigtable/" rel="nofollow">Bigtable</a> (pretty hard to get right. Likely not what you want unless you have a <em>lot</em> of data, on the order of Petabytes).</p> <p>There are other, more specialized things, for file storage and the like, but those are the actual &#34;databases&#34;. And you likely want Datastore.</p></pre>TheMerovius: <pre><p>Also, the reason that AppEngine provides such a strict runtime environment is not <em>only</em> security, but also that it makes it next to impossible to write apps that don&#39;t scale horizontally. It forces you to put all your state explicitly into a backend-layer.</p></pre>Xychologist: <pre><p>Cloud Datastore is indeed the closest to what I need, I would just prefer something that when necessary for development can be run locally without internet access.</p> <p>On further investigation, there does seem to be an offline <a href="https://cloud.google.com/datastore/docs/tools/datastore-emulator" rel="nofollow">Cloud Datastore emulator</a>, which makes that a viable option if I can get it working.</p></pre>TheMerovius: <pre><p>Doesn&#39;t the AppEngine SDK just transparently come with Datastore? I thought I used that at some point. I&#39;d assume the emulator is only useful if you want to develop for a VM or something. Especially as, AFAIK, you can&#39;t use gRPC on AppEngine (might be wrong about this).</p> <p>You should just go through the <a href="https://cloud.google.com/appengine/docs/go/quickstart" rel="nofollow">tutorials and stuff</a> for go on AppEngine, it should walk you through everything you need.</p></pre>joncalhoun: <pre><p>I believe you are right. I don&#39;t recall needing the internet to do AppEngine development w/ Datastore. I think they do something to emulate it locally.</p></pre>npyde: <pre><p>Install the official Google AppEngine SDK. You can develop everything locally, no Internet access required.</p></pre>CaptaincCodeman: <pre><p>You can also put your data access behind an interface so you can mock the datastore part for testing or replace it with something else (MongoDB?) that you can run locally ... with the added benefit that you are not tied to AppEngine.</p> <p>There&#39;s an example here: <a href="https://github.com/CaptainCodeman/clean-go" rel="nofollow">https://github.com/CaptainCodeman/clean-go</a></p> <p>Also, the Flex runtime gives you the benefit of AppEngine scaling but runs on custom Compute Engine instances so you are free to use a less sand-boxed environment (put whatever you want on a Docker image).</p></pre>seriouslulz: <pre><p>You can use the HRD offline</p></pre>m3wm3wm3wm: <pre><p>If you want to use App Engine Datastore in Go, use luci/gae datastore package: <a href="https://github.com/luci/gae/tree/master/service/datastore" rel="nofollow">https://github.com/luci/gae/tree/master/service/datastore</a></p> <p>This is like python&#39;s ndb, and even better.</p> <p>I think they are going to make the documentation better, meanwhile, I found this issue where people ask questions: <a href="https://github.com/luci/gae/issues/56" rel="nofollow">https://github.com/luci/gae/issues/56</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

488 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传