SSH隧道到Heroku的远程数据库? [英] SSH tunneling to a remote DB from Heroku?

查看:379
本文介绍了SSH隧道到Heroku的远程数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑在Heroku上部署一个小型的Rails应用程序。为了省钱,我希望我的应用程序使用外部数据库(我可以免费访问),而不是使用Heroku托管的数据库。问题是免费数据库只接受本地连接。要从Heroku访问它,我需要通过SSH隧道来完成。



Heroku应用程序是否可以将数据保存在通过以下方式访问的外部数据库中: SSH?如果是这样,怎么做?



(对于奖励积分,这里有第二个问题:这是个好主意吗?一方面,这个方案可以让我免去支付Heroku数据库,另一方面,它意味着必须加密我所有的数据库流量,我想这会大大减慢我的网络动态,并减少它们可以提供的请求数量。为了支付更多的dynos吗?我可能会这样做吗?)

解决方案

不,即使它是一个选项是一个非常糟糕的主意,因为你会为每个请求添加大量的延迟,因为所有的意图和目的都必须为每个请求打开一个新的隧道。

你最好的选择是使用Heroku的开发层或初级层。如果您的数据库少于10,000行,则免费开发层将工作。他们的$ 15 /月起始层可以处理多达1,000,000行。


I'm thinking of deploying a small Rails app on Heroku. In an effort to save money, I'd like my app to use an external database (to which I have free access), rather than a Heroku-hosted database. The trouble is that the free database only accepts local connections. To access it from Heroku, I'd need to do so via an SSH tunnel.

Is it possible for a Heroku app to persist its data in an external DB accessed via SSH? If so, how?

(For bonus points, here's a second question: is this a good idea? On the one hand, this scheme would save me from paying for a Heroku database. On the other hand, it means having to encrypt all my database traffic. I imagine that this would massively slow down my web dynos, and reduce the number of requests they can serve. Would the money I save on the database get used up paying for more dynos? Am I likely to come out ahead by doing this?)

解决方案

No, and even if it was an option it's a really bad idea as you'd be adding massive latency to every request, since you'd for all intents and purposes have to open a new tunnel for every request.

Your best option is likely to use Heroku's development or starter tiers. The free development tier will work if your database is less than 10,000 rows. Their $15/mo starter tier works for up to 1,000,000 rows.

这篇关于SSH隧道到Heroku的远程数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