1

我有两个同行和两个组织(ri,re)。当我尝试在资源管理器中显示同行时,它总是显示 1 个同行。它没有显示 2 个同行。请找到以下配置文件

{
  "name": "eni-network",
  "version": "1.0",
  "client": {
    "tlsEnable": false,
    "adminUser": "admin",
    "adminPassword": "adminpw",
    "enableAuthentication": false,
    "organization": "RmMsp",
    "channel": "samplenetwork",
    "connection": {
      "timeout": {
        "peer": {
          "endorser": "300"
        },
        "orderer": "300"
      }
    }
  },
  "channels": {
    "samplenetwork": {
      "peers": {
        "peer0.rm.ex1.com": {},
        "peer0.re.ex1.com": {}
      },
      "connection": {
        "timeout": {
          "peer": {
            "endorser": "6000",
            "eventHub": "6000",
            "eventReg": "6000"
          }
        }
      }
    }
  },
  "organizations": {
    "RmMsp": {
      "mspid": "RmMsp",
      "fullpath": true,
      "adminPrivateKey": {
        "path": "/tmp/crypto/peerOrganizations/rm.ex1.com/users/Admin@rm.ex1.com/msp/keystore/845f6a174e7880f48b2201b2d5fbb15dbc142b9521b9bb23f7e92ee83281b48c_sk"
      },
      "signedCert": {
        "path": "/tmp/crypto/peerOrganizations/rm.ex1.com/users/Admin@rm.ex1.com/msp/signcerts/Admin@rm.ex1.com-cert.pem"
      }
    },
    "ReMsp": {
      "mspid": "ReMsp",
      "fullpath": true,
      "adminPrivateKey": {
        "path": "/tmp/crypto/peerOrganizations/re.ex1.com/users/Admin@re.ex1.com/msp/keystore/dcc66298e88a958688d996786556b0fcdba74dc051d80c459e0e75a2177aad97_sk"
      },
      "signedCert": {
        "path": "/tmp/crypto/peerOrganizations/re.ex1.com/users/Admin@re.ex1.com/msp/signcerts/Admin@re.ex1.com-cert.pem"
      }
    },
    "OrdererMSP": {
      "mspid": "RmOrdererMsp",
      "adminPrivateKey": {
        "path": "/tmp/crypto/ordererOrganizations/rm.orderer/users/Admin@rm.orderer/msp/keystore/cd5770674b623f5f4a2fb218d6d778a224d9c3b464a34b8a9f38153a3542ff5f_sk"
      }
    }
  },
  "peers": {
    "peer0.rm.ex1.com": {
      "tlsCACerts": {
        "path": "/tmp/crypto/peerOrganizations/rm.ex1.com/peers/peer0.rm.ex1.com/tls/ca.crt"
      },
      "url": "grpc://peer0.rm.ex1.com:7051",
      "eventUrl": "grpc://peer0.rm.ex1.com:7053",
      "grpcOptions": {
        "ssl-target-name-override": "peer0.rm.ex1.com"
      }
    },
    "peer0.re.ex1.com": {
      "tlsCACerts": {
        "path": "/tmp/crypto/peerOrganizations/re.ex1.com/peers/peer0.re.ex1.com/tls/ca.crt"
      },
      "url": "grpc://peer0.re.ex1.com:8051",
      "eventUrl": "grpc://peer0.re.ex1.com:8053",
      "grpcOptions": {
        "ssl-target-name-override": "peer0.re.ex1.com"
      }
    }
  },
  "orderers": {
    "orderer.rm.ex1.com": {
      "url": "grpc://orderer.rm.ex1.com:7050"
    }
  }
}

单击此处获取图像参考

请参阅上图了解更多信息。

码头工人撰写文件

 explorerdb.rm.ex1.com:
    image: hyperledger/explorer-db:latest
    container_name: explorerdb.rm.ex1.com
    environment:
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWORD=password
    volumes:
      - ./createdb.sh:/docker-entrypoint-initdb.d/createdb.sh
      - pgdata:/var/lib/postgresql/data

  explorer.rm.ex1.com:
    image: hyperledger/explorer:latest
    container_name: explorer.rm.ex1.com
    environment:
      - DATABASE_HOST=explorerdb.rm.ex1.com
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWD=password
      - DISCOVERY_AS_LOCALHOST=false
    volumes:
      - ./scripts/config.json:/opt/explorer/app/platform/fabric/config.json
      - ./scripts/connection-profile:/opt/explorer/app/platform/fabric/connection-profile
      - ./crypto-config:/tmp/crypto
      - walletstore:/opt/wallet
    command: sh -c "sleep 16&& node /opt/explorer/main.js && tail -f /dev/null"
    ports:
      - 8090:8080

peer0.rm.ex1.com:
    container_name: peer0.rm.ex1.com
    extends:
      file: /opt/shared/docker-compose-base.yaml
      service: peer
    environment:
      - CORE_PEER_ID=peer0.rm.ex1.com
      - CORE_PEER_ADDRESS=peer0.rm.ex1.com:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.rm.ex1.com:7051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.re.ex1.com:8051
      - CORE_PEER_LOCALMSPID=RmMsp
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couch.peer0.rm.ex1.com:5984
    volumes:
      - /opt/rm/creds/peers/peer0.rm.ex1.com/msp:/etc/hyperledger/fabric/msp
      - /opt/rm/creds/peers/peer0.rm.ex1.com/tls:/etc/hyperledger/fabric/tls
          - peer0.rm.ex1.com:/var/hyperledger/production
