简体   繁体   中英

peer container replaced after docker swarm service update

When I use 'docker service update' on a peer container in my docker swarm, the peer get's replaced by a new one.

The new one has almost the same name eg old: peer1.org1-223d2d23d23 new: one peer1.org1-345245634ff4

It has access to all files like channel.tx, genesis.block and mychannel.block. in the peer/channel-artifacts map. But the new peer has not joined the channel and no chaincode is installed on it.

I can't join the channel or install chaincode, because for peer1.org1 it already is the case. However if I fetch the oldest channel block I can. But this gives a strange situation I think.

So my question is

How can a peer service in docker swarm still be part of the stack/swarm after an service update or downtime without it being a completely new peer container?

When you upgrade a container in Docker, Docker Swarm or Kubernetes, you are essentially replacing the container (ie there is really no concept of an in-place upgrade of the container) with another one which receives the same settings, environment, etc.

When running Docker in standalone mode and using volumes, this is fairly transparent as the new container is deployed on the same host as the prior container and therefore will mount the same volumes, etc.

It seems like you are already mounting some type of volume from shared storage / filesystem in order to access channel.tx, etc.

What you also need to do is actually make sure that you use volumes for the persistent storage used / required by the peer (and orderer, etc for that matter).

On the peer side, the two key attributes in core.yaml are:

peer.fileSystemPath - this defaults to /var/hyperledger/production and is where the ledger, installed chaincodes, etc are kept. The corresponding environment variable is CORE_PEER_FILESYSTEMPATH .

peer.mspConfigPath - where the local MSP info is stored. The corresponding environment variable is CORE_PEER_MSPCONFIGPATH .

You will want to mount those as volumes and given you are using Swarm those volumes will need to be available on a shared storage which is available on all of your Swarm hosts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM