fabric config文件
时间: 2023-10-21 14:15:22 浏览: 156
Fabric配置文件是一个YAML文件,它定义了Fabric网络中的各种配置参数。以下是一个Fabric配置文件的示例:
```yaml
version: '2'
networks:
mynetwork:
external:
name: mynetwork
services:
orderer.example.com:
image: hyperledger/fabric-orderer
container_name: orderer.example.com
command: orderer
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp
volumes:
- ./config/:/etc/hyperledger/configtx
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/msp/orderer
ports:
- 7050:7050
networks:
- mynetwork
peer0.org1.example.com:
image: hyperledger/fabric-peer
container_name: peer0.org1.example.com
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=debug
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_NETWORKID=mynetwork
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
ports:
- 7051:7051
depends_on:
- orderer.example.com
networks:
- mynetwork
```
在上面的示例中,配置文件定义了一个Fabric网络,包括一个Orderer节点和一个Peer节点。Orderer节点使用`hyperledger/fabric-orderer`镜像,Peer节点使用`hyperledger/fabric-peer`镜像。配置文件还定义了节点的环境变量,卷和端口映射等。最后,节点被分配到mynetwork网络中。
阅读全文