I have a JS IPFs node running in the browser. How can I connect to the cluster of remote servers?
IPFS Cluster is a way of orchestrating storage across multiple go-IPFS nodes - https://cluster.ipfs.io
js-IPFS in the browser would not typically take part in an IPFS Cluster as itâs available storage space is comparatively small and itâs hard for remote nodes to dial in-browser nodes so itâs difficult to get content out of them without using content routing. The only transport you can really use is webrtc-star and go-IPFS doesnât support it. You can go the other direction and dial a go-IPFS node from an in-browser node over websockets though.
Do you mean how do you connect to the IPFS network in general? If youâre running the latest js-IPFS (0.48.0 at the time of writing) it will connect to the bootstrappers, then use the DHT delegate nodes to search for content and find more peers.
Thank you for your reply, it is very useful to me.
When I run js-ipfs on node.js, how do I start and join the cluster?
I tried to run these lines of code, but the operation will report an error,
-
Code:
function ipfs_cluster() {
const cluster = ipfsCluster(âlocalhostâ, â9094â, {protocol: âhttpâ });
cluster.id((err, id) => {
err? console.error(err): console.log(id);
console.log(âcluster-idâ);
}); -
Error:
Error: connect ECONNREFUSED 127.0.0.1:9094
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno:âECONNREFUSEDâ,
code:âECONNREFUSEDâ,
syscall:âconnectâ,
address: â127.0.0.1â,
port: 9094
}
cluster-id
Iâm sure I started the âjsipfs daemonâ command locally,
Or the second way is to run this line of code on node.js: const node = await IPFS.create(),
The node running on node.js has successfully connected to other peer nodes, indicating that jsipfs has been successfully started.
But it still reports errors when starting the cluster.
Am I missing something?
You are not running an ipfs-cluster peer.