API to add peer to IPFS-CLUSTER

I am starting a new IPFS-CLUSTER server and I have old IPFS-CLUSTER servers.
I wish to call API on these old servers and let them know about new server.

I found API

||// PeerAdd adds a new peer to the cluster.|
||PeerAdd(ctx context.Context, pid peer.ID) (*api.ID, error)|

But PeerAdd takes peer.ID that is random string or publickey but not multiaddr

Is there API to pass new peer as multiaddr string.

Do I have to restart all IPFS-CLUSTERs with bootstrap argument?

Is there other API to pass IP:port to use along side with PeerAdd that takes peer.ID

I do the same for ipfs with API

Would IPFS-CLUSTER get host IPs from underlying ipfs server?

Sorry, PeerAdd is misleading and not useful.

Yes, in principle you need to start the NEW peers with the --bootstrap argument (or modifying the peerstore) as explained here: Bootstrapping the Cluster - Pinset orchestration for IPFS. That is a must if using Raft consensus.

If you are using CRDT, it depends. You can restart the old peers (rather than the new) with the bootstrap argument or the modified peerstore. If the peers are on the same local network they may be able to auto-discover eachothers via mDNS without having to do anything else by just starting them. Or the new peers may simply discover each others as long as they connect to a peer that is already in the cluster via DHT routing.

My recommendation is to modify the peerstore file, as that is what makes them open connections to places and gives them first-hand multiaddress information for other peers.

1 Like