consul

consul

作用

安装

  1. ubuntu安装:

命令行工具

    consul agent -dev                       启动代理(单独一个命令行保证服务一直启动中);
ctrl + c 关闭代理
consul members 查看集群成员
curl localhost:8500/v1/catalog/nodes 对象形式输出集群成员详细信息
sudo mkdir /etc/consul.d 创建consul配置文件夹
echo '{"service": {"name": "web", "tags": ["rails"], "port": 80}}' \
| sudo tee /etc/consul.d/web.json 输入配置信息到consul.d文件夹下的web.json文件中

consul agent -dev -config-dir=/etc/consul.d 根据配置文件启动代理


[worker@server01 ~]$ consul agent -server -bootstrap-expect 2 -data-dir /tmp/consul -bind=192.168.1.11 -node=server01

[worker@server02 ~]$ consul agent -server -bootstrap-expect 2 -data-dir /tmp/consul -bind=192.168.1.12 -node=server02
[worker@server03 ~]$ consul agent -server -bootstrap-expect 2 -data-dir /tmp/consul -bind=192.168.1.13 -node=server03
posted @ 2017-05-12 19:03  六石  阅读(326)  评论(0编辑  收藏  举报