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

餐饮网站方案实惠的网站建设公司

餐饮网站方案,实惠的网站建设公司,做网站推销话术,群晖wordpress 站点目录 一.Docker consul的介绍 1.1template模板(更新) 1.2registrator#xff08;自动发现#xff09; 1.3agent(代理) 二.consul的工作原理 三.Consul的特性 四.Consul的使用场景 五.搭建Consul的集群 5.1需求 5.2部署consul 5.3主服务器[192.168.40.20] 5.4client部署自动发现 1.3agent(代理) 二.consul的工作原理 三.Consul的特性 四.Consul的使用场景 五.搭建Consul的集群 5.1需求 5.2部署consul 5.3主服务器[192.168.40.20] 5.4client部署192.168.40.21 5.5配置template模板自动更新 六.测试访问代理服务器 七 consul 多节点  一.Docker consul的介绍 1.1template模板(更新) 先发现再更新发现的是后端节点上容器的变化registrator更新的是nginx配置文件agent 1.2registrator自动发现 是consul安插在docker容器里的眼线用于监听监控节点上容器的变化增加或减少或者宕机一旦有变化会把这些信息告诉并注册在consul server端使用回调和协程的方式所以它的延迟和资源消耗会很少consul server发生一旦发生注册列表的变化后会把注册的信息告诉agent。后端每构建出一个容器会向registrator进行注册控制consul 完成更新操作consul会触发consul template模板进行热更新  1.3agent(代理) 用来控制consul template模板用template组件去和nginx.conf来进行对接模板里全是变量用变量的方式去加载后端由注册到consul server端之后server端会把信息告诉agent,agent和template进行对接写入templatetemplate就有了镜像更新完之后会作为nginx.conf子配置文件被前端的nginx识别consul agent会控制reload之后会识别nginx.conf配置文件中的变化相当于识别后端的节点就可以在地址池中动态调整自己后端资源。 总结:核心机制consul 自动发现、自动更新为容器提供服务添加、删除、生命周期 二.consul的工作原理 数据流向1、registrator用于监控返现和注册到consul服务内2、consul服务存储reg注册的变化的容器信息然后变化信息以参数的方式传给template3、template会接收参数然后将参数改为具体的upstream的配置放入ng的子配置文件中1.conf最后nginx -s reload 三.Consul的特性 支持健康检查允许存储键值对基于Golong语言可移植性强支持ACL访问控制 四.Consul的使用场景 consul的应用场景包括服务发现服务隔离服务配置 服务发现场景中consul作为注册中心服务地址被注册到consul中以后可以使用consul提供的dns、http接口查询consul支持health check。服务隔离场景中consul支持以服务为单位设置访问策略能同时支持经典的平台和新兴的平台支持tls证书分发service-to-service加密。服务配置场景中consul提供key-value数据存储功能并且能将变动迅速地通知出去借助Consul可以实现配置共享需要读取配置的服务可以从Consul中读取到准确的配置信息。Consul可以帮助系统管理者更清晰的了解复杂系统内部的系统架构运维人员可以将Consul看成一种监控软件也可以看成一种资产资源管理系统。 五.搭建Consul的集群 建立consul服务 每个提供服务的节点上都要部署和运行Consul的agent Consul agent有两种运行模式 ServerClient Server和Client只是Consul集群层面的区分与搭建在Cluster之上的应用服务无关 5.1需求 使用 Docker 将 Consul、Consul template、Registrator 与 Nginx 组成一个值得新人且可扩展的服务架构添加或者移除服务时不需要重写任何配置也不需要重启任何服务一切都能够正常运行以实现自动化运维 5.2部署consul 主服务器192.168.40.20 Docker-ce、Compose 3、Consul、Consul-template 服务器192.168.40.21 Docker-ce、registrator 5.3主服务器[192.168.40.20] #两台节点上都安装 Docker-ce记得关闭防火墙 systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i s/SELINUX*/SELINUXdisabled/g /etc/selinux/config在主节点上部署consul mkdir /opt/consul cd /opt/consul rz consul_0.9.2_linux_amd64.zipunzip consul_0.9.2_linux_amd64.zipmv consul /usr/local/bin consul agent \ -server \ -bootstrap \ -ui \ -data-dir/var/lib/consul-data \ -bind192.168.40.20 \ -client0.0.0.0 \ -nodeconsul-server01 /var/log/consul.log consul members consul info | grep leader 查看集群server成员curl 127.0.0.1:8500/v1/status/peers集群Raf leadercurl 127.0.0.1:8500/v1/status/leader注册的所有服务curl 127.0.0.1:8500/v1/catalog/services查看nginx服务信息curl 127.0.01:8500/v1/catalog/nginx集群节点详细信息curl 127.0.0.1:8500:/v1/cata;pg/nodes 5.4client部署192.168.40.21 容器服务自动加入nginx集群 1、安装Gliderlabs/Registrator Gliderlabs/Registrator 可检查容器运行状态自动注册还可注销docker容器的服务 到服务配置中心 目前支持Consul、Etcd和SkyDNS2在192.168.40.21节点上执行以下操作docker run -d \ --nameregistrator \ --nethost \ -v /var/run/docker.sock:/tmp/docker.sock \ --restartalways \ gliderlabs/registrator:latest \ -ip192.168.40.21 \ consul://192.168.40.20:8500systemctl restart docker 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:83:80 --name test-03 -h test03 httpd docker run -itd -p:84:80 --name test-04 -h test04 httpd 真机访问http://192.168.40.20:8500 此时应该可以发现5个服务 5.5配置template模板自动更新 server192.168.40.20 Consul-Template是一个守护进程用于实时查询Consul集群信息并更新文件系统上任意数量的指定模板生成配置文件更新完成以后可以查询Consul中的服务目录Key、Key-values等。 cd consul/ vim nginx.ctmplupstream http_backend {{{range service nginx}}server {{.Address}}:{{.Port}};{{end}} }server {listen 100;server_name localhost 192.168.40.20;access_log /var/log/nginx/lic.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://http_backend;} } yum -y install gcc pcre-devel zlib-devel rz nginx-1.12.2.tar.gz tar zxvf nginx-1.12.2.tar.gz -C /opt cd /opt/nginx-1.12.2./configure --prefix/usr/local/nginxmake make install cd /usr/local/nginx/conf/ mkdir vhost mkdir /var/log/nginx/usr/local/nginx/sbin/nginxcd /opt rz consul-template_0.19.3_linux_amd64.zipunzip consul-template_0.19.3_linux_amd64.zip mv consul-template /usr/bin #将可指向文件移动到路径环境变量中便于系统识别consul-template -consul-addr 192.168.40.20:8500 -template /opt/consul/nginx.ctmpl:/usr/local/nginx/conf/vhost/hehe.conf:/usr/local/nginx/sbin/nginx -s reload --log-levelinfo 此时在192.168.40.21上操作 docker run -itd -p:85:80 --name test-05 -h test05 nginx六.测试访问代理服务器 是否可以完成代理访问轮询主服务器192.168.40.20 docker logs -f test-01 docker logs -f test-02 docker logs -f test-05 七 consul 多节点  #添加一台已有docker环境的服务器192.168.40.22加入已有的群集中consul agent \ -server \ -bootstrap \ -ui \ -data-dir/var/ib/consul-data \ -bind192.168.40.22 \ -client0.0.0.0 \ -nodeconsul-server02 \ -enable-script-checkstrue \ -datacenterdc1 \ -join 192.168.40.20 /var/log/consul.log --解释-- -enable-script-checkstrue: 设置检查服务为可用 -datacenter: 数据中心名称 -join: 加入到已有的集群中
http://www.pierceye.com/news/554231/

