Elastos Hive Cluster
Elastos Hive Cluster is a decentralized File Storage Service that based on IPFS cluster. Hive Cluster use IPFS and IPFS-cluster as the base infrastructure to save Elastos data. Hive Cluster is also a stand-alone application as same as IPFS Cluster.
The typical IPFS peer is a resource hunger program. If you install IPFS daemon to your mobile device, it will take up resources and slow down your device. We are creating Hive project, which uses IPFS cluster as the Elastos App storage backend, and can be used in a low resources consumption scenario.
The project distils from the IPFS Cluster, but it will have many differences with the IPFS Cluster.
Elastos Hive Cluster maintains a big IPFS pinset for sharing. It can serve numerous virtual IPFS peers with only one IPFS peer instance running.
Hive Cluster is not only a pinset manager but also a backend for multiple IPFS clients.
Table of Contents
- Install Go
- Download Source
- Build Cluster
- Building Debian package
- Get Started
- Initialize config files
- Run as daemon
The following requirements apply to the installation from source:
- Go 1.11+
- IPFS or internet connectivity (to download depedencies).
The build process for cluster requires Go 1.10 or higher. Download propriate binary archive from golang.org, and install it onto specific directory:
$ curl go1.11.4.linux-amd64.tar.gz -o golang.tar.gz $ tar -xzvf golang.tar.gz -C YOUR-INSTALL-PATH
Then add path YOUR-INSTALL-PATH/go/bin to user environment variable PATH.
$ export PATH="YOUR-INSTALL-PATH/go/bin:$PATH"
Besides that, build environment for
golang projects must be required to setup:
$ export GOPATH="YOUR-GO-PATH" $ export PATH="$GOPATH/bin:$PATH"
In convinience, just add these lines to your profile
$HOME/.profile, then validate it with the command:
$ . $HOME/.profile $ go version
Then use export command to check if it validated or not.
Notice : If you run into trouble, see the Go install instructions.
There are two ways to setup your source code. One is directly to download source code under
$GOPATH environment as below:
$ cd $GOPATH/src/github.com/elastos $ git clone https://github.com/elastos/Elastos.NET.Hive.Cluster.git
The other way is to download source to specific location, and then create linkage to that directory underp propriate
$ cd YOUR-PATH $ git clone https://github.com/elastos/Elastos.NET.Hive.Cluster.git $ cd $GOPATH/src/github.com/elastos $ link -s YOUR-PATH/Elastos.NET.Hive.Cluster Elastos.NET.Hive.Cluster
To build Cluster with the following commands:
$ cd $GOPATH/src/github.com/elastos/Elastos.NET.Hive.Cluster $ make $ make install
After installation, ipfs-cluster-service and ipfs-cluster-ctl would be generated under the directory
If you would rather have them built locally, use make build instead. You can run make clean to remove any generated artifacts and rewrite the import paths to their original form.
Note that when the ipfs daemon is running locally on its default ports, the build process will use it to fetch gx, gx-go and all the needed dependencies directly from IPFS.
Building Debian package
For Linux Debian based systems. This project can generate a deb package for to distribute conveniently.
Please make sure that the IPFS and IPFS-Cluster projects were built and
the binraries (ipfs, ipfs-cluster-service, ipfs-cluster-ctl) had been generated under the directory
To generate a deb package with the following commands:
$ cd $GOPATH/src/github.com/elastos/Elastos.NET.Hive.Cluster/extras/LinuxDeb $ make
After the deb package generated, it will have a hive-dist-???.deb file in the current directory. You can copy it to and install it on the Debian systems. Or, you can run make clean to remove generated.
# Install package on Linux Debian based systems $ dpkg -i hive-dist-???.deb
ipfs-cluster-service is a command line program to start cluster daemon, while ipfs-cluster-ctl is the client application to manage the cluster nodes and perform actions.
Run the following commands with
hep options to see more usages:
$ ipfs-cluster-service help ... $ ipfs-cluster-ctl help ...
Details about ipfs cluster please refer to the docs from https://cluster.ipfs.io.
Hive cluster uses HTTP interface to serve numerous clients. About HTTP API, please refer to * HTTP API
Hive cluster have to be running before starting Hive cluster. About how to run Hive IPFS daemon, please refer to Elastos Hive IPFS.
Initialize config files
To start using Cluster, you must first initialize Cluster’s config files on your system, which would be done with the command below:
$ ipfs-cluster-service init $ ls $HOME/.ipfs-cluster service.json
ipfs-cluster-service help for more information on the optional arguments it takes.
Run as Daemon
After initialization and configure, try to run ipfs-cluster-service daemon:
$ ipfs-cluster-service daemon &
then you can use ipfs-cluster-ctl program to check if cluster is running
$ ipfs-cluster-ctl id QmUGXgnUcqgZf9Js7GrvFP1uz7G6soq3urWk9Gz237DsQm | guest | Sees 1 other peers > Addresses: - /ip4/127.0.0.1/tcp/9096/ipfs/QmUGXgnUcqgZf9Js7GrvFP1uz7G6soq3urWk9Gz237DsQm - /ip4/18.104.22.168/tcp/9096/ipfs/QmUGXgnUcqgZf9Js7GrvFP1uz7G6soq3urWk9Gz237DsQm - /p2p-circuit/ipfs/QmUGXgnUcqgZf9Js7GrvFP1uz7G6soq3urWk9Gz237DsQm > IPFS: QmSPDCbxBSq7PYAnemABL7VpGRkpqBX9NT1AovEmzaXkvM - /ip4/127.0.0.1/tcp/4001/ipfs/QmSPDCbxBSq7PYAnemABL7VpGRkpqBX9NT1AovEmzaXkvM - /ip4/22.214.171.124/tcp/4001/ipfs/QmSPDCbxBSq7PYAnemABL7VpGRkpqBX9NT1AovEmzaXkvM - /ip6/::1/tcp/4001/ipfs/QmSPDCbxBSq7PYAnemABL7VpGRkpqBX9NT1AovEmzaXkvM
You also can run ipfs-cluster-service as a slave cluster node with following command:
$ ipfs-cluster-service daemon --bootstrap /ip4/126.96.36.199/tcp/9096/ipfs/QmNTD6Zbhdao DmjQqGJrp8dKEPvtBQGzRxwWHNcmvNYsbK &
We welcome contributions to the Elastos Hive Project.
A sincere thank you to all teams and projects that we rely on directly or indirectly.
This project is licensed under the terms of the MIT license.