IPFS Private Network and data Replication (Private Network against IPFS Cluster)

Hello Permanent Community!

I’m working on the project where I need to deploy Private IPFS network and automaticly replicate data beetwen all participant nodes.

And I little bit confused should I use Private Network or IPFS Cluster or their combination?

Private network allow me to isolate my nodes from IPFS public network but it doesn’t replicate data and the only way I see to implement that it manualy(or with some script) pin hash of the file to/from all nodes.

In it’s turn ipfs-cluster allows me to replicate data but it does not isolate my network from public gateway…

So how can I combine this two features or what the best way to build Private Network with data replication?

And my second question in case of using IPFS Cluster how can I interact with the network from my NodeJS app?
Can I use “ipfs-api” module to interact with ipfs-cluster network?
Should I use for example “ipfs-cluster-ctl add myfile.txt” or “ipfs add myfile.txt” and what’s the difference between them in this case?

Thanks in Advance!

1 Like

Hey @michael-maverick

In it’s turn ipfs-cluster allows me to replicate data but it does not isolate my network from public gateway…

That’s not correct. You can run IPFS Cluster along with the ipfs daemon configured in private-network-mode. Cluster only uses the IPFS API (tcp/5001).

And my second question in case of using IPFS Cluster how can I interact with the network from my NodeJS app?
Can I use “ipfs-api” module to interact with ipfs-cluster network?

Yes, Cluster offers an IPFS Proxy endpoint. That is, and endpoint on which requests are proxied to the underlying ipfs daemon except for some of them, which are intercepted and trigger cluster-actions: pin/add, pin/rm, add. There some more info here: https://cluster.ipfs.io/documentation/composite-clusters/#the-ipfs-proxy . This means you can point the ipfs-api thing to the tcp/9095 cluster port and should work.

Should I use for example “ipfs-cluster-ctl add myfile.txt” or “ipfs add myfile.txt” and what’s the difference between them in this case?

ipfs add adds to ipfs. ipfs-cluster-ctl add adds to cluster (possibly this means adding to several ipfs daemons, depending on the replication factor). ipfs-cluster-ctl uses the Cluster API (tcp/9094), which is different from the Proxy, even though the /add endpoint is similar in behaviour and options in both APIs.

1 Like

Hi @hector, Thank you very much for detailed explanation.

What api should be exposed outside. for example http://“ip:port”/ipfs/add
is it right?

You have some API docs for IPFS here: https://docs.ipfs.io/reference/api/http/ and for cluster here: https://cluster.ipfs.io/documentation/developer/api