Quick Start: Building a cluster¶
Purpose¶
This tutorial teaches you how to easily build a LeoFS cluster. All steps will not be explained in detail, it is assumed you already know how to setup a stand-alone LeoFS system. This guide exists to help you get a cluster up and running quickly. We recommend that you read the LeoFS Installation, Configuration and Administration Guide to learn how to administer your LeoFS cluster. We hope that by reading this tutorial you will be able to get a cluster started as quickly as possible.
Case example¶
- Manager
- IP: 10.0.1.101, 10.0.1.102
- Name: manager_0@10.0.1.101, manager_1@10.0.1.102
- Gateway
- IP: 10.0.1.103
- Name: gateway_0@10.0.1.103
- Storage
- IP: 10.0.1.104 .. 10.0.1.106
- Name: storage_0@10.0.1.104 .. storage_2@10.0.1.106
Install Erlang and LeoFS on each server¶
Configuration - Edit “leo_*.conf” on each server¶
- File path: “$LEOFS_ROOT/package/leo_*/etc/leo_*.conf”
- Precondition
nodename
must be unique for each node in the LeoFS cluster
- Edit Manager-master’s leo_manager.conf
## Name of the Node
nodename = [email protected]
... omitted below
- Edit Manager-slave’s leo_manager.conf
## Name of the Node
nodename = [email protected]
... omitted below
- Edit Gateway’s leo_gateway.conf
## Name of the Node
nodename = [email protected]
... omitted below
- Edit Storage’s leo_storage.conf
## Name of the Node
nodename = [email protected]
... omitted below
Configuration - Consistency level¶
- Reference: The consistency level
- Edit Manager’s leo_manager.conf
- You only need to modify Manager-master for the consistency level.
- “$LEOFS_ROOT/package/leo_manager_0/etc/leo_manager.conf”
## --------------------------------------------------------------------
## MANAGER - Consistency Level
## * Only set its configurations to **Manager-master**
## * See: https://leo-project.net/leofs/docs/configuration/configuration_1.html
## --------------------------------------------------------------------
## A number of replicas
consistency.num_of_replicas = 2
## A number of replicas needed for a successful WRITE operation
consistency.write = 1
## A number of replicas needed for a successful READ operation
consistency.read = 1
## A number of replicas needed for a successful DELETE operation
consistency.delete = 1
Order of server launch¶
- Manager-master
- Manager-slave
- Storage nodes
- Gateway(s)
Method of server launch¶
- Shell script: “$LEOFS_ROOT/package/leo_*/bin/leo_*”
- Launch Manager-master
$ $LEOFS_ROOT/package/leo_manager_0/bin/leo_manager start
- Launch Manager-slave
$ $LEOFS_ROOT/package/leo_manager_1/bin/leo_manager start
- Launch each Storage nodes
$ $LEOFS_ROOT/package/leo_storage/bin/leo_storage start
- Launch each Gateway nodes
$ $LEOFS_ROOT/package/leo_gateway/bin/leo_gateway start
Confirm that the system is running¶
- Use the command
status
in the LeoFS manager console
$ leofs-adm status
[System config]
System version : 1.0.0
Cluster Id : leofs_1
DC Id : dc_1
Total replicas : 2
# of successes of R : 1
# of successes of W : 1
# of successes of D : 1
# of DC-awareness replicas : 0
ring size : 2^128
Current ring hash : 8cd79c31
Prev ring hash : 8cd79c31
[Multi DC replication settings]
max # of joinable DCs : 2
# of replicas a DC : 1
[Node(s) state]
-------+--------------------------+--------------+----------------+----------------+----------------------------
type | node | state | current ring | prev ring | updated at
-------+--------------------------+--------------+----------------+----------------+----------------------------
S | [email protected] | running | 8cd79c31 | 8cd79c31 | 2014-04-03 11:28:20 +0900
S | [email protected] | running | 8cd79c31 | 8cd79c31 | 2014-04-03 11:28:20 +0900
S | [email protected] | running | 8cd79c31 | 8cd79c31 | 2014-04-03 11:28:20 +0900
G | [email protected] | running | 8cd79c31 | 8cd79c31 | 2014-04-03 11:28:21 +0900
Get your S3 API Key from the LeoFS manager console¶
- Use the command create-user in the LeoFS manager console
- It takes the user name as its only argument
$ leofs-adm create-user <your-name>
access-key-id: 05dcba94333c7590a635
secret-access-key: c776574f3661579ceb91aa8788dfcac733b21b3a
Using LeoFS¶
- Use the command add-bucket in the LeoFS manager console
- It takes the bucket name and access-key-id got in the previous section as its arguments
$ leofs-adm add-bucket <bucket> <access-key-id>
ok
- Insert some data into LeoFS by using any S3 client as mentioned above
- You can now get the data stored in LeoFS
$ curl https://localhost:8080/your_bucket_name/path/to/file
> {CONTENTS}
Note
From version 0.16.0, you need to set ACL settings of your bucket to public-read
by using the command update-acl if you want to get the data stored in LeoFS via web browser.
Wrap up¶
You now have a working LeoFS cluster. Make sure to have a look at LeoFS Installation, LeoFS Configuration and Administration Guide to learn more about setting up and managing your LeoFS cluster.