91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

『高級篇』docker之DockerSwarm調整微服務及服務配置(29)

發布時間:2020-07-20 04:02:44 來源:網絡 閱讀:177 作者:IT人故事 欄目:云計算

原創文章,歡迎轉載。轉載請注明:轉載自IT人故事會,謝謝!
原文鏈接地址:『高級篇』docker之DockerSwarm調整微服務及服務配置(29)

上次已經搭建好了swarm的集群環境,server01,server02,server03三臺虛擬機,每一臺的manager節點也是work節點,首先我們考慮的問題是服務的發現,從微服務的角度考慮,我們有得服務是為了其他服務使用的,如message service,user service,對于swarm上,有的需要暴露端口給其他服務使用,有的是直接通過服務的名稱就可以訪問的,改造模式,改造代碼,然后上傳到鏡像倉庫。最后配置一個docker stack 把他們的關系編寫出來,一條命令搞定了。源碼:https://github.com/limingios/msA-docker swarm分支

修改微服務的配置

  • course-dubbo-service

sh


#!/usr/bin/env bash

source ~/.bash_profile
mvn package
docker build -f ./Dockerfile-hub -t zhugeaming/course-dubbo-service:latest .
docker push zhugeaming/course-dubbo-service:latest


>Dockerfile
``` bash
FROM java:openjdk-8
MAINTAINER liming www.idig8.com

COPY target/course-dubbo-service-1.0-SNAPSHOT.jar /course-dubbo-service.jar

ENTRYPOINT ["java","-jar","/course-dubbo-service.jar"]
  • course-edge-service

sh


#!/usr/bin/env bash

source ~/.bash_profile
mvn package
docker build -f ./Dockerfile-hub -t zhugeaming/course-edge-service:latest .
docker push zhugeaming/course-edge-service:latest


>Dockerfile
``` bash
FROM java:openjdk-8
MAINTAINER liming www.idig8.com

COPY target/course-edge-service-1.0-SNAPSHOT.jar /course-edge-service.jar

ENTRYPOINT ["java","-jar","/course-edge-service.jar"]
  • gataway-zuul

    sh

    
    #!/usr/bin/env bash

source ~/.bash_profile
mvn package
docker build -f ./Dockerfile-hub -t zhugeaming/gataway-zuul:latest .
docker push zhugeaming/gataway-zuul:latest


>Dockfile
``` bash
FROM java:openjdk-8
MAINTAINER liming www.idig8.com

COPY target/gataway-zuul-1.0-SNAPSHOT.jar /gataway-zuul.jar

ENTRYPOINT ["java","-jar","/gataway-zuul.jar"]
  • user-edge-service

    sh

    #!/usr/bin/env bash
    source ~/.bash_profile
    mvn package
    docker build -f ./Dockerfile-hub -t zhugeaming/user-edge-service:latest .
    docker push zhugeaming/user-edge-service:latest

Dockerfile

#!/usr/bin/env bash
source ~/.bash_profile
mvn package
docker build -f ./Dockerfile-hub -t zhugeaming/user-edge-service:latest .
docker push zhugeaming/user-edge-service:latest
  • user-thrift-service

    sh

    #!/usr/bin/env bash
    source ~/.bash_profile
    mvn package
    docker build -f ./Dockerfile-hub -t zhugeaming/user-thrift-service:latest .
    docker push zhugeaming/user-thrift-service:latest

    Dockerfile

    
    FROM java:openjdk-8
    MAINTAINER liming www.idig8.com

COPY target/user-thrift-service-1.0-SNAPSHOT.jar /user-thrift-service.jar

ENTRYPOINT ["java","-jar","/user-thrift-service.jar"]


* 編寫yml文件 使用docker stack 進行批量生成

``` yml
version: "3.4"
services:
  message-thrift-python-service:
    image: zhugeaming/message-thrift-python-service:latest
    deploy:
      endpoint_mode: dnsrr
      resources:
        limits:
          cpus: "0.2"
          memory: "128M"

  user-thrift-service:
    image: zhugeaming/user-thrift-service:latest
    deploy:
      endpoint_mode: dnsrr
      resources:
        limits:
          cpus: "0.2"
          memory: "512M"

  user-edge-service:
    image: zhugeaming/user-edge-service:latest
    deploy:
      endpoint_mode: vip
      resources:
        limits:
          cpus: "0.2"
          memory: "512M"
    ports:
    - "8082:8082"
    depends_on:
    - user-thrift-service
    - message-thrift-python-service

  course-dubbo-service:
    image: zhugeaming/user-edge-service:latest
    deploy:
      endpoint_mode: dnsrr
      resources:
        limits:
          cpus: "0.2"
          memory: "512M"
    depends_on:
    - user-thrift-service

  course-edge-service:
    image: zhugeaming/course-edge-service:latest
    deploy:
      endpoint_mode: vip
      resources:
        limits:
          cpus: "0.2"
          memory: "512M"
    ports:
    - "8081:8081"
    depends_on:
    - user-edge-service
  gateway-zuul:
    image: zhugeaming/gataway-zuul:latest
    deploy:
      endpoint_mode: vip
      resources:
        limits:
          cpus: "0.2"
          memory: "512M"
    ports:
    - "8080:8080"
    depends_on:
    - user-edge-service
    - course-edge-service

networks:
  default:
    external:
      name: idig8-overlay

『高級篇』docker之DockerSwarm調整微服務及服務配置(29)

docker stack 創建,因為機器內存太小,我還是使用的外網,下載鏡像有點慢。

docker stack deploy -c ms-service.yml ms
docker stack services ms 

『高級篇』docker之DockerSwarm調整微服務及服務配置(29)

『高級篇』docker之DockerSwarm調整微服務及服務配置(29)

PS:創建成功,下一步就是調試微服務。

『高級篇』docker之DockerSwarm調整微服務及服務配置(29)

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

东丰县| 新乡市| 台北市| 惠东县| 缙云县| 全椒县| 兴化市| 方正县| 鄂伦春自治旗| 二手房| 水富县| 富裕县| 红原县| 深州市| 汶上县| 柞水县| 尚义县| 龙岩市| 全南县| 海丰县| 改则县| 陕西省| 滦南县| 清苑县| 乐东| 米泉市| 萨迦县| 蒲江县| 苍山县| 宣城市| 台安县| 房产| 拉孜县| 霍山县| 循化| 司法| 开平市| 大厂| 赤壁市| 黄骅市| 嵊州市|