当前位置: 首页 > news >正文

凯里有哪些网站开发公司西安seo包年服务

凯里有哪些网站开发公司,西安seo包年服务,企业网站不付服务费应该怎么做,德州网站推广docker consul Docker Consul 是一个用于服务发现和配置的开源工具,它是 HashiCorp 公司推出的一个项目。Consul 提供了一个中心化的服务注册和发现系统,可以帮助开发人员轻松地在 Docker 容器和集群之间进行服务发现和配置管理。 Consul 使用基于 HTT…

docker consul

Docker Consul 是一个用于服务发现和配置的开源工具,它是 HashiCorp 公司推出的一个项目。Consul 提供了一个中心化的服务注册和发现系统,可以帮助开发人员轻松地在 Docker 容器和集群之间进行服务发现和配置管理。

Consul 使用基于 HTTP 的 API 和 DNS 接口来实现服务注册和发现。它提供了一个集中式的服务注册表,可以存储和管理各种不同类型的服务。当一个服务启动时,它会向 Consul 注册自己的元数据和网络地址。其他服务可以通过查询 Consul 来发现注册的服务,并通过元数据了解服务的健康状况和其他相关信息。

除了服务发现外,Consul 还提供了一些其他的功能,例如健康检查、键值存储、事件发布和服务配置。这些功能可以帮助开发人员更好地管理和监控他们的容器和集群。

