zoukankan      html  css  js  c++  java
  • 二、Consul Service Mesh

    一、Consul Connect

    tips: -dev

    1.service definition

    counting.json

    {
      "service": {
        "name": "counting",
        "id": "counting-1",
        "port": 9003,
        "check": {
          "http": "http://localhost:9003/health",
          "method": "GET",
          "interval": "1s",
          "timeout": "1s"
        },
        "connect": {
          "sidecar_service": {}
        }
      }
    }
    

    dashboard.json

    {
      "service": {
        "name": "dashboard",
        "port": 9002,
        "connect": {
          "sidecar_service": {
            "proxy": {
          	  "upstreams": [{
          	    "destination_name": "counting",
          	    "local_bind_port": 5000
          	  }]
          	}
          }
        },
        "check": {
          "id": "dashboard-check",
          "http": "http://localhost:9002/health",
          "method": "GET",
          "interval": "1s",
          "timeout": "1s"
        }
      }
    }
    
    2.service register
    consul services register counting.json
    consul services register dashboard.json
    
    consul catalog services
    
    3.create intention
    consul intention create dashboard counting
    # Created: dashboard => counting(allow)
    
    4.start services
    PORT=9002 COUNTING_SERVICE_URL="http://localhost:5000" ./dashboard-service &
    PORT=9003 ./counting-service &
    
    5.start sidecar proxy
    consul connect proxy -sidecar-for counting-1 > counting-proxy.log &
    consul connect proxy -sidecar-for dashboard > dashboard-proxy.log &
    # we can visit http://localhost:5000 for counting-1 now.
    
    6.test proxy connections
    consul intention create -deny -replace dashboard counting
    consul intention create -allow -replace dashboard counting
    
    7.clean up
    consul intention delete dashboard counting
    consul services deregister counting.json
    consul services deregister dashboard.json
    
  • 相关阅读:
    JSON
    vue中跳转页面逻辑
    生命周期的几个阶段
    vue学习大纲
    Vue留言 checked框案列
    Vue内容
    linux -- iptables
    linux --- DNS
    linux --- samba
    linux --- vsftp
  • 原文地址:https://www.cnblogs.com/Ghostant/p/14635244.html
Copyright © 2011-2022 走看看