如何从Hyperledger Fabric 1.0/1.0.x版本升级至1.1版本?
Alright, let's walk through how to upgrade your Hyperledger Fabric 1.0.x deployment to 1.1 properly—this process needs to be done carefully to avoid downtime or data inconsistencies. I’ve helped a few teams work through this, so here’s a step-by-step breakdown that’s proven reliable.
Before touching any nodes, get your safety nets and resources ready:
- Backup everything: Copy all node data directories (like
/var/hyperledger/productionfor peers,/var/hyperledger/production/ordererfor orderers) and configuration files (core.yaml, orderer.yaml, crypto materials, channel configs). If something goes sideways, you’ll thank yourself for this. - Patch up 1.0.x first: Make sure all your 1.0.x nodes are running the latest patch release (e.g., 1.0.9). This fixes known bugs that could cause issues during the cross-version upgrade.
- Grab 1.1 resources: Download the 1.1 binaries (peer, orderer, configtxlator) and pull the corresponding Docker images on every node:
# Pull core images docker pull hyperledger/fabric-peer:1.1.0 docker pull hyperledger/fabric-orderer:1.1.0 docker pull hyperledger/fabric-tools:1.1.0 # Add CA/ccenv if you use them docker pull hyperledger/fabric-ca:1.1.0 docker pull hyperledger/fabric-ccenv:1.1.0 - Review configs: Check your
configtx.yaml—1.1 adds new features like private data collections, but you can hold off on enabling them until after the upgrade is confirmed stable. Keep existing consensus (solo/kafka) and network configs intact for now.
Orderers are the network’s core, so upgrade them one at a time to avoid cluster downtime:
- For each orderer node:
- Stop and remove the old container:
docker stop orderer.example.com docker rm orderer.example.com - Launch the 1.1 orderer, reusing your existing data and config mounts (your 1.0.x
orderer.yamlis fully compatible with 1.1):docker run -d \ --name orderer.example.com \ -v /var/hyperledger/production/orderer:/var/hyperledger/production/orderer \ -v $(pwd)/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/msp \ -v $(pwd)/config:/var/hyperledger/config \ -p 7050:7050 \ hyperledger/fabric-orderer:1.1.0 \ orderer - Verify it’s running properly by checking logs:
Look for messages confirming it’s connected to peers and syncing blocks with other orderers.docker logs -f orderer.example.com
- Stop and remove the old container:
- Wait until all orderers are upgraded and the cluster is stable before moving to peers.
Upgrade peers one at a time (or one per organization at a time) to keep your network operational during the process:
- For each peer node:
- Stop and remove the old container:
docker stop peer0.org1.example.com docker rm peer0.org1.example.com - Launch the 1.1 peer, reusing your existing data and configs (1.0.x
core.yamlworks with 1.1):docker run -d \ --name peer0.org1.example.com \ -v /var/hyperledger/production:/var/hyperledger/production \ -v $(pwd)/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/var/hyperledger/msp \ -v $(pwd)/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/var/hyperledger/tls \ -v $(pwd)/config:/var/hyperledger/config \ -p 7051:7051 -p 7052:7052 -p 7053:7053 \ hyperledger/fabric-peer:1.1.0 \ peer node start - Check logs to confirm the peer joins the channel, syncs blocks, and connects to orderers:
docker logs -f peer0.org1.example.com
- Stop and remove the old container:
- After upgrading one peer, test chaincode queries and transactions to ensure everything works before moving to the next.
If you want to use 1.1 features like private data, you’ll need to upgrade your chaincode:
- Package the chaincode with the 1.1
peertool:peer chaincode package -n mycc -v 1.1 -p github.com/chaincode/mycc/ - Install the new package on all peers:
peer chaincode install mycc_1.1.tar.gz - Upgrade the chaincode on your channel:
peer chaincode upgrade -o orderer.example.com:7050 -C mychannel -n mycc -v 1.1 -c '{"Args":["init"]}'
- Note: 1.0.x chaincodes will run fine on 1.1 peers, so this is only necessary if you need new features.
Don’t forget the client side:
- Replace your local
peer,configtxlator, andcryptogenbinaries with 1.1 versions. - Upgrade your Fabric SDK (Node.js, Java, Go, etc.) to 1.1 to ensure compatibility with the new network.
Double-check everything is working as expected:
- Check peer version:
You should seepeer versionVersion: 1.1.0(or your specific 1.1 patch release). - Check orderer version:
docker exec orderer.example.com orderer version - Run end-to-end tests: Execute chaincode queries, transactions, and channel updates to confirm no functionality is broken.
- Scan all node logs for errors or warnings.
If something goes wrong during the upgrade:
- Stop the new 1.1 container immediately.
- Launch the original 1.0.x container using your backed-up data directory and configs.
- Restore the network to its pre-upgrade state and troubleshoot before trying again.
内容的提问来源于stack exchange,提问作者christo4ferris




