如何为Hyperledger Composer将服务名称解析为docker swarm模式?

时间:2018-08-09 09:35:33

标签: docker docker-swarm hyperledger-composer

我正在使用docker swarm模式进行Hyperledger作曲器设置,而我是docker的新手。我的布料运行正常。当我在connection.json文件中使用服务名称时,在安装网络时会导致“ REQUEST_TIMEOUT”。但是,当我使用主机的IP地址而不是服务名称时,一切正常。那么,如何解析服务名称/容器名称?

这是我的对等配置:

peer1:
deploy:
  replicas: 1
  restart_policy:
    condition: on-failure
    delay: 5s
    max_attempts: 3
hostname: peer1.eprocure.org.com
image: hyperledger/fabric-peer:$ARCH-1.1.0
networks:
  hyperledger-ov:
    aliases:
      - peer1.eprocure.org.com
environment:
  - CORE_LOGGING_LEVEL=debug
  - CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
  - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
  - CORE_PEER_ID=peer1.eprocure.org.com
  - CORE_PEER_ADDRESS=peer1.eprocure.org.com:7051
  - CORE_PEER_LOCALMSPID=eProcureMSP
  - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/peer/msp
  - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
  - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
  - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyperledger-ov

  - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.eprocure.org.com:7051
  - CORE_PEER_ENDORSER_ENABLED=true
  - CORE_PEER_GOSSIP_USELEADERELECTION=true
  - CORE_PEER_GOSSIP_ORGLEADER=false
  - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
  - CORE_PEER_PROFILE_ENABLED=true

working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: peer node start
volumes:
    - /var/run/:/host/var/run/
    - /export/composer/genesis-folder:/etc/hyperledger/configtx
    - /export/composer/crypto-config/peerOrganizations/eprocure.org.com/peers/peer1.eprocure.org.com/msp:/etc/hyperledger/peer/msp
    - /export/composer/crypto-config/peerOrganizations/eprocure.org.com/users:/etc/hyperledger/msp/users
ports:
  - 8051:7051
  - 8053:7053

这是我当前使用IP的connection.json

"peers": {
    "peer0.eprocure.org.com": {
        "url": "grpc://192.168.0.147:7051",
        "eventUrl": "grpc://192.168.0.147:7053"
    },
    "peer1.eprocure.org.com": {
        "url": "grpc://192.168.0.147:8051",
        "eventUrl": "grpc://192.168.0.147:8053"
    },
    "peer2.eprocure.org.com": {
        "url": "grpc://192.168.0.147:9051",
        "eventUrl": "grpc://192.168.0.147:9053"
    }
},

我以前尝试过跟踪。

"peers": {
    "peer0.eprocure.org.com": {
        "url": "grpc://peers_peer0:7051",
        "eventUrl": "grpc://peers_peer0:7053"
    },
    "peer1.eprocure.org.com": {
        "url": "grpc://peers_peer1:8051",
        "eventUrl": "grpc://peers_peer2:8053"
    },
    "peer2.eprocure.org.com": {
        "url": "grpc://peers_peer2:9051",
        "eventUrl": "grpc://peers_peer2:9053"
    }
}

但这不起作用。 谁能告诉我如何解决我的问题?

0 个答案:

没有答案