如何将同一个应用部署到多台服务器上

发布于 2024-12-04 12:03:23 字数 125 浏览 0 评论 0原文

寻找人们为了将相同的 Web 应用程序或进程部署到多个服务器而所做的事情的示例。 现在的部署过程包括将同一文件多次复制到我们公司内的不同服务器。现在必须有更好的方法来做到这一点,我正在研究 ms build 还有其他想法吗?提前致谢。

looking for examples of what people have done inorder to deploy the same webapp or processes to multiple servers.
The deployment process right now consists of copying the same file multiple times to different servers within our company. There has to be a better way to do this right now I am looking into ms build does anyone have other ideas? Thanks in advance.

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

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

发布评论

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

评论(4

还如梦归 2024-12-11 12:03:23

我使用了多种方法来做到这一点。然而,我认为最好的部署是我所说的“滚动”部署。

以下假设仅进行代码部署:

通过从负载平衡列表中删除一台或多台 Web 服务器来“离线”它们,我们将其称为 A 组。您应该保持足够的运行状态以跟上现有流量,我们将这些组称为组B. 将代码推送到离线服务器(A 组)。

然后,将 A 组重新旋转,并将 B 组拉出。确保应用程序仍然可以使用新代码运行。如果一切顺利,则更新 B 组并将它们重新轮流放回。如果出现问题,只需将 B 组放回原位,然后再将 A 组取出即可。

在数据库更新的情况下,还需要考虑其他因素。如果您可以在有限的时间内关闭整个网站,那么就这样做并执行所有必要的更新。这是迄今为止最简单的。

但是,如果您不能,则进行修改后的“滚动”部署,这需要多个数据库服务器。选择一个时间点并将生产数据库的副本移动到第二个时间点。应用您的更改。然后拉出一组 Web 服务器,将其代码更新到生产和测试。如果一切顺利,将这些 Web 服务器重新轮换并取出 B 组。更新 B 上的代码,同时将它们指向第二个数据库服务器。将它们放回旋转状态。

最后,将主生产数据库上发生的所有数据更改应用到辅助生产数据库。


请注意,我不使用 Web 部署或 MS 部署来推送到生产环境。坦率地说,我希望文件准备好复制/粘贴到服务器上的正确目录中,以便推送可以尽快运行。 Web 和 MS 部署选项都涉及通过网络连接传输这些文件;这通常比简单地从一个本地目录复制/粘贴到另一个目录要慢得多。

I've done this using a variety of methods. However, I think the best one is what I call a "rolling" deployment.

The following assumes a code only deployment:

Take one or more web servers "offline" by removing them from the load balancing list, let's call this group A. You should keep enough running to keep up with existing traffic, we'll call those group B. Push the code to the offline servers (group A).

Then, put group A back into rotation and pull group B out. Make sure the app is still functional with the new code. If all is good, update group B and put them back in rotation. In the event of a problem, just put group B back in and take A out again.

In the case of a database update there are other factors to consider. If you can take the whole site down for a limited period then do so and perform all necessary updates. This is by far the easiest.

However, if you can't then do a modified "rolling" deployment which requires multiple database servers. Pick a point in time and move a copy of the production database to the second one. Apply your changes. Then pull a group of web servers out, update their code to production and test. If all is good, put those web servers back into rotation and take out group B. Update the code on B while pointing them to the second DB server. Put them back into rotation.

Finally, apply all data changes that occurred on the primary production database to the secondary one.


Note, I don't use Web Deploy or MS Deploy for pushes to production. Quite frankly I want the files ready to be copy/pasted into the correct directory on the server so that the push can run as quickly as possible. Both Web and MS Deploy options involve transferring those files over a network connection; which is typically much slower than simply copy/pasting from one local directory to another.

冷了相思 2024-12-11 12:03:23

您可以构建一个简单的控制台应用程序,连接到固定的 sftp 下载、解压缩
并运行固定目录中的所有文件。元 XML 文件可用于创建规则
比如每台机器都会运行每个应用程序、前置要求等等。

如果您没有集中式服务器来统一您的应用程序,您还可以使用 dropbox api 下载文件。

You can build a simple console app that connects to a fixed sftp download, uncompress
and run all the files in a fixed directory. A meta XML file can be usefull to create rules
such as each machine will run each application, pre-requirements and so on.

You can also use dropbox api to download your files if you don't have a centralized server to unify your apps.

眼趣 2024-12-11 12:03:23

看看kwateeSDCM。它与语言和平台无关(Windows、Linux、Solaris、MacOS)。有一篇 文章 专门介绍 Web 应用程序的部署在多个 tomcat 服务器上。

Have a look at kwateeSDCM. It's language and platform agnostic (Windows, Linux, Solaris, MacOS). There's an article dedicated to deployment of a webapp on multiple tomcat servers.

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