gpt4 book ai didi

java - 尝试连接到 RDS 时 AWS EC2 间歇性 UnknownHostException

转载 作者:行者123 更新时间:2023-12-01 23:13:31 25 4
gpt4 key购买 nike

我在 ec2 上运行 Java Play。当我启动 Play on 产品时,一切都运行良好。但是,运行大约一天后,在连接到 RDS 实例时我将开始看到 UnknownHostException。这可以防止 ec2 和 rds 之间的任何事务。如果我再次重新启动应用程序,它会再次正常工作。

我已经检查了连接池,并且非常确定它工作正常。另外,我已经使用 networkaddress.cache.ttl = 0 和 networkaddress.cache.male.ttl = 0 对此进行了测试。但是,我仍然收到错误。

有人对此有什么想法吗?

最佳答案

只是将其移至评论中的答案。通过停止 EC2 实例然后重新启动它可以解决此问题。之后,就没有再出现该错误。

It did not fix itself in my case. I ended stopping/starting my ec2 instance and this fixed it permanently. My guess is that it got assigned to another (better configured) ec2 instance when I starting it back up.

当您 do this 时会发生什么.

  • New internal IP address, though could randomly be the same. [VPC instances keep same internal IP addresses through stop/start.]

  • New external IP address (though could randomly be the same).

  • If an Elastic IP address was associated with the instance before it was stopped, then you’ll need to re-associate it after the start. [VPC instances keep Elastic IP addresses associated through stop/start.]

  • Any contents on the instance’s former ephemeral storage were wiped and you are given fresh ephemeral storage (often mounted as /mnt).

  • You can leave an instance stopped for as long as you like and not get charged for run time (though you do get charged at a much lower rate for the EBS volume storage). See the next point.

  • A fresh billing hour is started for the instance when you start it again. E.g., if you start a new instance and then stop/start it 3 times within the first 60 minutes, you’ll get charged for 4 hours instead of 1.

  • There is a small chance that EC2 will not have available slots of the correct instance type to run your instance when you want to start it again. I’ve had this happen and temporarily switched to a different, available instance type to get it running again.

关于java - 尝试连接到 RDS 时 AWS EC2 间歇性 UnknownHostException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24834449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com