从我的应用程序连接到远程 mysql 服务器。问题是Mysql服务器在局域网上

发布于 2024-10-01 16:16:52 字数 539 浏览 1 评论 0原文

我有一台运行 apache+mysql 的远程服务器,并且我在我的家用计算机上开发了一个应用程序来管理我的数据库。我的家庭电脑上的应用程序连接到我的远程服务器,我正在从我的家庭电脑上管理我的数据库(正如我所说,mysql 在同一台远程计算机上运行)。

接下来的几天,由于流量很大,我将使用第二个远程服务器作为数据库服务器。我的第一个远程服务器将仅处理 apache,而新的远程服务器将仅处理 mysql 数据库。

新的mysql远程服务器将与局域网中的旧服务器连接。所以我的apache服务器中的网站可以像“192.168.xx”这样与数据库通信(你明白了)。

问题是:我的家庭应用程序如何与数据库服务器通信???数据库服务器将与我的Web服务器一起在局域网中,并且只有Web服务器可以“看到”数据库服务器,例如“192.168.xx”。我的家庭应用程序如何“看到”“隐藏”在局域网中的数据库服务器?

我是一名经验丰富的程序员,但对网络缺乏经验,请原谅我在描述中写的任何可能的废话,我希望你明白我的意思,如果你能给我一些帮助或给我指出任何有用的文章,我会很高兴 -方法的。

谢谢你们!

I have one remote server that runs apache+mysql and i have developed an appication in my home computer to administrate my database. My application from my home-pc connects to my remote server and i am administrating my database (as i said mysql runs on the same remote machine) from my home pc.

The following days, due to heavy traffic i am going to use a second remote server as a database server. My first remote server will handle apache only, and the new remote server will handle the mysql-database only.

The new mysql remote server will be connected with the old server in a LAN. So my website in the apache server can communicate with the database like "192.168.x.x" (you got the point).

Problem is: How my home application will communicate with the database server???? Database server will be in LAN together with my web server, and only web server can "see" the database server like "192.168.x.x". How can my home application can "see" the database server which is "hidden" in the LAN??

I am an experienced programmer but have little experience with networks, excuse any possible non-sense i wrote in the description, i hope you got my point and i would be glad if you can give me some help or point me to any usefull articles-how-to's.

Thank you guys!

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

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

发布评论

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

评论(2

倾其所爱 2024-10-08 16:16:52

我使用的应用程序利用 ssh 隧道来完成此操作。抱歉,这远不是一个完整的答案,但也许它会让您朝着正确的方向开始:)

an application I use utilizes an ssh tunnel to accomplish this. sorry that's nowhere's near a complete answer, but perhaps it will start you in the right direction :)

梦幻的味道 2024-10-08 16:16:52

网络是如何配置的?

[home pc] -> {internet} -> [firewall] -> [webserver] -> [database]

或者

[home pc] -> {internet} -> [firewall] ->  [webserver]
                                      |       |
                                      `-> [database]

在任一情况下,如果数据库服务器是唯一运行 MySQL 的计算机,您应该能够配置防火墙和/或 Web 服务器来转发 MySQL 端口(默认为 3306),以便外界关注,即使您实际上是通过防火墙/网络服务器路由数据包,数据库服务器也可以直接访问。

How is the network configured?

[home pc] -> {internet} -> [firewall] -> [webserver] -> [database]

or

[home pc] -> {internet} -> [firewall] ->  [webserver]
                                      |       |
                                      `-> [database]

In either, if the database server is the only machine that will be running MySQL, you should be able to configure the firewall and/or webserver to forward the MySQL port (3306 by default) so that as far as the outside world is concerned, the DB server is directly accesible, even though you're actually routing packets through the firewall/webserver.

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