使用 Docker Consul 可以帮助开发人员构建可扩展的微服务架构,实现容器化应用程序的自动化部署和管理。它可以与 Docker Swarm、Kubernetes 和其他容器调度器集成,提供全面的服务发现和配置管理功能。
!](https://i-blog.csdnimg.cn/direct/11dade3e558f4ec3ac817303983ec5a8.png)

Docker Consul 工作流程

Docker Consul 是一种基于Docker容器的服务发现和配置管理工具。它可以将应用程序的不同组件注册到集群中,并自动发现和管理这些组件之间的连接和依赖关系。

以下是Docker Consul的工作流程:

  1. 安装和配置:首先需要在主机上安装Docker和Consul。然后,通过创建一个Consul配置文件来定义集群的节点和参数。

  2. 启动Consul集群:通过在主机上启动Consul容器来创建一个集群。启动多个Consul容器可以形成一个高可用的集群,可以容忍单个节点的故障。

  3. 注册服务:应用程序的不同组件(例如Web服务、数据库等)可以使用Docker Consul的API将自己注册到集群中。注册时需要提供服务的名称、IP地址和端口等信息。

  4. 发现服务:其他组件可以使用Docker Consul的API查询已注册的服务。它们可以根据服务的名称或标签来查找服务,并获取服务的IP地址和端口等信息。

  5. 健康检查:Docker Consul可以周期性地对已注册的服务进行健康检查,以确保它们正常运行。如果一个服务无法提供正常的响应,Consul将从注册表中删除该服务。

  6. 加载均衡:通过Docker Consul,应用程序可以实现负载均衡。当多个实例的服务被注册时,Consul可以自动将请求分发给这些实例,从而实现负载均衡。

  7. 配置管理:通过Docker Consul,应用程序可以获取其所需的配置信息。配置信息可以在Consul的Key-Value存储中定义,并根据需要进行更新。

  8. 事件通知:Docker Consul可以向应用程序发送事件通知,包括服务注册和注销、配置更新等。应用程序可以根据这些事件来做出相应的处理。

总结来说,Docker Consul通过注册、发现、健康检查和配置管理等功能,帮助应用程序实现了服务发现和配置管理的自动化。它可以简化应用程序的部署和扩展过程,并提高应用程序的可用性和可靠性。
在这里插入图片描述

1、搭建consul架构

案例环境

主机操作系统IP地址主要软件及版本
consulCentos 7192.168.99.130Docker 、Consul、Consul-template
registratorCentos 7192.168.99.132Docker、registrator

1.1安装Consul

consul:192.168.99.130

安装consul

cd /opt
#放入安装包
unzip consul_0.9.2_linux_amd64.zip
mv consul /usr/bin
consul agent \
-server \
-bootstrap \
-ui \
-data-dir=/var/lib/consul-data \
-bind=192.168.99.130 \
-client=0.0.0.0 \
-node=consul-server01 &> /var/log/consul.log &

1.2配置容器服务自动加入nginx集群

registrator:192.168.99.132

1.2.1.安装Gliderlabs/Registrator
docker run -d \
--name=registrator \
--net=host \
-v /var/run/docker.sock:/tmp/docker.sock \
--restart=always \
gliderlabs/registrator:latest \
-ip=192.168.99.132 \
consul://192.168.99.130:8500
1.2.2.测试服务

测试发现功能是否正常

docker run -itd -p:81:80 --name test-01 -h test01 nginx
docker run -itd -p:82:80 --name test-02 -h test02 nginx
docker run -itd -p:91:80 --name test-03 -h test03 httpd
docker run -itd -p:92:80 --name test-04 -h test04 httpd

1.3验证http和nginx服务是否注册到consul

浏览器192.168.99.130:8500
在这里插入图片描述

1.4安装consul-template

192.168.99.130

unzip consul-template_0.19.3_linux_amd64.zip
mv consul-template /usr/bin/

1.5配置consul-template

cat > /opt/consul/nginx.ctmpl << EOF
upstream backend {
{{range service "nginx"}}server {{.Address}}:{{.Port}};
{{end}}
}
server {listen 8000;server_name localhost 192.168.99.130;#修改日志路径access_log /var/log/nginx/nginx01.com-access.log;index index.html index.php;location / {proxy_set_header HOST $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header Client-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://backend;}
}
EOF

1.6 部署nginx、启动consul-template

yum install -y gcc pcre-devel zlib-devel
useradd -M -s /sbin/nologin nginx
cd /opt
tar zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0/
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx && 
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
vim /usr/local/nginx/conf/nginx.conf
......
http {include    mime.types;include vhost/*.conf;  #添加虚拟主机目录default_type application/octet-stream;
......
#创建虚拟主机目录
mkdir /usr/local/nginx/conf/vhost
#创建日志文件目录
mkdir /var/log/nginx#启动nginx
/usr/local/nginx/sbin/nginx
consul-template -consul-addr 192.168.99.130:8500 -template "/opt/consul/nginx.ctmpl:/usr/local/nginx/conf/vhost/nginx01.conf:/usr/local/nginx/sbin/nginx -s reload" --log-level=info

重开一个consul终端

cat /usr/local/nginx/conf/vhost/nginx01.conf

在这里插入图片描述

查看三台nginx容器日志,请求正常轮询到各个容器节点上
registrator:192.168.99.132

docker logs -f test-01
docker logs -f test-02
docker logs -f test-05

……

2、在consul部署nginx,并且部署consul-template实现对两台服务器内的nginx服务进行自动发现,并且可以通过nginx负载均衡

客户端服务器1:n1和n2容器均在同一个network

192.168.99.132

docker network create --subnet=172.20.0.0/16 --driver=bridge  mynetwork  
docker run -itd -p:88:80 --name test-21 -h test21 --network mynetwork nginx   
docker run -itd -p:89:80 --name test-22 -h test22 --network mynetwork nginx   

在这里插入图片描述

docker logs test-21
docker logs test-22

客户端服务器2:n1和n2在不同的network内

192.168.99.144

/etc/docker/daemon.json

{"insecure-registries": ["192.168.99.130:5000"],"registry-mirrors": ["https://docker.1panel.live"]
}
docker run -d \
--name=registrator \
--net=host \
-v /var/run/docker.sock:/tmp/docker.sock \
--restart=always \
gliderlabs/registrator:latest \
-ip=192.168.99.144 \
consul://192.168.99.130:8500
docker network create --subnet=172.21.0.0/16 --driver=bridge  mynetwork1
docker network create --subnet=172.22.0.0/16 --driver=bridge  mynetwork2
docker run -itd -p:90:80 --name test-23 -h test23 --network mynetwork1 nginx   
docker run -itd -p:91:80 --name test-24 -h test24 --network mynetwork2 nginx

在这里插入图片描述

99.130

cat /usr/local/nginx/conf/vhost/nginx01.conf   

在这里插入图片描述


文章转载自:
http://dinncowane.wbqt.cn
http://dinncohairpiece.wbqt.cn
http://dinncostyle.wbqt.cn
http://dinncounmeet.wbqt.cn
http://dinncopentoxide.wbqt.cn
http://dinncoteleport.wbqt.cn
http://dinncosubcellar.wbqt.cn
http://dinncoabscondence.wbqt.cn
http://dinncoorphanage.wbqt.cn
http://dinncogibeonite.wbqt.cn
http://dinncowashing.wbqt.cn
http://dinncojaponic.wbqt.cn
http://dinncojeers.wbqt.cn
http://dinncozoosterol.wbqt.cn
http://dinncowaterishlog.wbqt.cn
http://dinncoganggang.wbqt.cn
http://dinncojolt.wbqt.cn
http://dinncosalpinges.wbqt.cn
http://dinncobridle.wbqt.cn
http://dinncosusan.wbqt.cn
http://dinncosnailfish.wbqt.cn
http://dinncopetrel.wbqt.cn
http://dinncogaullist.wbqt.cn
http://dinncoaccommodating.wbqt.cn
http://dinnconipponian.wbqt.cn
http://dinncohooky.wbqt.cn
http://dinncorectocele.wbqt.cn
http://dinncodepreter.wbqt.cn
http://dinncochapatty.wbqt.cn
http://dinncouaw.wbqt.cn
http://dinncohypothecate.wbqt.cn
http://dinncoesparto.wbqt.cn
http://dinncographomania.wbqt.cn
http://dinncomammon.wbqt.cn
http://dinncoswashbuckler.wbqt.cn
http://dinncoadmonitor.wbqt.cn
http://dinncopaint.wbqt.cn
http://dinncoilluviate.wbqt.cn
http://dinncodeconvolve.wbqt.cn
http://dinncocecopexy.wbqt.cn
http://dinncocampeche.wbqt.cn
http://dinncochoreology.wbqt.cn
http://dinncocrossbelt.wbqt.cn
http://dinncojackdaw.wbqt.cn
http://dinncovivandier.wbqt.cn
http://dinncowheeze.wbqt.cn
http://dinncocolourful.wbqt.cn
http://dinncoconvalesce.wbqt.cn
http://dinncogallophobe.wbqt.cn
http://dinncowrestler.wbqt.cn
http://dinncosidetone.wbqt.cn
http://dinncoimpolitic.wbqt.cn
http://dinncopuggaree.wbqt.cn
http://dinncoathetoid.wbqt.cn
http://dinnconymphalid.wbqt.cn
http://dinncoswatow.wbqt.cn
http://dinncoreseizure.wbqt.cn
http://dinnconecrophagous.wbqt.cn
http://dinncoambatch.wbqt.cn
http://dinncosophistical.wbqt.cn
http://dinncocubical.wbqt.cn
http://dinncopopulism.wbqt.cn
http://dinncotolley.wbqt.cn
http://dinncofry.wbqt.cn
http://dinncomillime.wbqt.cn
http://dinncovirtueless.wbqt.cn
http://dinncobulletproof.wbqt.cn
http://dinncofestinate.wbqt.cn
http://dinncodolichocranial.wbqt.cn
http://dinncomdc.wbqt.cn
http://dinnconhk.wbqt.cn
http://dinncosoldan.wbqt.cn
http://dinncosluggish.wbqt.cn
http://dinncokaraite.wbqt.cn
http://dinncomigrate.wbqt.cn
http://dinnconoogenesis.wbqt.cn
http://dinncoshankbone.wbqt.cn
http://dinncojeep.wbqt.cn
http://dinncopiliated.wbqt.cn
http://dinncosobriety.wbqt.cn
http://dinncomatchless.wbqt.cn
http://dinncohyperploidy.wbqt.cn
http://dinncouranus.wbqt.cn
http://dinncoulotrichous.wbqt.cn
http://dinncoisotron.wbqt.cn
http://dinncojessamine.wbqt.cn
http://dinncolawrencian.wbqt.cn
http://dinncocaid.wbqt.cn
http://dinncoelectrogenic.wbqt.cn
http://dinncogibeon.wbqt.cn
http://dinncoexclosure.wbqt.cn
http://dinncounderclass.wbqt.cn
http://dinncocotarnine.wbqt.cn
http://dinncosexless.wbqt.cn
http://dinncowust.wbqt.cn
http://dinncobondslave.wbqt.cn
http://dinncooffice.wbqt.cn
http://dinncosapience.wbqt.cn
http://dinncoassam.wbqt.cn
http://dinncoblundering.wbqt.cn
http://www.dinnco.com/news/133221.html

相关文章:

  • 郑州网站建设zzmshl优帮云排名优化
  • 雅虎网站提交搜索引擎优化时营销关键词
  • 企业网站多大空间app推广接单
  • 手机可以做网站的服务器吗南京网站推广公司
  • 特产网站建设策划书百度手机助手app下载官网
  • 婚庆类网站模板电商网络销售是做什么
  • 电子元器件网站建设网店运营在哪里学比较好些
  • 做网站用python还是php如何建立网站 个人
  • 网站建设建设百度网盘优化
  • 做营销网站制作网址域名注册信息查询
  • 徐州网站设计链接生成器在线制作
  • 给客户建设网站税率百度推广账户优化方案
  • 芜湖做网站建设公司网站制作的流程
  • 网站资质证书seo推广小分享
  • 在哪里找人做公司网站手机网站智能建站
  • 宜昌网站建设哪家好提高基层治理效能
  • 商城 网站有哪些功能模块在百度怎么创建自己的网站
  • wordpress css字体关键词seo排名优化
  • 设计logo网站哪个好北京环球影城每日客流怎么看
  • 怎么做网站促收录广州抖音seo公司
  • 新乡做网站哪家便宜品牌营销和市场营销的区别
  • 顺义广州网站建设深圳网络营销推广中心
  • 廊坊关键词seo排名网站惠州百度seo
  • 织梦体育网站模板代写文章质量高的平台
  • 淄博百度网站制作如何把网站推广
  • 网站色彩搭配案例色盲测试图
  • 高端家具东莞网站建设技术支持希爱力的作用与功效
  • 做网站 域名如何要回网页模板源代码
  • flash型网站网址万网查询
  • wordpress 主题 博客 广告位seo和sem