consul dns 转发配置
摘要:优势:可以方便的进行应该编码,进行动态域名解析,容错处理。
测试使用dnsmasq。
优势:可以方便的进行应该编码,进行动态域名解析,容错处理。
因为consul 默认的dns 为127.0.0.1 8600
所以配置如下:
文件目录:
#Enableforward lookup of the 'consul'domain:
server=/consul/127.0.0.1#8600
#Uncommentand modify as appropriate to enable reverse DNS lookups for
#common netblocks found in RFC 1918,5735,and 6598:
#rev-server=0.0.0.0/8,127.0.0.1#8600
#rev-server=10.0.0.0/8,127.0.0.1#8600
#rev-server=100.64.0.0/10,127.0.0.1#8600
#rev-server=127.0.0.1/8,127.0.0.1#8600
#rev-server=169.254.0.0/16,127.0.0.1#8600
#rev-server=172.16.0.0/12,127.0.0.1#8600
#rev-server=192.168.0.0/16,127.0.0.1#8600
#rev-server=224.0.0.0/4,127.0.0.1#8600
#rev-server=240.0.0.0/4,127.0.0.1#8600
一些额外的配置
#AcceptDNS queries only from hosts whose address is on a local subnet.
#local-service
#Don't poll /etc/resolv.conf forchanges.
#no-poll
#Don't read /etc/resolv.conf.Getupstream servers only from the command
#line or the dnsmasq configuration file (see the "server"directive below).
#no-resolv
#SpecifyIP address(es)of other DNS servers forqueries not handled
#directly by consul.Thereis normally one 'server'entry setforevery
#'nameserver'parameter found in '/etc/resolv.conf'.Seednsmasq(8)'s
#'server'configuration option fordetails.
#server=1.2.3.4
#server=208.67.222.222
#server=8.8.8.8
#Setthe size of dnsmasq's cache.Thedefaultis 150names.Settingthe
#cache size to zero disables caching.
#cache-size=65536
nginx 做为负载均使用的方式
使用nginx 的 resolver
resolver 127.0.0.1:8600;
set$backend "nginx.service.consul";
location /{
proxy_pass http://$backend;
}
免责声明:文章转载自《consul dns 转发配置》仅用于学习参考。如对内容有疑问,请及时联系本站处理。
上篇Oracle11g温习-第十一章:管理undopytest文档69-Hook函数之参数化生成测试用例pytest_generate_tests下篇
宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=