conusl 用作服務發現

2021-10-08 14:27:48 字數 1481 閱讀 6610

wget
建立node1,consul server

[root@local12 ~]# ./consul agent -server -bootstrap-expect=1  \

-data-dir=/tmp/consul \

-node=agent-one -bind=192.168.56.112 \

-enable-script-checks=true \ -config-dir=/etc/consul.d \

-datacenter=dc1 \

-client 0.0.0.0 -ui

# -node:節點的名稱

# -server:這個就是表示這個節點是個server

# -bootstrap-expect:這個就是表示期望提供的server節點數目,數目一達到,它就會被啟用,然後就是leader了

# -dc:指明資料中心的名字

# -client 0.0.0.0 -ui:啟動ui(為了方便後續的ui訪問)

建立node2, consul client

[root@local13 ~]# ./consul agent -data-dir=/tmp/consul \

-node=agent-two \

-bind=192.168.56.113 -enable-script-checks=true \

-config-dir=/etc/consul.d \

-client 0.0.0.0 \

-ui

加入集群

[root@local13 ~]# ./consul join 192.168.56.112

successfully joined cluster by contacting 1 nodes.

[root@local13 ~]# ./consul members

node address status type build protocol dc segment

agent-one 192.168.1.13:8301 alive server 1.2.2 2 dc1 agent-two 192.168.1.12:8301 alive client 1.2.2 2 dc1

查詢node

consul catalog nodes
查詢service

consul catalog services
查詢datacenter

consul catalog datacenters
consul 部署加上 -client 0.0.0.0 允許client鏈結server節點

服務發現 Eureka Server

如何引入eureka server 如何執行eureka server eureka server示例 enableeurekaserver public static void main string args eureka背景 flux capacitor和google group discus...

服務註冊發現

1.zookeeper功能 檔案系統 通知機制 2.分布式程式協調服務 節點擊主 配置管理 粗粒度分布式鎖 主備高可用切換 服務註冊 服務發現 3.各服務發現產品比較 最合適的產品一般最好是cp,eureka 2.0不提供更新了,eureka 1.x 仍可用,如果在幾百台集群時使用zk還行,如果上千...

服務發現 coredns

為什麼需要服務發現 在集群內需要能夠通過服務名進行服務訪問,需要乙個集群範圍內的dns服務來完成從服務名到clusterip的解析 dns服務工作原理 監控kubernetes中的service資源的變化,根據service的名稱和ip位址生成dns記錄 1.kubernetes 1.2 版本,dn...