Bootsrapping from an existing IPFS Cluster

Cluster

IPFS-Cluster | Documentation

Bootsrapping from an existing IPFS Cluster | Documentation

IPFS is designed so that a node only stores files locally that are specifically requested. The following is one way of populating a new IPFS node with all existing files from a pre-existing node.

To do so, first create a secret from node0, the original node, then share that secret with node1, the node you want to bootstrap from node0. Then node1 runs the bootstrap command specifying the cluster’s address and setting the CLUSTER_SECRET as an env variable.

node0

  • export CLUSTER_SECRET=$(od -vN 32 -An -tx1 /dev/urandom | tr -d ' \n')

  • echo $CLUSTER_SECRET

  • ipfs-cluster-service init

  • ipfs-cluster-service daemon

node1 (bootstrapping from node0)

  • export CLUSTER_SECRET=<copy from node0>

  • ipfs-cluster-service init

  • ipfs-cluster-service daemon --bootstrap /ip4/192.168.1.2/tcp/9096/ipfs/QmZjSoXUQgJ9tutP1rXjjNYwTrRM9QPhmD9GHVjbtgWxEn // replace with what you see from running node0’s daemon

  • ipfs-cluster-ctl peers ls check your peers to see you’ve added node0 correctly

node0

  • if you want to remove a peer after the bootstrapping is complete, the following command will do that and shut down the IPFS cluster

  • ipfs-cluster-ctl peers rm QmYFYwnFUkjFhJcSJJGN72wwedZnpQQ4aNpAtPZt8g5fCd

Last updated