拉疙瘩屎是什么原因| 羊肉汤放什么调料| 妈妈的爱是什么| 男士睾丸疼是什么原因| exo什么时候出道的| 安装空调需要注意什么| 毛遂自荐是什么意思| 五步蛇为什么叫五步蛇| 1.7号是什么星座| 脚丫痒是什么原因| 灰指甲是什么原因引起| 九个口是什么字| 木瓜是什么季节的| 甲亢不能吃什么| 下火吃什么药| 癞子是什么意思| 老酒是什么酒| 帝加口念什么| 痛风吃什么水果最好| 吃高血压药有什么副作用| gala是什么意思| 艺体生是什么意思| 血常规wbc是什么意思| 什么克金| 第三代身份证什么时候开始办理| 夏天为什么这么热| 家里有壁虎是什么征兆| 什么是阴虚什么是阳虚| 丘疹性荨麻疹用什么药| 8月23日是什么星座| 矿物质是什么| 梦见挖野菜是什么意思| 桃子可以做什么美食| 骨穿是检查什么的| 胆小怕事是什么生肖| 耳朵长疙瘩是什么原因| mg是什么元素| 口腔有异味是什么原因引起的| 吃什么才能长胖| 什么地问| 吃完海鲜不能吃什么水果| 用什么泡水喝补肾| 什么是日记| 吃什么补心脏供血不足| 心脏做造影是什么意思| pisen是什么牌子| 脂肪瘤挂什么科| 肝挂什么科| 胺碘酮又叫什么名字| 发烧吃什么食物| 老师家访的目的是什么| 八月20号是什么星座| 男人喝劲酒有什么好处| 四大皆空是什么生肖| 猪生肠是什么部位| 男生被口什么感觉| hcy是什么检查项目| 孕妇吃什么会流产| 苍龙七宿的秘密是什么| 内痔疮有什么症状| 景气是什么意思| 矫枉过正什么意思| 脉络膜裂囊肿是什么病| 藏红花是什么| 什么茶叶降血压最好| 吃什么流产最快| 吴刚和嫦娥什么关系| 可怜巴巴是什么意思| 十一月份出生的是什么星座| 骨密度低吃什么药最快| 疏肝理气吃什么药| 五月十八什么星座| 早上适合做什么运动| 去湿气吃什么最好| 上火便秘吃什么最快排便| 什么叫桑黄| 庚什么意思| 肠胃功能紊乱什么症状| 孕妇建档需要检查什么| 水命和什么命最配| 养胃吃什么好| 常吃南瓜子有什么好处和坏处| 达英35是什么| 男人身体怕冷是什么原因如何调理| 钙果是什么水果| 童心未眠什么意思| 蚂蚁搬家是什么意思| 梦见棺材是什么征兆| 转的第三笔是什么| 抗酸杆菌是什么意思| 素肉是什么| 秋葵什么时候种植最好| 纤维素纤维是什么面料| 什么书最香| 嘴巴周围长痘痘是什么原因| 挑担是什么关系| 葡萄球菌是什么| 什么叫肝腹水| 老佛爷是什么牌子| 原发性肝ca什么意思| 崛起是什么意思| 乏力是什么意思| 头发大把大把的掉是什么原因| 全职太太是什么意思| 心电图窦性心动过速是什么意思| 头疼想吐是什么原因| 丽珠兰是什么| 忘恩负义的负是什么意思| 78年属什么生肖| 痛风反复发作什么原因| 腰痛什么原因| 石榴花什么时候开花| 薄熙来犯了什么罪| 吃什么排毒最快| 1988是什么年| 子宫内膜囊性增生是什么意思| 胸闷气短吃什么药效果好| 丝状疣长什么样| 流鼻涕咳嗽吃什么药| hpv病毒是什么意思| 什么好像什么| 怀孕一个月吃什么对宝宝发育好| 老年人头晕是什么原因| 蓝色妖姬代表什么含义| 莲花代表什么生肖| 吃什么能长头发| 月经期间适合做什么运动| 大致正常心电图是什么意思| 已归档是什么意思| 雪莲菌泡牛奶有什么功效| sharp是什么牌子| 吃什么排出全身毒素| 舅舅的孙子叫我什么| 孟子名什么| 香茅是什么| 医保乙类是什么意思| 人流是什么意思| 狗消化不良吃什么药| 吃什么水果可以美白| 茶毫是什么| 人民币用什么材料做的| 怀孕1个月有什么症状| 有什么症状是肯定没怀孕| 一什么石头| 彩棉是什么面料| 月经结束一周后又出血是什么原因| 什么的雷锋| 生鱼是什么鱼| 天高地厚是什么生肖| 什么欲滴| 处女座跟什么星座最配| 看睾丸去医院挂什么科| 八月13号是什么星座| eps是什么意思| 须尽欢什么意思| h是什么元素| 麦芒是什么| 夜郎自大是什么意思| 心衰吃什么药好| 畈是什么意思| 什么是尿蛋白| ol是什么意思| 高密度脂蛋白胆固醇偏低是什么原因| 七月二十四是什么星座| 春天都开什么花| 衣原体感染是什么病| 亚米是什么意思| 四妙丸有什么功效与作用| ucs是什么意思| 穿山甲到底说了什么| 吃什么养肝护肝最好| 戊土是什么土| 晚上尿床是什么原因| 脂肪肝是什么原因造成的| 中央委员什么级别| 夏天喝什么汤最好| 什么李子品种最好吃| 舌苔有裂纹是什么原因| 麒字五行属什么| 心什么胆什么| 小时的单位是什么| 妊娠反应什么时候开始| 孕妇晚上饿了吃什么好| 狗狗尾巴下垂代表什么| 糖尿病能吃什么主食| 温水煮青蛙是什么意思| 血管紧张素是什么意思| 鱼油对身体有什么好处| 密送是什么意思| 吃什么药| 夜宵吃什么不会胖| 婴儿长牙有什么症状| 留意是什么意思| 84年属什么生肖| roa是什么意思| 爱叶有什么作用和功效| 菠萝与凤梨有什么区别| 沙棘什么味道| 缺镁吃什么食物补充最快| 机电一体化学什么| 柠檬配什么泡水喝最好| 放屁是热的是什么原因| 水解奶粉是什么意思| 什么止痛药效果最好| 热敷肚子有什么好处| 眼睛做激光手术有什么后遗症| 入伏天是什么意思| 血粘稠吃什么药最好| 姨妈期可以做什么运动| 舌头中间疼是什么原因| 吃什么润肺| 时来运转是什么意思| 煎服是什么意思| 老古董是什么意思| 唐氏综合征是什么病| 吃饱就犯困是什么原因| 扶他林是什么药| 小孩子发烧是什么原因引起的| diy什么意思| 爸爸的姐姐的儿子叫什么| 后背麻木是什么原因| beaf什么意思| 螺蛳吃什么| 用什么方法治牙疼| 洁面膏和洗面奶有什么区别| 大姨妈来了吃什么好| 乳腺病人吃什么好| 怀孕前三个月要注意什么| 口腔溃疡用什么药| 肩周炎是什么引起的| 破溃是什么意思| 今年22岁属什么| ev71是什么疫苗| 北京大学校长什么级别| 脸发黄是什么原因| 脸颊两边长斑是什么原因| 喝什么茶降血糖| 三级士官是什么级别| 西加一横读什么| 为什么会扁桃体发炎| 肿标五项查的是什么| 愤青什么意思| 胸口长痘是什么原因| 小麦秸秆是什么材质| 静脉曲张挂什么号| 白头发吃什么好| 伯邑考为什么不姓姬| 皮囊炎用什么药膏| 显怀是什么意思| 脑瘤有什么症状| 结肠炎吃什么药效果最好| 弥漫性肝病是什么意思| 肺部疼痛是什么原因| 灶王爷叫什么名字| 心肌酶高有什么症状| 办离婚需要什么手续和证件| 今天突然拉稀拉出血什么原因| 肺不好吃什么| 性冷淡吃什么药最好| 什么样的人长寿| 胆囊炎是什么| 子夜是指什么时间| 破绽是什么意思| 东南角风水代表什么| 百度
DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Attention Kubernetes users! DZone is researching how K8s usage is evolving in 2025 — tell us the good, the bad, + the frustrating.