相关文章:

  • 江西赣州网站上海企业服务云电话
  • 洱源网站建设品牌名字大全
  • 网站建设阶段要做什么帝国cms对比WordPress
  • 盐城做企业网站多少钱网页设计个人总结800
  • 北京做兼职网站温州网站建设模板下载免费
  • 推进门户网站建设方案wordpress插件自动更新
  • 学院网站建设成效做网站需要什么功能
  • o2o手机网站建设技术网站设计师专业
  • 传媒网站建设方案wordpress开源博客系统最新版
  • 三合一网站一般多少钱浙江省和住房建设厅网站
  • 网站开发背景知识论文网页设计表格
  • 广州优秀网站建设怎么寻找国外客户资源
  • 松江新城投资建设集团有限公司网站华能电子商务平台
  • 网站建设设计制作公司微网站微商城
  • 长宁企业网站建设个人做外贸怎么做
  • 饲料 东莞网站建设免费推广app
  • 手机平台网站开发品牌网站设计首选
  • 哪些网站可以做调查赚钱图片生成软件
  • 网站空间的管理wordpress vip system
  • 新思维网站北京住房建设部网站首页
  • 温州网站制作套餐麒麟网站建设
  • 淘宝接单做网站wordpress能做企业网站吗
  • 网站建设运营公众号运营合同app网站开发书籍下载
  • 网站seo流程网站开发开账务处理
  • 婚介网站方案长沙网络公司电话
  • 自助网站搭建系统做网站接电话一般要会什么
  • 雷州网站建设公司网站建设与管理说课ppt
  • 问答类网站怎么做wordpress 调取页面缩略图
  • 做电影资源网站手机版wordpress实例配置
  • 广西网站建设方案品牌官网方案