High availability for both reading and writing

I am trying to have a setup with high availability for our IPFS nodes.

Currently we have a cluster composed of node0 and node1.

We also have a proxy Python application which connects to the IPFS Proxy API (port 9095) of either node0 or node1.

I would expect that py-ipfs-http-client would allow me to connect to multiple nodes like:

api = ipfshttpclient.connect('/ip4/node0/tcp/9095,/ip4/node1/tcp/9095')

However that does not work, neither do passing a list of strings.

Now what I want to achieve is:

  • If node0 is available, then writes go through it
  • Otherwise, go through node1

The same goes for reads.

Is there any way of doing that natively or must I come up with my own HA scheme for that?

You would need to implement failover logic in your [Python] client, or put something like nginx in between.

Cluster’s REST API client (and ipfs-cluster-ctl) support this type of failover, but they talk to the rest api, not to the IPFS proxy API.

That’s what I figured. Thank you for confirming that.

I think instead of implementing such functionality on the client, I’ll put the nodes behind a load balancer and let it handle this logic and connect the client to it.