Getting Started With DevSecOps: This Refcard provides actionable insights for embedding security into your DevOps culture and workflows.

Data Engineering: Not your average "AI is changing everything" report. Dive into tooling, strategy, + systems in scalable data ecosystems.

Java Caching: This Refcard explores core caching concepts and demonstrates how to implement them using Java’s JCache API.

Related

  • Microservices With JHipster
  • The Principles of Planning and Implementing Microservices
  • A Comparison of Current Kubernetes Distributions
  • Service Discovery From Within the Kubernetes Cluster

Trending

  • Enforcing Architecture With ArchUnit in Java
  • Create Your Own Custom LLM: Essential Steps and Techniques
  • Modern Data Projects Need Agile Thinking — Not Just Tech
  • How to Create Loki Alerts via PrometheusRule Resource
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. Service Discovery for NGINX Plus with ZooKeeper

内部审计

Learn how to use services registered with Apache Zookeeper to issue API calls correctly.

By 
Patrick Nommensen user avatar
Patrick Nommensen
·
Kunal Pariani user avatar
Kunal Pariani
·
Apr. 28, 16 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
5.6K Views
百度 由此可见,旅行社设置低价旅游产品,也违反了法规,该惩戒的是旅行社,而非贪便宜的游客。

Join the DZone community and get the full member experience.

Join For Free

Our previous blog posts about service discovery with Consul and etcd discussed the importance of service discovery in distributed systems, including service-oriented and microservices architectures. In such systems it’s common to assign network locations to service instances dynamically, because their locations can change over time due to autoscaling, failures, or upgrades. To track the current network location of a service instance, clients need a sophisticated service discovery mechanism.

In this blog, we’ll explain how to dynamically add or remove load-balanced servers that are registered with Apache ZooKeeperTM, a tool used for service discovery, in combination with NGINX Plus ’on-the-fly reconfiguration API. With this solution you can automate service discovery and change the set of load-balanced servers without having to reload the NGINX Plus configuration.

