edit

Quick Installation and Setup

Purpose

This section is a step by step guide to setting up LeoFS for the first time. By following this tutorial you're able to easily build a stand-alone LeoFS system.

Note

In this section, you install LeoStorage, LeoGateway and LeoManager on a single system with no clustering to quickly understand LeoFS.

Installation v1.3.3 or Later

Ubuntu

For Ubuntu distributions, perform the following steps:

  1. Downloads a LeoFS' package from LeoFS' repository on GitHub
  2. Installs a LeoFS using dpkg

For Ubuntu 16.04

1
2
3
4
5
$ wget https://github.com/leo-project/leofs/releases/download/{VERSION}/leofs_{VERSION}-1_erl-18.3_ubuntu-16.04_amd64.deb
$ sudo dpkg -i leofs_{VERSION}-1_erl-18.3_ubuntu-16.04_amd64.deb
$ ls -l /usr/local/leofs/
total 4
drwxr-xr-x 6 root   root   4096 Jan 20 00:00 {VERSION}

For Ubuntu 14.04

1
2
3
4
5
$ wget https://github.com/leo-project/leofs/releases/download/{VERSION}/leofs_{VERSION}-1_erl-18.3_ubuntu-14.04_amd64.deb
$ sudo dpkg -i leofs_{VERSION}-1_erl-18.3_ubuntu-14.04_amd64.deb
$ ls -l /usr/local/leofs/
total 4
drwxr-xr-x 6 root   root   4096 Jan 20 00:00 {VERSION}

CentOS

For CentOS distributions, perform the following steps:

  1. Downloads a LeoFS' package from LeoFS' repository on GitHub
  2. Installs a LeoFS using rpm

For CentOS 6.x

1
2
3
4
5
$ wget https://github.com/leo-project/leofs/releases/download/{VERSION}/leofs-{VERSION}-1.erl-18.3.el6.x86_64.rpm
$ sudo rpm -ivh leofs-{VERSION}-1.erl-18.3.el6.x86_64.rpm
$ ls -l /usr/local/leofs/
total 4
drwxr-xr-x 6 root   root   4096 Jan 20 15:37 {VERSION}

For CentOS 7.x

1
2
3
4
5
$ wget https://github.com/leo-project/leofs/releases/download/{VERSION}/leofs-{VERSION}-1.erl-18.3.el7.x86_64.rpm
$ sudo rpm -ivh leofs-{VERSION}-1.erl-18.3.el7.x86_64.rpm
$ ls -l /usr/local/leofs/
total 4
drwxr-xr-x 6 root   root   4096 Jan 20 15:37 {VERSION}

Configuration

To be able to access the LeoFS storage system, you need to edit /etc/hosts which adheres to rules for bucket naming of S3-API.

Modifies “/etc/hosts”

  • Adds a domain for the LeoFS bucket in /etc/hosts
  • Bucket names must follow these rules
1
2
3
## Replace {BUCKET_NAME} with the name of the bucket ##
$ sudo vi /etc/hosts
127.0.0.1 localhost {BUCKET_NAME}.localhost

Launches LeoManager, LeoStorage, and LeoGateway node(s)

You launch the LeoFS storage system by the following steps:

  1. There is only single replica by the default configuration of consistency.num_of_replicas
  2. Starts both LeoManager master and LeoManager slave
  3. Starts a LeoStorage
  4. Starts a LeoGateway
1
2
3
4
5
$ cd /usr/local/leofs/{VERSION}
$ leo_manager_0/bin/leo_manager start
$ leo_manager_1/bin/leo_manager start
$ leo_storage/bin/leo_storage start
$ leo_gateway/bin/leo_gateway start

Then confirms whether the LeoManager nodes and the LeoStorage are running or not with the leofs-adm status command.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$ leofs-adm status
 [System Confiuration]
-----------------------------------+----------
 Item                              | Value
-----------------------------------+----------
 Basic/Consistency level
-----------------------------------+----------
                    system version | 1.3.3
                        cluster Id | leofs_1
                             DC Id | dc_1
                    Total replicas | 1
          number of successes of R | 1
          number of successes of W | 1
          number of successes of D | 1
 number of rack-awareness replicas | 0
                         ring size | 2^128
-----------------------------------+----------
 Multi DC replication settings
-----------------------------------+----------
 [mdcr] max number of joinable DCs | 2
 [mdcr] total replicas per a DC    | 1
 [mdcr] number of successes of R   | 1
 [mdcr] number of successes of W   | 1
 [mdcr] number of successes of D   | 1
