I have an app with two workers (Web and Background) on AppHarbor that connect to a MySql database hosted on Amazon's RDS.
我在AppHarbor上有一个带有两个工作人员(Web和背景)的应用程序,它连接到亚马逊RDS上托管的MySql数据库。
I keep getting "Unable to connect to any of the specified MySQL hosts." exception.
我一直得到“无法连接到任何指定的MySQL主机。”例外。
The RDS instance in the US-East region and I have added the following AppHarbor CIDR to the security group.
美国东部地区的RDS实例和我已将以下AppHarbor CIDR添加到安全组。
- 50.17.211.192/28
- 54.235.159.192/27
I have added my own CIDR to the security group and I connect to the instance just fine. However when the app is running on AppHarbor it fails.
我已经将自己的CIDR添加到安全组中,并且我很好地连接到实例。但是,当应用程序在AppHarbor上运行时,它会失败。
My connection string (censored) is:
我的连接字符串(审查)是:
Server=myinstanceXXXX.cykjvptrw5xs.us-east-1.rds.amazonaws.com;Database=MyDatabase;UID=XXXXXX;PWD=XXXXX;
I have tried including the port 3306 on the server endpoint but it made no difference.
我已经尝试在服务器端点上包含端口3306,但它没有任何区别。
Am I missing something on getting the two to play nice with one another?
我错过了让两个人互相玩得开心的事吗?
1 个解决方案
#1
1
By default AppHarbor use Amazon's internal DNS service for resolving hostnames. Because of that Amazon RDS instances in the same region as AppHarbor will resolve the private IP addresses rather than the public ones listed in the knowledge base article, so setting up rules based on the public IPs will not work most of the time.
默认情况下,AppHarbor使用Amazon的内部DNS服务来解析主机名。由于与AppHarbor位于同一区域的Amazon RDS实例将解析私有IP地址而不是知识库文章中列出的公共IP地址,因此基于公共IP设置规则在大多数情况下都不起作用。
In case Amazon's DNS service becomes unavailable we'll fail over to an external DNS service. This means you'll still have to configure the external IPs for the highest availability as an external DNS service will resolve the public IPs. This way you can ensure that your application is resilient towards DNS failures.
如果亚马逊的DNS服务不可用,我们将故障转移到外部DNS服务。这意味着您仍然必须配置外部IP以获得最高可用性,因为外部DNS服务将解析公共IP。这样,您可以确保您的应用程序能够抵御DNS故障。
You can set up security group based access rules for your RDS security group. We've updated this knowledge base article with a section specifically for Amazon RDS where you can find the information necessary to set this up.
您可以为RDS安全组设置基于安全组的访问规则。我们已经使用专门针对Amazon RDS的部分更新了此知识库文章,您可以在其中找到设置此内容所需的信息。
#1
1
By default AppHarbor use Amazon's internal DNS service for resolving hostnames. Because of that Amazon RDS instances in the same region as AppHarbor will resolve the private IP addresses rather than the public ones listed in the knowledge base article, so setting up rules based on the public IPs will not work most of the time.
默认情况下,AppHarbor使用Amazon的内部DNS服务来解析主机名。由于与AppHarbor位于同一区域的Amazon RDS实例将解析私有IP地址而不是知识库文章中列出的公共IP地址,因此基于公共IP设置规则在大多数情况下都不起作用。
In case Amazon's DNS service becomes unavailable we'll fail over to an external DNS service. This means you'll still have to configure the external IPs for the highest availability as an external DNS service will resolve the public IPs. This way you can ensure that your application is resilient towards DNS failures.
如果亚马逊的DNS服务不可用,我们将故障转移到外部DNS服务。这意味着您仍然必须配置外部IP以获得最高可用性,因为外部DNS服务将解析公共IP。这样,您可以确保您的应用程序能够抵御DNS故障。
You can set up security group based access rules for your RDS security group. We've updated this knowledge base article with a section specifically for Amazon RDS where you can find the information necessary to set this up.
您可以为RDS安全组设置基于安全组的访问规则。我们已经使用专门针对Amazon RDS的部分更新了此知识库文章,您可以在其中找到设置此内容所需的信息。