# Tutorial - Get Ready to Use IPFS Cluster

IPFS has become one of the most popular ways to store your data in a decentralized way. This tutorial will demonstrate the basic usage of ipfs, ipfs-cluster and how to access it via axios in JavaScript.

## Perquisites

• Download ipfs,ipfs-cluster-service on all of your servers and ipfs-cluster-ctl on at least one of your servers on IPFS distributions. For me, I download them on all of my servers.

• Make them into PATH like

• make sure the following port is accessible on your server

• 8080 (ipfs get file)
• 9094 (ipfs cluster service RESTful API)
• 9096 (ipfs cluster service peer commuication)

## Configuration

The following steps should be done on all of your servers

• Init ipfs

• (optional) Go to the .ipfs directory it generated and open config

Change to "Gateway": "/ip4/0.0.0.0/tcp/8080" so that we can get the file from http://ip:8080/hash

• Init ipfs-cluster

Go to the .ipfs-cluster directory it generated and open service.json

Make sure every server has the same secret

• (optional) Go to the .ipfs directory it generated and open config

Change to "http_listen_multiaddress" in restapi to "/ip4/0.0.0.0/tcp/9094" so that we can add&pin the file into the whole cluster from http://ip:9094

## Start Daemon

The following steps can be optimized to use superviser

• Start ipfs daemon on every server

• Start ipfs-cluster-service daemon on first server

• Start ipfs-cluster-service daemon on other servers by bootstrap

cluster-service-id can be inferred from cluster.id from service.json or logs of ipfs-cluster-service daemon on first server.

• e.g

Right now, they should be connected!

## Access cluster by axios

1. add&pin files on one of the server in the cluster

POST [ip]:9094/add (request content-type must bemultipart/form-data )

2. get files from all of the server in the cluster

GET [ip]:8080/ipfs/[CID]

Here is the axios example in Vue to upload a binary file (Buffer) in one peer and access it from another in frontend.