-----------------------------------+----------
 Manager RING hash
-----------------------------------+----------
                 current ring-hash | 433fe365
                previous ring-hash | 433fe365
-----------------------------------+----------

 [State of Node(s)]
-------+--------------------------+--------------+----------------+----------------+----------------------------
 type  |           node           |    state     |  current ring  |   prev ring    |          updated at
-------+--------------------------+--------------+----------------+----------------+----------------------------
  S    | [email protected]      | attached     |                |                | 2017-05-01 00:43:06 +0000
-------+--------------------------+--------------+----------------+----------------+----------------------------

Starts the LeoFS storage system

If there is no issue, you're able to execute the leofs-adm start commmand to launch it, then confirm the current status with the leof-adm status command.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$ ./leofs-adm start
Generating RING...
Generated RING
OK 100% - [email protected]
OK

$ leofs-adm status
 [System Confiuration]
-----------------------------------+----------
 Item                              | Value
-----------------------------------+----------
 Basic/Consistency level
-----------------------------------+----------
                    system version | 1.3.3
                        cluster Id | leofs_1
                             DC Id | dc_1
                    Total replicas | 1
          number of successes of R | 1
          number of successes of W | 1
          number of successes of D | 1
 number of rack-awareness replicas | 0
                         ring size | 2^128
-----------------------------------+----------
 Multi DC replication settings
-----------------------------------+----------
 [mdcr] max number of joinable DCs | 2
 [mdcr] total replicas per a DC    | 1
 [mdcr] number of successes of R   | 1
 [mdcr] number of successes of W   | 1
 [mdcr] number of successes of D   | 1
-----------------------------------+----------
 Manager RING hash
-----------------------------------+----------
                 current ring-hash | 433fe365
                previous ring-hash | 433fe365
-----------------------------------+----------

 [State of Node(s)]
-------+--------------------------+--------------+----------------+----------------+----------------------------
 type  |           node           |    state     |  current ring  |   prev ring    |          updated at
-------+--------------------------+--------------+----------------+----------------+----------------------------
  S    | [email protected]      | running      | 433fe365       | 433fe365       | 2017-05-01 00:43:06 +0000
  G    | [email protected]      | running      | 433fe365       | 433fe365       | 2017-05-01 00:43:08 +0000
-------+--------------------------+--------------+----------------+----------------+----------------------------

Retrieves both an access-key and a secret accesskey

To make a bucket for the test, you need to retrieve both an access-key and a secret access-key with the leofs-adm create-user command

1
2
3
$ leofs-adm create-user <YOUR-ID>
access-key-id: <ACCESS-KEY-ID>
secret-access-key: <SECRET-ACCESS-KEY-ID>

After that, you use S3-client(s) with those keys when you access the LeoFS storage system.

Usess3cmd to access it

If you'd like to use s3cmd to access the LeoFS storage system, perform the following steps:

  • Installs s3cmd on your machine
  • Configures s3cmd
1
2
3
4
5
6
7
8
9
$ s3cmd --version
s3cmd version 1.6.1

$ s3cmd --configure
...
## access_key = <access-key-id>
## secret_key = <secret-access-key>
## proxy_host = localhost
## proxy_port = 8080
  • Creates a bucket
1
2
$ s3cmd mb <BUCKET>
Bucket 's3://<BUCKET>/' created
  • Puts an object into the bucket
1
2
3
$ s3cmd put /path/to/<OBJECT> s3://<BUCKET>/
upload: '<OBJET>' -> 's3://<BUCKET>/<OBJECT>'  [1 of 1]
 1096 of 1096   100% in    0s   170.92 kB/s  done
  • Gets an object
1
2
3
$ s3cmd get s3://<BUCKET>/<OBJECT>
download: 's3://<BUCKET>/<OBJET>' -> './<OBJECT>'  [1 of 1]
 1096 of 1096   100% in    0s   307.38 kB/s  done
  • Lists objects
1
2
$ s3cmd ls s3://<BUCKET>/
2017-01-30 02:24      1096   s3://<BUCKET>/<OBJECT>
  • Removes an object
1
2
$ s3cmd del s3://<BUCKET>/<OBJECT>
delete: 's3://<BUCKET>/<OBJECT>'

Wrap up

You now know how to setup a stand-alone LeoFS storage system, and make sure to have a look at Building a LeoFS' cluster with Ansible to learn how to setup a LeoFS cluster.