S3, NFS භාවිතා කරන සේවාලාභීන් සමඟ ගැළපෙන, බෙදා හරින ලද දෝෂ-ඉවසන LeoFS වස්තු ගබඩාව ස්ථාපනය කිරීම

අනුව Opennet: ලියෝඑෆ්එස් - බෙදා හරින ලද දෝෂ-ඉවසන වස්තූන් ගබඩා කිරීම ලියෝඑෆ්එස්, Amazon S3 API සහ REST-API භාවිතා කරන සේවාදායකයින් සමඟ අනුකූල වන අතර NFS සේවාදායක මාදිලියටද සහය දක්වයි. කුඩා හා ඉතා විශාල වස්තු ගබඩා කිරීම සඳහා ප්‍රශස්තකරණයන් ඇත, ගොඩනඟන ලද හැඹිලි යාන්ත්‍රණයක් ඇත, දත්ත මධ්‍යස්ථාන අතර ආචයනය අනුකරණය කළ හැකිය. ව්‍යාපෘතියේ ඉලක්කවලට අනුපිටපත් අනවශ්‍ය ලෙස ප්‍රතිනිර්මාණය කිරීම හරහා 99.9999999% විශ්වසනීයත්වයක් ලබා ගැනීම සහ අසාර්ථක වීමේ එක් ලක්ෂයක් ඉවත් කිරීම ඇතුළත් වේ. ව්‍යාපෘති කේතය Erlang වලින් ලියා ඇත.

LeoFS සංරචක තුනකින් සමන්විත වේ:

  • LeoFS ගබඩාව - වස්තු සහ පාර-දත්ත එකතු කිරීම, ලබා ගැනීම සහ මකා දැමීමේ මෙහෙයුම් සඳහා සේවය කරයි, පාරිභෝගික ඉල්ලීම් අනුකරණය කිරීම, ප්‍රතිසාධනය සහ පෝලිම් තැබීම සඳහා වගකිව යුතුය.
  • LeoFS ගේට්වේ — REST-API හෝ S3-API භාවිතා කරන සේවාලාභීන්ට HTTP ඉල්ලීම් සහ ප්‍රතිචාර යළි-යොමු කරයි, මතකයේ සහ තැටියේ වඩාත්ම අවශ්‍ය දත්ත හැඹිලිගත කිරීම සහතික කරයි.
  • LeoFS කළමනාකරු - LeoFS Gateway සහ LeoFS ගබඩා නෝඩ් වල ක්‍රියාකාරිත්වය නිරීක්ෂණය කරයි, නෝඩ් වල තත්ත්වය නිරීක්ෂණය කරයි සහ චෙක්සම් පරීක්ෂා කරයි. දත්ත අඛණ්ඩතාව සහ ඉහළ ගබඩා ලබා ගැනීමේ හැකියාව සහතික කරයි.

මෙම ලිපියෙන් අපි ඇන්සිබල්-ප්ලේබුක් භාවිතයෙන් Leofs ස්ථාපනය කර S3, NFS පරීක්ෂා කරන්නෙමු.

ඔබ නිල ක්‍රීඩා පොත් භාවිතයෙන් LeoFS ස්ථාපනය කිරීමට උත්සාහ කරන්නේ නම්, ඔබට විවිධ දෝෂ වලට මුහුණ දීමට සිදුවේ. 1,2. මෙම වැරදි මඟහරවා ගැනීමට කළ යුතු දේ මම මෙම ලිපියෙන් ලියන්නෙමි.

ඔබ ansible-playbook ධාවනය කරන තැන, ඔබ netcat ස්ථාපනය කළ යුතුය.

ඉන්වෙන්ටරි උදාහරණය

උදාහරණ ඉන්වෙන්ටරි (hosts.sample repository තුළ):

# Please check roles/common/vars/leofs_releases for available versions
[all:vars]
leofs_version=1.4.3
build_temp_path="/tmp/leofs_builder"
build_install_path="/tmp/"
build_branch="master"
source="package"

#[builder]
#172.26.9.177

# nodename of leo_manager_0 and leo_manager_1 are set at group_vars/all
[leo_manager_0]
172.26.9.176