ports:
      - 7051:7051

peer0.re.ex1.com:
    container_name: peer0.re.ex1.com
    extends:
      file: /opt/shared/docker-compose-base.yaml
      service: peer
    environment:
      - CORE_PEER_ID=peer0.re.ex1.com
      - CORE_PEER_ADDRESS=peer0.re.ex1.com:8051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.re.ex1.com:8051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.rm.ex1.com:7051
      - CORE_PEER_LOCALMSPID=ReMsp
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couch.peer0.re.ex1.com:5984
    volumes:
      - /opt/re/creds/peers/peer0.re.ex1.com/msp:/etc/hyperledger/fabric/msp
      - /opt/re/creds/peers/peer0.re.ex1.com/tls:/etc/hyperledger/fabric/tls
          - peer0.re.ex1.com:/var/hyperledger/production
ports:
      - 8051:8051

它必须显示两个同行:1)peer0.ri.ex1.com 2)peer0.re.ex1.com

但它只显示:peer0.ri.ex1.com。

任何线索将不胜感激!

码头工人ps

我检查了资源管理器日志文件..第二个组织(ReMsp)是空的。请找到以下参考

 orderers: { RmOrdererMsp: { endpoints: [Array] } }, 
peers_by_org: { RmMsp: { peers: [Array] }, ReMsp: { peers: [] } } }. 

它看起来像 config.json 问题。任何线索将不胜感激。

4

2 回答 2

1

如果您在 peer 部分实现了GOSSIP 协议,请检查 docker-compose 文件。以供参考 -

peer0.org3.bc4scm.de:
    container_name: peer0.org3.bc4scm.de
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer0.org3.bc4scm.de
      - CORE_PEER_ADDRESS=peer0.org3.bc4scm.de:11051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:11051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org3.bc4scm.de:11052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.bc4scm.de:11051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org3.bc4scm.de:12051
      - CORE_PEER_LOCALMSPID=Org3MSP
    volumes:
      - /var/run/:/host/var/run/
      - ../crypto-config/peerOrganizations/org3.bc4scm.de/peers/peer0.org3.bc4scm.de/msp:/etc/hyperledger/fabric/msp
      - ../crypto-config/peerOrganizations/org3.bc4scm.de/peers/peer0.org3.bc4scm.de/tls:/etc/hyperledger/fabric/tls
      - peer0.org3.bc4scm.de:/var/hyperledger/production
    ports:
      - 11051:11051

peer1.org3.bc4scm.de:
    container_name: peer1.org3.bc4scm.de
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer1.org3.bc4scm.de
      - CORE_PEER_ADDRESS=peer1.org3.bc4scm.de:12051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:12051
      - CORE_PEER_CHAINCODEADDRESS=peer1.org3.bc4scm.de:12052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:12052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org3.bc4scm.de:12051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.bc4scm.de:11051
      - CORE_PEER_LOCALMSPID=Org3MSP
    volumes:
      - /var/run/:/host/var/run/
      - ../crypto-config/peerOrganizations/org3.bc4scm.de/peers/peer1.org3.bc4scm.de/msp:/etc/hyperledger/fabric/msp
      - ../crypto-config/peerOrganizations/supplier.bc4scm.de/peers/peer1.org3.bc4scm.de/tls:/etc/hyperledger/fabric/tls
      - peer1.org3.bc4scm.de:/var/hyperledger/production
    ports:
    - 12051:12051

例如,您可以查看上述同行 -

peer0.org3.bc4scm.de : - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.bc4scm.de:11051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org3.bc4scm.de:12051

peer1.org3.bc4scm.de :

- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org3.bc4scm.de:12051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.bc4scm.de:11051

@相应地更改您的文件您的网络。

更新 -

peer0.rm.ex1.com:
    - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.re.ex1.com:8051

peer0.re.ex1.com:
    - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.rm.ex1.com:7051
于 2019-07-17T01:16:10.170 回答
0

您需要进行以下更改:

  • 您还需要将 CORE_PEER_LISTENADDRESS 添加到两个对等点,因为您更改了默认侦听端口 (7051)。

    peer0.rm.ex1.com: CORE_PEER_LISTENADDRESS=0.0.0.0:7051

    peer0.re.ex1.com: CORE_PEER_LISTENADDRESS=0.0.0.0:8051

  • CORE_PEER_GOSSIP_BOOTSTRAP 不能在其他组织上指定对等点(请参阅此处详细说明)。除了它自己的 URL,您没有任何选择。

    peer0.rm.ex1.com: CORE_PEER_GOSSIP_BOOTSTRAP=peer0.rm.ex1.com:7051

    peer0.re.ex1.com: CORE_PEER_GOSSIP_BOOTSTRAP=peer0.re.ex1.com:8051

  • FWIW,只要看你的环境,你不需要区分每个对等节点的端口号(你不需要更改默认端口号(7051)。你只需要在从外部访问对等节点时唯一docker 环境,通过区分 docker-compose 端口映射)。

于 2019-07-31T08:20:01.943 回答