标签:实战 protocol groups service col psi user build 介绍
1、介绍
本教程使用Compose、Machine、Swarm工具把WordPress部署在OpenStack上。
本节采用Consul作为Swarm的Discovery Service模块,要利用Consul实现服务的注册与发现,需要建立Consul Cluster。在Consul方案中,每个提供服务的节点上都要部署和运行Consul的agent,所有运行Consul agent节点的集合会构成Consul Cluster。
2、创建虚拟机
使用docker-machine create命令创建6个虚拟机,其中虚拟机1用作Swarm的Master,虚拟机2用作Consul的服务发现,虚拟机3~5用作Swarm的节点。
创建lfkdockermachine6虚拟机
#docker-machine create -d openstack --openstack-insecure --openstack-auth-url=Keystone_Auth_URL --openstack-username=UserName --openstack-password=PassWord --openstack-tenant-id=TenantID --openstack-tenant-name=TenantName --openstack-flavor-id=FlavorID --openstack-image-id=ImageID --openstack-region=az0.dcl --openstack-net-id=NetID --openstack-availability-zone=az1.dc1 --openstack-sec-groups=GroupsID --openstack-floatingip-pool=external_relay_network lfkdockermachine6
Creating machine...
更多参数详见:https://docs.docker.com/machine/drivers/openstack/#options
3、查看虚拟机
#docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
lfkdockermachine openstack running tcp://100.64.0.30:2376
lfkdockermachine1 openstack running tcp://100.64.0.31:2376
lfkdockermachine2 openstack running tcp://100.64.0.32:2376
lfkdockermachine3 openstack running tcp://100.64.0.33:2376
lfkdockermachine4 openstack running tcp://100.64.0.34:2376
lfkdockermachine5 openstack running tcp://100.64.0.35:2376
通过OpenStack的nova list查看
#nova list --all_te | grep lfk | head -1
| 65ad59c7-39df-4cdc-8957-eb2e396ac8d6 | lfkdockermachine | ACTIVE | - | Running | docker-VM_network=192.168.10.90,100.64.0.30 |
4、搭建Swarm的Discovery Service模块
在lfkdockermachine2上通过consul命令搭建Consul Server节点
#consul agent -server -bootstrap-expect=1 -data-dir=data -bind=192.168.10.92 -client=192.168.10.92 &
在lfkdockermachine3、lfkdockermachine4、lfkdockermachine5上搭建Consul Client节点
#consul agent -data-dir=data -node=lfkdockermachine3 -join=192.168.10.92 -bind=192.168.10.93 -client=192.168.10.93 &
此时在日志lfkdockermachine2上可看到Consul Client节点加入了集群
consul:member ‘lfkdockermachine3‘ joined, marking health alive
将lfkdockermachine4和lfkdockermachine5也加入集群
在Consul Server节点通过members命令列出整个集群的综合信息
#consul members -rpc-addr=192.168.10.92:8400
Node Address Status Type Build Protocol
lfkdockermachine2 192.168.10.92 alive server 0.5.0 2
lfkdockermachine3 192.168.10.93 alive client 0.5.0 2
lfkdockermachine4 192.168.10.94 alive client 0.5.0 2
lfkdockermachine5 192.168.10.95 alive client 0.5.0 2
Docker(十三):OpenStack部署Docker集群实战
标签:实战 protocol groups service col psi user build 介绍
原文地址:http://www.cnblogs.com/dukuan/p/7684173.html