# nodename of leo_manager_0 and leo_manager_1 are set at group_vars/all
[leo_manager_1]
172.26.9.178

[leo_storage]
172.26.9.179 [email protected]
172.26.9.181 [email protected]
172.26.9.182 [email protected]
172.26.9.183 [email protected]

[leo_gateway]
172.26.9.180 [email protected]
172.26.9.184 [email protected]

[leofs_nodes:children]
leo_manager_0
leo_manager_1
leo_gateway
leo_storage

සේවාදායකය සූදානම් කිරීම

Selinux අබල කරමින්. ප්‍රජාව විසින් LeoFS සඳහා Selinux ප්‍රතිපත්ති නිර්මාණය කරනු ඇතැයි මම බලාපොරොත්තු වෙමි.

    - name: Install libselinux as prerequisite for SELinux Ansible module
      yum:
        name: "{{item}}"
        state: latest
      with_items:
        - libselinux-python
        - libsemanage-python

    - name: Disable SELinux at next reboot
      selinux:
        state: disabled

    - name: Set SELinux in permissive mode until the machine is rebooted
      command: setenforce 0
      ignore_errors: true
      changed_when: false

ස්ථාපනය netcat и redhat-lsb-core. netcat සඳහා අවශ්ය වේ leofs-adm, redhat-lsb-core OS අනුවාදය තීරණය කිරීමට අවශ්ය වේ මෙහි.

    - name: Install Packages
      yum: name={{ item }} state=present
      with_items:
        - nmap-ncat
        - redhat-lsb-core

පරිශීලක leofs නිර්මාණය කිරීම සහ එය රෝද කණ්ඩායමට එකතු කිරීම

    - name: Create user leofs
      group:
        name: leofs
        state: present

    - name: Allow 'wheel' group to have passwordless sudo
      lineinfile:
        dest: /etc/sudoers
        state: present
        regexp: '^%wheel'
        line: '%wheel ALL=(ALL) NOPASSWD: ALL'
        validate: 'visudo -cf %s'

    - name: Add the user 'leofs' to group 'wheel'
      user:
        name: leofs
        groups: wheel
        append: yes

Erlang ස්ථාපනය කිරීම

    - name: Remote erlang-20.3.8.23-1.el7.x86_64.rpm install with yum
      yum: name=https://github.com/rabbitmq/erlang-rpm/releases/download/v20.3.8.23/erlang-20.3.8.23-1.el7.x86_64.rpm

නිවැරදි කරන ලද Ansible playbook හි සම්පූර්ණ අනුවාදය මෙතැනින් සොයා ගත හැක: https://github.com/patsevanton/leofs_ansible

ස්ථාපනය, මානකරනය, දියත් කිරීම

මීලඟට අපි ලියා ඇති පරිදි ඉටු කරමු https://github.com/leo-project/leofs_ansible build_leofs.yml නොමැතිව

## Install LeoFS
$ ansible-playbook -i hosts install_leofs.yml

## Config LeoFS
$ ansible-playbook -i hosts config_leofs.yml

## Start LeoFS
$ ansible-playbook -i hosts start_leofs.yml

Primary LeoManager හි පොකුරු තත්ත්වය පරීක්ෂා කිරීම

leofs-adm status

ප්‍රාථමික සහ ද්විතීයික ඇසිබල්-ප්ලේබුක් ලඝු-සටහන් හි දැකිය හැක

S3, NFS භාවිතා කරන සේවාලාභීන් සමඟ ගැළපෙන, බෙදා හරින ලද දෝෂ-ඉවසන LeoFS වස්තු ගබඩාව ස්ථාපනය කිරීම

S3, NFS භාවිතා කරන සේවාලාභීන් සමඟ ගැළපෙන, බෙදා හරින ලද දෝෂ-ඉවසන LeoFS වස්තු ගබඩාව ස්ථාපනය කිරීම

ප්රතිදානය මේ වගේ දෙයක් වනු ඇත

 [System Confiuration]
-----------------------------------+----------
 Item                              | Value    
-----------------------------------+----------
 Basic/Consistency level
