2

我试图将 fabcar 网络扩展到在同一系统上运行的 2 个对等点。我遇到了一些错误。

我对 docker compose 文件进行了以下更改。

  peer1.org1.example.com:
  container_name: peer1.org1.example.com
  image: hyperledger/fabric-peer
  environment:
    - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
    - CORE_PEER_ID=peer1.org1.example.com
    - CORE_LOGGING_PEER=debug
    - CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
    - CORE_PEER_LOCALMSPID=Org1MSP
    - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
    - CORE_PEER_ADDRESS=peer1.org1.example.com:7051
    # # the following setting starts chaincode containers on the same
    # # bridge network as the peers
    # # https://docs.docker.com/compose/networking/
    - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic
    - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
    - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
    # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
    # provide the credentials for ledger to connect to CouchDB.  The username and password must
    # match the username and password set for the associated CouchDB.
    - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
    - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
  working_dir: /opt/gopath/src/github.com/hyperledger/fabric
  command: peer node start
  # command: peer node start --peer-chaincodedev=true
  ports:
    - 8051:7051
    - 8053:7053
  volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/msp/peer
      - ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
      - ./config:/etc/hyperledger/configtx
  depends_on:
    - orderer.example.com
    - couchdb1
  networks:
    - basic

couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB.  This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
  - COUCHDB_USER=
  - COUCHDB_PASSWORD=
ports:
  - 6984:5984
networks:
  - basic

在 start.sh 文件中,我添加了一行代码来将 peer 1 加入到通道中。

当我执行 ./startFabric.sh 节点时,我收到以下错误:

来自守护程序的错误响应,容器未运行。

日志如下:

CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                     PORTS                                            NAMES

b602e1898831        hyperledger/fabric-peer      "peer node start"        3 minutes ago       Exited (1) 3 minutes ago                                                    peer1.org1.example.com
780acf5be420        hyperledger/fabric-couchdb   "tini -- /docker-ent…"   3 minutes ago       Up 3 minutes               4369/tcp, 9100/tcp, 0.0.0.0:6984->5984/tcp       couchdb1

d93c8d14e07d        hyperledger/fabric-peer      "peer node start"        3 minutes ago       Up 3 minutes               0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp   peer0.org1.example.com

f8d5a07e0c14        hyperledger/fabric-couchdb   "tini -- /docker-ent…"   3 minutes ago       Up 3 minutes               4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp       couchdb

0c8be993aaad        hyperledger/fabric-orderer   "orderer"                3 minutes ago       Up 3 minutes               0.0.0.0:7050->7050/tcp                           orderer.example.com

29484423ee69        hyperledger/fabric-ca        "sh -c 'fabric-ca-se…"   3 minutes ago       Exited (1) 3 minutes ago                                                    ca.example.com

Digitals-MacBook-Air-3:fabcar digital3$ docker logs b602e1898831  
2018-06-28 08:12:18.923 UTC [main] main -> ERRO 001 **Cannot run peer because error when setting up MSP of type bccsp from directory /etc/hyperledger/msp/peer/: could not load a valid signer certificate from directory /etc/hyperledger/msp/peer/signcerts: stat /etc/hyperledger/msp/peer/signcerts: no such file or directory**

我所做的更改是:

  1. 在加密配置中:将模板计数更改为 2。
  2. 在 docker-compose 中,为 peer1 添加了另一个服务,数据库为 couchdb1。CLI 没有变化。
  3. 在 start.sh 文件中,我编写了一行代码来将 peer 1 添加到通道中。

当我在 fabcar 目录中运行 ./startFabric.sh 节点时,出现上述错误。

我在基本网络而不是第一个网络中进行编辑。

我刚刚检查了我的证书目录:它看起来如下

CRYPTOCONFIG - PeerOrganisations - Peers - peer0 , peer1

Peer0 拥有所有证书

Peer1 只有 msp 文件夹,没有 tls 文件夹。msp 文件夹只有 admincerts 和 keystore

更新

我设法为两个对等方生成证书,并成功从 fabcar 目录运行了 ./startFabric.sh 节点命令。但是,当我执行enrollAdmin 命令时,我遇到了一个问题。

错误:调用注册端点失败,并在 ClientRequest 处出现错误 [错误:连接 ECONNREFUSED 10.228.27.101:7054]。(/Users/digital3/fabric-samples/fabcar/node_modules/fabric-ca-client/lib/FabricCAClientImpl.js:883:12) 在客户端请求.emit (events.js: 211:7) 在 Socket.socketErrorListener (_http_client.js:387:9) 在 emitOne (events.js:116:13) 在 Socket.emit (events.js:211:7) 在 emitErrorNT (internal/streams/destroy. js:64:8) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) 无法注册管理员:错误:无法注册管理员

你能帮我解决这个问题吗

4

1 回答 1

0

如果您想添加额外的对等节点,您还需要生成相关的加密材料。

在 basic-network 目录下的 crypto-config.yaml 文件的第 63 行,将 Count 的值设置为 '2',例如:

# "Template"
# ---------------------------------------------------------------------------
# Allows for the definition of 1 or more hosts that are created sequentially
# from a template. By default, this looks like "peer%d" from 0 to Count-1.
# You may override the number of nodes (Count), the starting index (Start)
# or the template used to construct the name (Hostname).
#
# Note: Template and Specs are not mutually exclusive.  You may define both
# sections and the aggregate nodes will be created for you.  Take care with
# name collisions
# ---------------------------------------------------------------------------
Template:
  Count: 2
  # Start: 5
  # Hostname: {{.Prefix}}{{.Index}} # default

这将使 cryptogen 步骤为 org 的两个对等节点生成密钥材料:Org1.

于 2018-06-28T12:57:58.277 回答