大网数据广告活动
服务器运维问答

Can I change the IP address of a production web server?

· 52CE 我爱测

I need to change the IP address of a production web server. I was wondering if that is possible to do without downtime. The steps I thought would work were: Reserve a new static IP address Add the IP address to the DNS for the do…

问题原文

原帖链接 · CallMeNorm · CC BY-SA 4.0

I need to change the IP address of a production web server. I was wondering if that is possible to do without downtime. The steps I thought would work were:

  1. Reserve a new static IP address
  2. Add the IP address to the DNS for the domain I'm switching
  3. Deploy the kubernetes config that uses the new static IP
  4. Remove the old DNS entry
  5. Unreserve the old static IP address

Should I expect this to work? If nothing is listening on the other side of the new IP address, do most things just change over to the other IP address? Or do they fail hard?

已采纳解答

原帖链接 · Joe · CC BY-SA 4.0

The key phrase in your question is "without downtime" and the answer for your apparent configuration is "no." Let's assume your production web server is production.example.com.

Here's the timeline in your original post:

  1. Add the IP address to the DNS for the domain I'm switching

What is the FQDN that you're adding at this point? If it isn't the production.example.com address, then this new A record isn't doing anything to facilitate routing traffic to your new IP. If it is the A record for production.example.com then your TTL will come into play. I typically set mine to 300 (5 minutes) but that doesn't mean you have 5 minutes to execute step 3. Once that new address begins propagating to your clients they will begin trying to land HTTP requests on the new IP.

  1. Deploy the kubernetes config that uses the new static IP

Once you do this and restart your webserver any current TCP sessions will break which implies any inflight HTTP(s) requests will fail.

As to your question "If nothing is listening on the other side of the new IP address, do most things just change over to the other IP address?", yes, if there is no HTTP activity then you're okay.

In my experience, the "no downtime" requirement is hard to meet, and by hard I mean complex and expensive. What one should strive for is minimal downtime which can be achieved by having a solid process by which you're going to migrate the website, whether it be changing an IP address or moving it to a different server or upgrading an underlying database. Once you've developed the process, test it to see how your traffic behaves and where your assumptions are confirmed or denied. Refine the process to achieve the downtime metrics you're after, and test it again. Wash, rinse, and repeat.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-07-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。