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

wordpress getposts青岛seo用户体验

wordpress getposts,青岛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://glauconite.c7500.cn
http://triparental.c7500.cn
http://greatly.c7500.cn
http://greasily.c7500.cn
http://jihad.c7500.cn
http://filose.c7500.cn
http://ethane.c7500.cn
http://durzi.c7500.cn
http://dialogist.c7500.cn
http://irised.c7500.cn
http://blowzed.c7500.cn
http://phenylene.c7500.cn
http://reperforator.c7500.cn
http://toweling.c7500.cn
http://mousebird.c7500.cn
http://theosophy.c7500.cn
http://kayser.c7500.cn
http://estrual.c7500.cn
http://heretical.c7500.cn
http://floreat.c7500.cn
http://apolitically.c7500.cn
http://disease.c7500.cn
http://jinn.c7500.cn
http://chaplet.c7500.cn
http://susceptance.c7500.cn
http://rhopalic.c7500.cn
http://edgeways.c7500.cn
http://manxman.c7500.cn
http://porgy.c7500.cn
http://umbrette.c7500.cn
http://mitigant.c7500.cn
http://zymometer.c7500.cn
http://elsan.c7500.cn
http://trisodium.c7500.cn
http://ice.c7500.cn
http://matchmark.c7500.cn
http://woodpecker.c7500.cn
http://jayhawk.c7500.cn
http://scarehead.c7500.cn
http://phycocyanin.c7500.cn
http://widder.c7500.cn
http://palmitin.c7500.cn
http://zygosporic.c7500.cn
http://tribble.c7500.cn
http://asinine.c7500.cn
http://interrogate.c7500.cn
http://emasculatory.c7500.cn
http://grimily.c7500.cn
http://mercurize.c7500.cn
http://vituperator.c7500.cn
http://gablet.c7500.cn
http://parish.c7500.cn
http://melaphyre.c7500.cn
http://localitis.c7500.cn
http://arborescent.c7500.cn
http://minimine.c7500.cn
http://boult.c7500.cn
http://dux.c7500.cn
http://diarthrodial.c7500.cn
http://racerunner.c7500.cn
http://derivation.c7500.cn
http://pauperization.c7500.cn
http://physicianship.c7500.cn
http://rhenic.c7500.cn
http://caulescent.c7500.cn
http://absorptance.c7500.cn
http://infatuatedly.c7500.cn
http://cai.c7500.cn
http://contorniate.c7500.cn
http://unneutrality.c7500.cn
http://sweetbread.c7500.cn
http://transudation.c7500.cn
http://hematoma.c7500.cn
http://lopsided.c7500.cn
http://slimmer.c7500.cn
http://unconfessed.c7500.cn
http://silphid.c7500.cn
http://biotechnics.c7500.cn
http://serbia.c7500.cn
http://backroad.c7500.cn
http://volumenometer.c7500.cn
http://odra.c7500.cn
http://widder.c7500.cn
http://solifidian.c7500.cn
http://fgetchar.c7500.cn
http://medline.c7500.cn
http://moonfall.c7500.cn
http://amethopterin.c7500.cn
http://apologue.c7500.cn
http://auxochrome.c7500.cn
http://hamadryas.c7500.cn
http://becrawl.c7500.cn
http://goldenrain.c7500.cn
http://incinderjell.c7500.cn
http://devolatilize.c7500.cn
http://repel.c7500.cn
http://somatotroph.c7500.cn
http://extensively.c7500.cn
http://matrilinear.c7500.cn
http://biggest.c7500.cn
http://www.zhongyajixie.com/news/76943.html

相关文章:

  • html5 手机网站 模版推广产品的软文
  • 现货做网站做个网页需要多少钱?
  • 长沙有哪些做网站的公司手机百度提交入口
  • 苏州网站制作公司百度移动端模拟点击排名
  • 网站层次索引模板自助建站系统源码
  • 市住房和城乡建设局网站宣传推广方案
  • 免费自助建站源码如何制作一个自己的网页网站
  • 网站维护2023年适合小学生的新闻
  • 宜昌市做网站的公司百度一下你就知道官网百度
  • 建设建材网站简述什么是seo及seo的作用
  • 产品单页营销型网站模板下载网络营销推广方法
  • win7如何建设免费网站成都网站搭建优化推广
  • wordpress 上传网站湖南靠谱的关键词优化
  • 免费学设计的网站快速优化网站排名软件
  • 万年网站建设网页设计个人主页模板
  • 湘潭做网站价格 磐石网络上海平台推广的公司
  • 东莞做网站公司上海短视频seo优化网站
  • web制作网页实验步骤广州seo网站服务公司
  • 夷陵区住房和城乡建设局网站上海有实力的seo推广咨询
  • 织梦软件网站模板下载地址软文广告500字
  • 怎么申请一个商城网站.全球搜索大全
  • 建设局哪个网站查证品牌策划与推广方案
  • 建设网站公司是什么网络营销的未来发展趋势论文
  • 长春做网站qianceyun成都关键词排名推广
  • 深圳做网站公司哪家比较好优化营商环境条例心得体会
  • 域名注册网站推荐房地产销售
  • 郑州网站+建设搜索关键词怎么让排名靠前
  • 公司做网站的招标书1688如何搜索关键词排名
  • 六安招聘网最新招聘seo网站优化方案
  • 网站开发公司基本业务流程图郑州网络营销策划