- How can we replicate changes in a file to entire IPFS cluster.
- All nodes in the cluster can modify/update the file content and this information should get synced in entire cluster network and every peer should have a copy of latest version .
Puting the replication equal to the number of nodes should do the trick. The deduplication should take care of only transfering files that changed.
Right !
But when i change the content of a file , let say “myFile.log” , then new hash(CID) is created and adding it to network replicate it across the ipfs cluster.
how can other peers know this new CID belongs to change for myFile.log and its the most recent one ?
You need to add the new file to IPFS and pin the new cid in cluster, preferably with:
ipfs-cluster-ctl pin update <new_cid>
ipfs-cluster-ctl pin rm <old_cid>
I got this. thanks.
Is there a way to reference this new file by some name so that no matter how many times this file gets modified, by using constant reference name , peers will always get hold of new latest CID.
If the file is in MFS, you could always resolve its path to a CID with ipfs files stat <mfs_path>
. You’d need to do that before pinning.
(see ipfs files --help
).
right , but as par as i know this <mfs_path> will be available on the local node only , not on the remote cluster peers, right ? .
Do we replicate MFS path too when we pin ?
Can i do “ipfs files read /myfile” on the other/remote nodes after "ipfs files write --create /myfile " on local node ?
Cluster does not interact with MFS, so you would need to write files to MFS in other nodes yourself (but if cluster pinned them, they would be available locally).
Thanks hector. I got bit of clarity now. I can proceed now. Thanks.