Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The deployment of DockerShop micro-service for Advanced docker (30)

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!

Original link address: "Advanced article" docker DockerShop micro-service deployment (30)

What if I want to access through the domain name, and all three hosts have services. Source code: https://github.com/limingios/msA-docker swarm branch

Load balancing

When speaking in theory, we said that there is a load balancer for each service on each host for polling. Each host server01,server02,server03 accesses their port 8080 to build a load balancer. You can use nginx or apache. Nginx is used here. After all, nginx has been used before. It takes 20 minutes to pull and deploy, and the public network is really slow.

Pull nginxdocker pull nginx

Write a nginx configuration to mount the vi nginx.conf

Configuration file

Upstream idig88 {server 192.168.66.101 server 8080; server 192.168.66.102 server 8080; server 192.168.66.103 server 8080;} server {listen 80; server_name www.idig88.com; location / {proxy_pass http://idig88;}}

Start command

Docker run-idt-p 80:80-v `pwd` / nginx.conf:/etc/nginx/conf.d/default.conf nginx

Configure a host file that is not server01 server02 server03 on the host

Sudu vi / etc/hosts

Try logging in.

Micro-service scale-up docker service scale ms_gateway-zuul=3docker service ps ms-gateway-zuul

Upgrade a microservice docker service update ms_course-edge-service-limit-cpu 0.5docker service inspect ms_course-edge-service

It is relatively simple to summarize the general operation commands of the following nodes, but it does not explain # cancel managerdocker node demote [NODE] docker node inspect [NODE] docker node ls# to upgrade to managerdocker node promote [NODE] docker node ps [NODE] docker node rm [NODE] docker node update [OPTIONS] NODEyml file, which is very complicated. I suggest that it is more practical to look at the official documentation.

PS: there is a detailed look at the official website documents, there is a very variety of configurations, I believe it can basically meet your needs. In this way, the docker swarm is over. I believe there is an overall understanding of it. In addition, there are two tools for UI to manage docker swarm, Portainer and Shipyard. Start k8s next time!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report