创建CouchDB的多个docker实例时出错

时间:2018-02-15 19:42:21

标签: docker couchdb hyperledger-fabric

我一直在尝试为单个主机(node1)中的两个对等创建两个docker CouchDB实例。但是,只有一个peer和一个couchdb实例启动,而另一个则退出' n'秒。这就是我的docker-compose-node1.yml文件的样子:

peer2.example:
  container_name: peer2.example
  extends:
    file: docker-compose-peer.yml
    service: peer-base
  environment:
    - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb_peer2:5984
    - CORE_PEER_ID=peer2.example
    - CORE_PEER_ADDRESS=peer2.example:7051
    - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
    - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
  ports:
    - 7051:7051
    - 7053:7053
  volumes:
    - ./crypto-config/peerOrganizations/example/peers/peer2.example:/etc/hyperledger/peers
    - ./crypto-config/peerOrganizations/example/peers/peer2.example/msp:/etc/hyperledger/peers/msp
    - ./crypto-config/peerOrganizations/example/peers/peer2.example/tls:/etc/hyperledger/peers/tls
    - ./crypto-config/peerOrganizations/example/users:/etc/hyperledger/msp/users
  depends_on:
    - couchdb_peer2 

couchdb_peer2:
  container_name: couchdb_peer2
  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=
    #DB_URL: http://localhost:5984/member_db
  ports:
    - "5984:5984"
  network_mode: "host"

peer4.example:
  container_name: peer4.example
  extends:
    file: docker-compose-peer.yml
    service: peer-base
  environment:
    - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb_peer4:5984
    - CORE_PEER_ID=peer4
    - CORE_PEER_ADDRESS=peer4.example:7050
    - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
    - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
  ports:
    - 8051:7051
    - 8053:7053
  volumes:
    - ./crypto-config/peerOrganizations/example/peers/peer4.example:/etc/hyperledger/peers
    - ./crypto-config/peerOrganizations/example/peers/peer4.example/msp:/etc/hyperledger/peers/msp
    - ./crypto-config/peerOrganizations/example/peers/peer4.example/tls:/etc/hyperledger/peers/tls
    - ./crypto-config/peerOrganizations/example/users:/etc/hyperledger/msp/users
depends_on:
    - couchdb_peer4

couchdb_peer4:
  container_name: couchdb_peer4
  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=
    #DB_URL: http://localhost:5984/member_db
  ports:
    - "6984:5984"
  network_mode: "host"

这就是错误:

2018-02-15 19:36:11.359 UTC [couchdb] CreateSystemDatabasesIfNotExist -> ERRO 024 Error during CouchDB CreateDatabaseIfNotExist() for system dbName: _users  error: Couch DB Error:file_exists,  Status Code:412,  Reason:The database could not be created, the file already exists.
2018-02-15 19:36:11.359 UTC [couchdb] VerifyCouchConfig -> ERRO 025 Unable to connect to CouchDB,  error: Couch DB Error:file_exists,  Status Code:412,  Reason:The database could not be created, the file already exists.   Check the admin username and password.

我在/ etc / hosts文件中进行了必要的更改,docker-compose-peer.yml,crypto-config.yaml。

这是我用来启动容器的命令:

docker-compose -f docker-compose-node1.yml up -d peer4.example peer2.example

这就是docker ps命令显示的内容(删除了容器ID列):

IMAGE                        COMMAND                  CREATED             STATUS                           PORTS               NAMES
hyperledger/fabric-peer      "peer node start"        3 minutes ago       Up 3 minutes                            peer2.example
hyperledger/fabric-couchdb   "tini -- /docker-e..."   3 minutes ago       Up 3 minutes                            couchdb_peer4

我在这里缺少什么。如果您需要我发布我的docker-compose-peer.yml文件,请告诉我。谢谢

0 个答案:

没有答案