1.consul要素:
注册中心、配置中心、数据一致性
2.注册中心:
服务注册、服务发现、健康检查、高可用、高效率低延迟、跨数据中心
3.consul--raft库
4.serf封装八卦算法
2.consul搭建:
--集群搭建配置信息: { "id": "/cms-poc/trial-production/components/consul/v1/node1", "backoffFactor": 1.15, "backoffSeconds": 1, "cmd": "consul agent -server -data-dir /consul/data -config-dir /consul/config -advertise 172.19.32.68 -datacenter dc001 -client 0.0.0.0 -ui", "constraints": [ [ "hostname", "IS", "172.19.32.68" ] ], "container": { "portMappings": [ { "containerPort": 8300, "hostPort": 8300, "protocol": "tcp", "servicePort": 10059 }, { "containerPort": 8301, "hostPort": 8301, "protocol": "udp,tcp", "servicePort": 10060 }, { "containerPort": 8302, "hostPort": 8302, "protocol": "udp,tcp", "servicePort": 10061 }, { "containerPort": 8500, "hostPort": 8500, "labels": { "VIP_1": "/ms-consul:8500" }, "protocol": "tcp", "servicePort": 10062 }, { "containerPort": 8600, "hostPort": 8600, "protocol": "tcp", "servicePort": 10063 } ], "type": "DOCKER", "volumes": [ { "containerPath": "/consul/data", "hostPath": "/data/consul/data", "mode": "RW" }, { "containerPath": "/consul/config", "hostPath": "/data/consul/config", "mode": "RW" } ], "docker": { "image": "consul", "forcePullImage": false, "privileged": false, "parameters": [] } }, "cpus": 1, "disk": 0, "instances": 1, "maxLaunchDelaySeconds": 3600, "mem": 1024, "gpus": 0, "networks": [ { "mode": "container/bridge" } ], "requirePorts": false, "upgradeStrategy": { "maximumOverCapacity": 1, "minimumHealthCapacity": 1 }, "killSelection": "YOUNGEST_FIRST", "unreachableStrategy": { "inactiveAfterSeconds": 0, "expungeAfterSeconds": 0 }, "healthChecks": [], "fetch": [] }