-----------------------------------+----------
                    system version | 1.4.3
                        cluster Id | leofs_1
                             DC Id | dc_1
                    Total replicas | 2
          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 | a0314afb
                previous ring-hash | a0314afb
-----------------------------------+----------

 [State of Node(s)]
-------+----------------------+--------------+---------+----------------+----------------+----------------------------
 type  |         node         |    state     | rack id |  current ring  |   prev ring    |          updated at         
-------+----------------------+--------------+---------+----------------+----------------+----------------------------
  S    | [email protected]      | running      |         | a0314afb       | a0314afb       | 2019-12-05 10:33:47 +0000
  S    | [email protected]      | running      |         | a0314afb       | a0314afb       | 2019-12-05 10:33:47 +0000
  S    | [email protected]      | running      |         | a0314afb       | a0314afb       | 2019-12-05 10:33:47 +0000
  S    | [email protected]      | attached     |         |                |                | 2019-12-05 10:33:58 +0000
  G    | [email protected]      | running      |         | a0314afb       | a0314afb       | 2019-12-05 10:33:49 +0000
  G    | [email protected]      | running      |         | a0314afb       | a0314afb       | 2019-12-05 10:33:49 +0000
-------+----------------------+--------------+---------+----------------+----------------+----------------------------

පරිශීලකයෙකු නිර්මාණය කිරීම

leofs පරිශීලකයෙකු සාදන්න:

leofs-adm create-user leofs leofs

  access-key-id: 9c2615f32e81e6a1caf5
  secret-access-key: 8aaaa35c1ad78a2cbfa1a6cd49ba8aaeb3ba39eb

පරිශීලක ලැයිස්තුව:

leofs-adm get-users
user_id     | role_id | access_key_id          | created_at                
------------+---------+------------------------+---------------------------
_test_leofs | 9       | 05236                  | 2019-12-02 06:56:49 +0000
leofs       | 1       | 9c2615f32e81e6a1caf5   | 2019-12-02 10:43:29 +0000

බාල්දියක් සාදන්න

බාල්දියක් හැදුවා

leofs-adm add-bucket leofs 9c2615f32e81e6a1caf5
OK

බාල්දි ලැයිස්තුව:

 leofs-adm get-buckets
cluster id   | bucket   | owner  | permissions      | created at                
-------------+----------+--------+------------------+---------------------------
leofs_1      | leofs    | leofs  | Me(full_control) | 2019-12-02 10:44:02 +0000

s3cmd වින්‍යාස කරමින්

ක්ෂේත්රයේ HTTP Proxy server name Gateway server IP සඳහන් කරන්න

s3cmd --configure 

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
Access Key [9c2615f32e81e6a1caf5]: 
Secret Key [8aaaa35c1ad78a2cbfa1a6cd49ba8aaeb3ba39eb]: 
Default Region [US]: 

Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
S3 Endpoint [s3.amazonaws.com]: 

Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used
if the target S3 system supports dns based buckets.
DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: leofs

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: 
Path to GPG program [/usr/bin/gpg]: 

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP, and can only be proxied with Python 2.7 or newer
Use HTTPS protocol [No]: 

On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't connect to S3 directly
HTTP Proxy server name [172.26.9.180]: 
HTTP Proxy server port [8080]: 

New settings:
  Access Key: 9c2615f32e81e6a1caf5
  Secret Key: 8aaaa35c1ad78a2cbfa1a6cd49ba8aaeb3ba39eb
  Default Region: US
  S3 Endpoint: s3.amazonaws.com
  DNS-style bucket+hostname:port template for accessing a bucket: leofs
  Encryption password: 
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: False
  HTTP Proxy server name: 172.26.9.180
  HTTP Proxy server port: 8080

Test access with supplied credentials? [Y/n] Y
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Not configured. Never mind.

Save settings? [y/N] y
Configuration saved to '/home/user/.s3cfg'

ඔබට දෝෂය ලැබෙන්නේ නම් ERROR: S3 දෝෂය: 403 (AccessDenied): ප්‍රවේශය ප්‍රතික්ෂේප විය:

