Weighted round robin dns between 2 Cloudfront distributions

故事扮演 提交于 2019-12-24 04:22:40

问题


We are trying to use aws to do some a gradual deployment test with our javascript code, but it seems to fail us

we created 2 S3 buckets with CF distributions :

a.example.net -> aaa.cloudfront.net

b.example.net -> bbb.cloudfront.net

than we created a weighted round robin DNS entry in route53

test.example.net -> (cname) -> aaa.cloudfront.net (5)

test.example.net -> (cname) -> bbb.cloudfront.net (95)

in the S3 bucket we put a file with the CF corresponding domain name for each bucket :

http://test.example.net/dns-test/test.txt

What I am expecting is to get 95% of the time bbb and 5% of the time d3nrwpaeicu4xy. What we actually get is aaa 100% of the time :(

I opened a ticket to the route53 team to check if this is a problem with the dns configuration but they have shown me , and I have seen it myself that the dns queries split between the 2 buckets.

Hope this is clear enough.


回答1:


Unfortunately what you are trying to do is not possible. CloudFront, or any HTTP server for that matter, only see's the host header of test.example.com. It has no idea how you got there, be it WRR DNS or hosts file, it only see's the host header. I'm not sure how you configured the same CNAME on two CloudFront distributions, it shouldn't be possible.

For this to work, you would need to utilize two different services, for example, S3 and CloudFront. Create a bucket for test.example.net and a CloudFront distribution configured with test.example.net. Then you can WRR as both services will serve your content for test.example.net




回答2:


Don't forget that your DNS records will be cached by all DNS resolvers. Then your load sharing has very little chance to reflect the weight you configured. DNS was not designed for this



来源:https://stackoverflow.com/questions/30557480/weighted-round-robin-dns-between-2-cloudfront-distributions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!