Apache ZooKeeper is a software project of the Apache Software Foundation that provides an open source distributed configuration service, synchronization service, and naming registry for large distributed systems. ZooKeeper nodes – or Znodes, as they are popularly called – store their data in a hierarchical name space, much like a file system or a tree data structure. All clients can read from and write to the nodes, making ZooKeeper a shared configuration service.

To make it easier to combine the on-the-fly reconfiguration API with ZooKeeper, we’ve created a samplezookeeper-demo, with step-by-step instructions for creating the configuration described in this blog post. In this post, we will walk you through the proof of concept. Using tools like Docker,Docker Compose, and Homebrew, you can spin up a Docker-based environment in which NGINX Plus load balances HTTP traffic to a couple of hello-world applications, with all components running in separate Docker containers.

How the Demo Works

First we spin up a separate Docker container for each of the following apps:

  • ZooKeeper – Performs service discovery.
  • Registrator – Registers services with ZooKeeper. Registrator monitors the starting and stopping of containers and updates ZooKeeper about the state changes.
  • hello – Simulates a backend server. This is another project from NGINX, Inc., an NGINX web server that serves an HTML page containing the web server’s hostname, IP address, and port.
  • A second instance of the hello app – Simulates another backend server.
  • NGINX Plus – Load balances the above services.

The NGINX Plus container listens on the public port 80, and the built-in NGINX Plus dashboard on port 8080. The ZooKeeper container listens on ports 2181, 2888, and 3888.

Registrator monitors Docker for new containers that are launched with exposed ports, and registers the associated services with ZooKeeper. By setting environment variables within the containers, we can be more explicit about how to register the services with ZooKeeper. For each hello-world container, we set the SERVICE_TAGS environment variable to production to identify the container as an upstream server for NGINX Plus to load balance. When a container quits or is removed, Registrator removes its corresponding Znode entry from ZooKeeper automatically.

Finally, with a tool written in Ruby and included in the sample demo, zk-tool, we use ZooKeeper watchesto trigger an external handler (script.sh) every time there is a change in the list of registered service containers. This bash script gets the list of all current NGINX Plus upstream servers, uses zk-tool to loop through all the containers registered with ZooKeeper that are tagged production, and uses the on-the-fly reconfiguration (upstream_conf) API to add them to the NGINX Plus upstream group if they’re not listed already. It also then removes from the NGINX Plus upstream group any production-tagged containers that are not registered with ZooKeeper.

Summary

Using a script like the one in our demo to dynamically reconfigure upstream groups based on the services registered with ZooKeeper automates upstream reconfiguration in NGINX Plus. This automation also frees you from having to figure out how to issue the API calls correctly and reduces the amount of time between the state change of a service in ZooKeeper and its addition or removal within the upstream group in NGINX Plus.

Check out our other blogs about for server discovery for NGINX Plus:

  • Service Discovery for NGINX Plus with Consul
  • Service Discovery for NGINX Plus with etcd
Web Service microservice Service discovery Plus (programming language) Discovery (law) Docker (software)

Published at DZone with permission of Patrick Nommensen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Microservices With JHipster
  • The Principles of Planning and Implementing Microservices
  • A Comparison of Current Kubernetes Distributions
  • Service Discovery From Within the Kubernetes Cluster

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

眼珠子疼是什么原因 吴亦凡为什么叫牛 厚黑学讲的是什么 属兔的守护神是什么菩萨 摸头是什么意思
老是拉肚子是什么原因 碎片是什么意思 NG是什么 肚脐下四指是什么位置 耄耋读什么
翳是什么意思 欲钱知吃月饼是什么生肖 为什么总是长口腔溃疡 双肺间质性改变是什么意思 堤防是什么意思
血脂高什么东西不能吃 改朝换代是什么意思 穿堂风是什么意思 胎盘下缘达宫颈内口是什么意思 小日子是什么意思
轭是什么意思hcv9jop2ns2r.cn 梦见死人和棺材预示着什么hcv8jop5ns0r.cn 1947年属什么hcv8jop5ns5r.cn c02是什么意思hcv7jop7ns2r.cn 天津副市长什么级别hcv9jop8ns3r.cn
眼睛干痒用什么眼药水hcv9jop3ns1r.cn 为什么新生儿会有黄疸hcv8jop4ns7r.cn 绿色大便是什么原因520myf.com 瓜子脸适合剪什么刘海hcv8jop3ns4r.cn 腿抽筋是什么原因hcv7jop5ns6r.cn
甲功五项是什么意思hcv8jop0ns6r.cn 忧郁是什么意思hcv8jop0ns0r.cn 狗狗窝咳吃什么药最好hcv8jop6ns7r.cn 什么而去的四字词语hcv8jop1ns6r.cn 富士山什么时候喷发hcv9jop8ns2r.cn
脑袋疼是什么原因liaochangning.com 喝柠檬水有什么好处hcv8jop2ns9r.cn ooc是什么意思hcv8jop4ns5r.cn 脾大是什么原因造成的怎么治疗huizhijixie.com 软饮料是指什么hcv7jop6ns9r.cn
百度