s3cmd put test.py s3://leofs/
upload: 'test.py' -> 's3://leofs/test.py'  [1 of 1]
 382 of 382   100% in    0s     3.40 kB/s  done
ERROR: S3 error: 403 (AccessDenied): Access Denied

එවිට ඔබට s3cmd config එකේ signature_v2 True ලෙස වෙනස් කළ යුතුය. මේකේ විස්තර නිකුත් කිරීම.

Signature_v2 අසත්‍ය නම්, මෙවැනි දෝෂයක් ඇති වේ:

WARNING: Retrying failed request: /?delimiter=%2F (getaddrinfo() argument 2 must be integer or string)
WARNING: Waiting 3 sec...
WARNING: Retrying failed request: /?delimiter=%2F (getaddrinfo() argument 2 must be integer or string)
WARNING: Waiting 6 sec...
ERROR: Test failed: Request failed for: /?delimiter=%2F

පැටවීම පරීක්ෂා කිරීම

1GB ගොනුවක් සාදන්න

fallocate -l 1GB 1gb

එය Leofs වෙත උඩුගත කරන්න

time s3cmd put 1gb s3://leofs/
real    0m19.099s
user    0m7.855s
sys 0m1.620s

සංඛ්‍යාලේඛන

1 node එකක් සඳහා leofs-adm du:

leofs-adm du [email protected]
 active number of objects: 156
  total number of objects: 156
   active size of objects: 602954495
    total size of objects: 602954495
     ratio of active size: 100.0%
    last compaction start: ____-__-__ __:__:__
      last compaction end: ____-__-__ __:__:__

නිගමනය එතරම් තොරතුරු සහිත නොවන බව අපට පෙනේ.

මෙම ගොනුව පිහිටා ඇත්තේ කොහේදැයි බලමු.
leofs-adm whichis leofs/1gb

leofs-adm whereis leofs/1gb
-------+----------------------+--------------------------------------+------------+--------------+----------------+----------------+----------------+----------------------------
 del?  |         node         |             ring address             |    size    |   checksum   |  has children  |  total chunks  |     clock      |             when            
-------+----------------------+--------------------------------------+------------+--------------+----------------+----------------+----------------+----------------------------
       | [email protected]      | 657a9f3a3db822a7f1f5050925b26270     |    976563K |   a4634eea55 | true           |             64 | 598f2aa976a4f  | 2019-12-05 10:48:15 +0000
       | [email protected]      | 657a9f3a3db822a7f1f5050925b26270     |    976563K |   a4634eea55 | true           |             64 | 598f2aa976a4f  | 2019-12-05 10:48:15 +0000

NFS සක්රිය කරන්න

අපි ලියෝ ගේට්වේ 172.26.9.184 සේවාදායකයේ NFS සක්‍රිය කරමු.

සේවාදායකය සහ සේවාදායකයා මත nfs-utils ස්ථාපනය කරන්න

sudo yum install nfs-utils

උපදෙස් අනුව, අපි වින්යාස ගොනුව නිවැරදි කරන්නෙමු /usr/local/leofs/current/leo_gateway/etc/leo_gateway.conf

protocol = nfs

172.26.9.184 සේවාදායකයේ rpcbind සහ leofs-gateway ධාවනය කරන්න

sudo service rpcbind start
sudo service leofs-gateway restart

leo_manager ක්‍රියාත්මක වන සේවාදායකයේ, NFS සඳහා බාල්දියක් සාදා NFS වෙත සම්බන්ධ වීමට යතුරක් ජනනය කරන්න.

leofs-adm add-bucket test 05236
leofs-adm gen-nfs-mnt-key test 05236 ip-адрес-nfs-клиента

NFS වෙත සම්බන්ධ වෙමින්

sudo mkdir /mnt/leofs
## for Linux - "sudo mount -t nfs -o nolock <host>:/<bucket>/<token> <dir>"
sudo mount -t nfs -o nolock ip-адрес-nfs-сервера-там-где-у-вас-установлен-gateway:/bucket/access_key_id/ключ-полученный-от-gen-nfs-mnt-key /mnt/leofs
sudo mount -t nfs -o nolock 172.26.9.184:/test/05236/bb5034f0c740148a346ed663ca0cf5157efb439f /mnt/leofs

