Hello,
I have a two node cluster with replication_factor: -1 configured. I have a directory structure on my main ipfs node with many files in it and I would like to fully replicate this structure to other cluster node.
I’ve looked other discussions but they mostly include pin replication, is there a way to automatically fully replicate the directory structure with file names (because I’m using unique file names to get files) ?
No. You need to export things from the MFS and pin that.
You can do:
ipfs-cluster-ctl pin add $(ipfs files stat / --hash)
That will create a “snapshot” of your current MFS and pin that.
If you change your MFS you will need to rerun that (and potentially removing the previous version).
I am using the cluster API for pinning the files right after writing into MFS on the main node.
Normally, first I write file to MFS on the main node and then take its CID and pin on the cluster. curl -X POST -F file=@myfile "http://127.0.0.1:5001/api/v0/files/write?arg=<path> http://localhost:9094/pins/<cid>
So in this case I should first get the stat output curl -X POST "http://127.0.0.1:5001/api/v0/files/stat?arg=/<path_to_a_file>"
then it’s getting a bit fuzzy
I’ve already pinning the files with ipfs-cluster-ctl pin add <CID> but this only makes replication of the pin. But I’m curious about how to replicate the file itself ?