Consul 入门操作

启动consul容器

ui端口8500

docker run -d -p 8500:8500 -p 8300-8302:8300-8302 -p 8600:8600 --restart=always -h node1 --name consul consul agent -server --bootstrap-expect=1 -node=node1 -rejoin -client 0.0.0.0 -advertise 192.168.1.100 -ui

docker run -d -p 8500:8500 -p 8300-8302:8300-8302 -p 8600:8600 --restart=always -h 192.168.1.100 --name consul consul agent -server --bootstrap-expect=1 -node=192.168.1.100 -rejoin -client 0.0.0.0 -advertise 192.168.1.100 -ui

consul1:

#   image: consul:latest
#   container_name: consul

restart: always

command: agent -server -client=0.0.0.0 -bootstrap-expect=1 -node=consul1

如果使用ocelot做网关进行服务发现 需要修改 -node = consul的ip地址 如 -node=192.168.1.116

docker run --name redis -p 6379:6379 -d --restart=always redis:latest redis-server --appendonly yes --requirepass "Nvsq@12345"

posted @ 2019-06-18 11:25  OpenLJW  阅读(440)  评论(0编辑  收藏  举报