How to configure number copies of file we add?

may i know is there a way to configure how many copies can we have we add a file using ipfs add?

if i only have a single node, can i have few copy of this file?

Please categorize your posts correctly (this is not a “tutorial”-related question). If you are using ipfs-cluster-ctl add you have options to control the replication factor (--help). If you are only using ipfs you can only add to your local node.

Thanks for the correction of the categorize.

if we set threshold as below,

Scenario 1: only 1 node 1 cluster => 1 copied of File?
Scenario 2: 2 node 2 cluster , all node and cluster is up and running => 1 copy of file in 1 Node?
Scenario 3: 2 node 2 cluster , 1 node down and cluster is up and running => only 1 copy of file for the running Node. Once the down node is restarted… will the file replicate to this node?

With replication factor -1 the file will be pinned by all nodes in the cluster. If a node is down it will pick it up later when it comes up.

thanks…each node only have a copy of file? and not many copy in 1 node right?

Scenario 4: 2 node 2 cluster , 2 node up and running and only 1 cluster is up => once the cluster is up will the file pick up?

another setting, as below

4 node 4 cluster -> only 2 node have the file?

yes, one copy per node.



There are two modes: with “replication everywhere mode” (-1), node will pick up everything when they come up after downtime etc.

When replicationFactors are set to something > 0, however, cluster will make a list of nodes that must pin the content at the moment when the pin is submitted. This list is called “allocations”.

Only nodes that are “alive” can be chosen for these allocations. Clusters tries to allocate to ReplicationFactorMax, but if there are not enough, it will not error as long as it finds at least ReplicationFactorMin allocations.

The list of allocations is determined at the moment of pinning/adding and does not change later (even if nodes that were down come up again), unless things are re-pinned manually (in which case it will try to go up to ReplicationFactorMax again).