测试使用dnsmasq。

 优势:可以方便的进行应该编码,进行动态域名解析,容错处理。
  因为consul 默认的dns 为127.0.0.1 8600
 所以配置如下:
 文件目录:
  1. /etc/dnsmasq.d ### 目录下
  1. # Enable forward lookup of the 'consul' domain:
  2. server=/consul/127.0.0.1#8600
  3. # Uncomment and modify as appropriate to enable reverse DNS lookups for
  4. # common netblocks found in RFC 1918, 5735, and 6598:
  5. #rev-server=0.0.0.0/8,127.0.0.1#8600
  6. #rev-server=10.0.0.0/8,127.0.0.1#8600
  7. #rev-server=100.64.0.0/10,127.0.0.1#8600
  8. #rev-server=127.0.0.1/8,127.0.0.1#8600
  9. #rev-server=169.254.0.0/16,127.0.0.1#8600
  10. #rev-server=172.16.0.0/12,127.0.0.1#8600
  11. #rev-server=192.168.0.0/16,127.0.0.1#8600
  12. #rev-server=224.0.0.0/4,127.0.0.1#8600
  13. #rev-server=240.0.0.0/4,127.0.0.1#8600
一些额外的配置

  1. # Accept DNS queries only from hosts whose address is on a local subnet.
  2. #local-service
  3. # Don't poll /etc/resolv.conf for changes.
  4. #no-poll
  5. # Don't read /etc/resolv.conf. Get upstream servers only from the command
  6. # line or the dnsmasq configuration file (see the "server" directive below).
  7. #no-resolv
  8. # Specify IP address(es) of other DNS servers for queries not handled
  9. # directly by consul. There is normally one 'server' entry set for every
  10. # 'nameserver' parameter found in '/etc/resolv.conf'. See dnsmasq(8)'s
  11. # 'server' configuration option for details.
  12. #server=1.2.3.4
  13. #server=208.67.222.222
  14. #server=8.8.8.8
  15. # Set the size of dnsmasq's cache. The default is 150 names. Setting the
  16. # cache size to zero disables caching.
  17. #cache-size=65536

nginx 做为负载均使用的方式

使用nginx  的 resolver  
  1. resolver 127.0.0.1:8600;
  2. set $backend "nginx.service.consul";
  3. location / {
  4. proxy_pass http://$backend;
  5. }


最新文章

  1. Windowns 10打开此电脑缓慢问题的一种解决办法
  2. wsdl学习
  3. Jsoncpp Compiler、Programming
  4. LINUX 下chmod|chown|chgrp和用法和区别
  5. C语言补码作用
  6. jquery事件重复绑定解决办法
  7. 无法连接远程SQL Server 数据库的原因
  8. cocos2d-x之Vector与map
  9. Java SE 第十讲---面向对象特征之封装2
  10. 常见mongo命令
  11. Extjs实现树形结构三连选
  12. 分解XML方法
  13. App测试的策略
  14. [04-05]box框模型(Box Model)定义了元素框处理元素内容、内边距、边框和外边距的方式
  15. nodeEE双写与分布式事务要点一二
  16. CodeForces 589F-Gourmet and Banquet-二分答案
  17. Luogu 1979 NOIP 2013 华容道(搜索,最短路径)
  18. 查询正在执行的SQL语句DBCCINPUTBUFFER
  19. VIP之MixerII
  20. 开放通用Api,总有你喜欢的

热门文章

  1. Android------底部导航栏BottomNavigationBar
  2. 《深入理解mybatis原理7》 MyBatis的二级缓存的设计原理
  3. 【Error】IOError: [Errno 22] invalid mode
  4. Redis--初入
  5. NumberFormat
  6. 求小于等于k长度的最大区间和
  7. Linux之VIM常用功能
  8. AS3帮助手册
  9. Linux内存中Swap机制(转)
  10. java正则匹配多个子字符串样例