我的数据库放置在哪里

发布于 2024-08-17 20:04:58 字数 280 浏览 2 评论 0 原文

目前我正忙于实现一个网站、数据库和软件来填充这个数据库。该网站放置在外部托管公司,该软件在本地网络上运行。网站需要读取数据库中的信息,本地软件会将其结果(这些数据)放入数据库中。

问题:我将把数据库放在哪里?考虑到安全性和性能,最好的地方是什么?还有哪些可能性:如果我将数据库与我的网站放在网络服务器上,我可以从本地软件访问它进行上传吗?如果我将数据库放在本地,我可以从我的网站访问它吗?

我是一名程序员,了解编程软件和实现数据库,但对基础设施知之甚少,所以请有人给我一些建议。

提前致谢, 杰思罗

At the moment i'm busy to implement a website, database and software which will fill this database. The website is placed at an external hosting company, the software is running at out local netwerk. The website needs to read the information in the database, the local software will put its results (these data) in the database.

Question: where will i put the database? What's the best place considering security and performance. And also what are the possibilities: if i put the database together with my website at the webserver, can i access it form my local software for uploading? If i put the database local, can i access it from my website?

I'm a programmer and know about programming software and implementing databases but have little knowledge about infrastructure, so can please someone give me some advice.

Thanks in advance,
Jethro

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

森林迷了鹿 2024-08-24 20:04:58

这是一个好问题。

从性能的角度来看,我会优化网络服务器完成的读取。按比例来说,网络服务器会发送更多的查询,如果数据库很慢,页面加载就会很慢。

从安全角度来看,连接到远程数据库可能很危险。但是,如果您采取适当的预防措施,例如使用 用于身份验证的 SSL 密钥对。还要确保数据库上的所有用户帐户只能从您信任的 IP 地址使用。

数据库放置还有另一个安全预防措施。当您的 Web 服务器和数据库位于同一台计算机上时,黑客可以使用多种攻击。最好的例子是 Hackproofing Mysql 中描述的 into outfile 攻击。如果数据库无法放置在自己的计算机上,则可以使用 chroot 或虚拟机。

This is a good question.

From a performance perspective I would optimize for reads done by the webserver. Proportionally there are going to be many more queries sent by the web server and if the database is slow, page will load slowly.

From a secuirty perspective connecting to remote databases can be hazardous. However, if you take the proper precautions, such as using an SSL key-pair for authentication. Also make sure that all user accounts on the database can only be used from IP address you trust.

There is another secuirty precaution with database placement. There are a number of attacks that hackers can use when your web server and database are on the same machine. The best example is the into outfile attack described in Hackproofing Mysql. If the database cannot be put on its own machine then a chroot or virtual machine can be used.

給妳壹絲溫柔 2024-08-24 20:04:58

两个地方?通过设置单向复制方案,您可以保证始终拥有数据的本地副本,但不会影响远程站点的性能。

复制可以由您的数据库或应用程序来管理。

Both places? By setting up a unidirectional replication scheme you can guarantee you always have a local copy of the data, but won't hamper the performance of the remote site.

Replication can be managed either by your database, or by your application.

始终不够 2024-08-24 20:04:58

您询问稳定性和性能,但一如既往,这是一个权衡问题,因此您必须决定在这些方面哪个更重要 - 网站或软件。

我假设该网站是(认为这就是您将信息上传到数据库的原因),从这个角度来看,将数据库放在您的网站旁边(与托管公司一起,其中大多数都提供此服务)。

这将使您的网站能够更快地访问数据,从而提高系统的稳定性(超时的可能性较小)

当然,您要付出的代价是软件,它现在必须远程连接到数据库。

另一个考虑因素是数据量 - 例如,如果您希望软件大量使用数据库而很少使用网站,您可能会考虑更改方法。

最后 - 关于远程访问数据库 - 您当然可以考虑简单地“正常”连接到数据库,但如果可能的话,我可能会考虑将其包装在 Web 服务中,这将使您

  1. 在位置和实现方面具有更大的灵活性数据库
  2. 使用广泛传播的协议(例如 WS-*),您可以实现更高的安全性,而无需 VPN 等基础设施

。同样,根据远程访问数据库的部分,您将选择将哪一侧公开为服务。这当然可能不太适合大量数据的上传。

You ask about stability and performance, but as always this is a question of trade offs, so you have to decide which is more important in these terms - the web site or the software.

I assume the web site is (thinking this is why you upload information into the database anyway) and from that point of view putting the database next to you web site (with the hosting company, most of which provide this service).

This would allow your web site to access the data more quickly and will therefore increase the stability of your system (less likelihood of timeouts)

The price you will pay, of course, is with the software, which now has to connect to the database remotely.

Another consideration is data volumes - if, for example, you expect the software to use the database heavily and the web site only sparingly, you might consider changing the approach.

Last - regarding accessing the database remotely - you can of course consider simply connecting to the database 'normally' but I would have probably considered wrapping it in a web service if possible, which would allow you

  1. To have more flexibility with the location and implementation of the database
  2. Using widely spread protocols such as WS-* you could achieve higher security without the need for infrastructure such as VPN

Again - depending on which part access the database remotely you would choose which side to expose as a service. this is of course potentially less suitable for large uploads of data.

为你拒绝所有暧昧 2024-08-24 20:04:58

为了稳定性和性能,您应该部署距离生产系统最近的数据库,在本例中是您的网站。假设您有良好的安全性和带宽,后端软件应该能够通过 TCP 访问托管服务器。这意味着最好采用所谓的点对点连接。另一种方法是通过互联网设置 VPN,这可能很慢且不可靠。

编辑:我所说的“生产”是指面向客户和关键任务,这可能不适合您的情况。两个系统的受众是谁?稳定哪个更重要?

通过使用点对点或 VPN,您可以假装您正在通过 LAN 连接计算机。然而,速度取决于您每月花费多少。

For stability and performance, you should deploy the database closest to the production system, which in this case is your web site. The backend software should be able to hit the hosted server over TCP assuming you have decent security and bandwidth between. This means it's preferred to have what's called point-to-point connection. The alternative is to set up a vpn over the Internet, which could be slow and unreliable.

Edit: By "production," I mean customer-facing and mission-critical, which may not be true for your case. Who are the audience of two systems? Which one is more important to be stable?

By using point-to-point or vpn, you can pretend as if you are hitting a computer over LAN. The speed however would depend on how much you spend per month.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文