NFS සේවාලාභියා හරහා තැටි ඉඩ බලන්න

තැටි ඉඩ, සෑම ගබඩා නෝඩයකටම 40GB තැටියක් ඇති බව සැලකිල්ලට ගනිමින් (ධාවන නෝඩ් 3 ක්, අමුණා ඇති නෝඩයක්):

df -hP
Filesystem                                                         Size  Used Avail Use% Mounted on
172.26.9.184:/test/05236/e7298032e78749149dd83a1e366afb328811c95b   60G  3.6G   57G   6% /mnt/leofs

ගබඩා නෝඩ් 6 ක් සහිත LeoFS ස්ථාපනය කිරීම.

ඉන්වෙන්ටරි (ඉදිකරන්නෙකු නොමැතිව):

# Please check roles/common/vars/leofs_releases for available versions
[all:vars]
leofs_version=1.4.3
build_temp_path="/tmp/leofs_builder"
build_install_path="/tmp/"
build_branch="master"
source="package"

# nodename of leo_manager_0 and leo_manager_1 are set at group_vars/all
[leo_manager_0]
172.26.9.177

# nodename of leo_manager_0 and leo_manager_1 are set at group_vars/all
[leo_manager_1]
172.26.9.176

[leo_storage]
172.26.9.178 [email protected]
172.26.9.179 [email protected]
172.26.9.181 [email protected]
172.26.9.182 [email protected]
172.26.9.183 [email protected]
172.26.9.185 [email protected]

[leo_gateway]
172.26.9.180 [email protected]
172.26.9.184 [email protected]

[leofs_nodes:children]
leo_manager_0
leo_manager_1
leo_gateway
leo_storage

ප්‍රතිදානය leofs-adm තත්ත්වය

ප්‍රතිදානය leofs-adm තත්ත්වය

 [System Confiuration]
-----------------------------------+----------
 Item                              | Value    
-----------------------------------+----------
 Basic/Consistency level
-----------------------------------+----------
                    system version | 1.4.3
                        cluster Id | leofs_1
                             DC Id | dc_1
                    Total replicas | 2
          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 | d8ff465e
                previous ring-hash | d8ff465e
-----------------------------------+----------

 [State of Node(s)]
-------+----------------------+--------------+---------+----------------+----------------+----------------------------
 type  |         node         |    state     | rack id |  current ring  |   prev ring    |          updated at         
-------+----------------------+--------------+---------+----------------+----------------+----------------------------
  S    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:29 +0000
  S    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:29 +0000
  S    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:30 +0000
  S    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:29 +0000
  S    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:29 +0000
  S    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:29 +0000
  G    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:31 +0000
  G    | [email protected]      | running      |         | d8ff465e       | d8ff465e       | 2019-12-06 05:18:31 +0000
-------+----------------------+--------------+---------+----------------+----------------+----------------------------

තැටි ඉඩ, සෑම ගබඩා නෝඩයකටම 40GB තැටියක් ඇති බව සැලකිල්ලට ගනිමින් (ධාවන නෝඩ් 6ක්):

df -hP
Filesystem                                                         Size  Used Avail Use% Mounted on
172.26.9.184:/test/05236/e7298032e78749149dd83a1e366afb328811c95b  120G  3.6G  117G   3% /mnt/leofs

ගබඩා නෝඩ් 5 ක් භාවිතා කරන්නේ නම්

[leo_storage]
172.26.9.178 [email protected]
172.26.9.179 [email protected]
172.26.9.181 [email protected]
172.26.9.182 [email protected]
172.26.9.183 [email protected]

df -hP
172.26.9.184:/test/05236/e7298032e78749149dd83a1e366afb328811c95b  100G  3.0G   97G   3% /mnt/leofs

සටහන්

ලඝු-සටහන් නාමාවලි තුළ පිහිටා ඇත /usr/local/leofs/current/*/log

ටෙලිග්‍රාම් නාලිකාව: SDS සහ Cluster FS

මූලාශ්රය: www.habr.com

අදහස් එක් කරන්න