S3၊ NFS သုံးသော client များနှင့် တွဲဖက်အသုံးပြုနိုင်သော ဖြန့်ဝေထားသော အမှား-ခံနိုင်ရည်ရှိသော LeoFS အရာဝတ္ထုသိုလှောင်မှုကို တပ်ဆင်ခြင်း။

အတိုင်း Opennet: LeoFS — အမှား-ခံနိုင်ရည်ရှိသော အရာဝတ္ထု သိုလှောင်မှုကို ဖြန့်ဝေသည်။ LeoFSAmazon S3 API နှင့် REST-API ကို အသုံးပြုသည့် ဖောက်သည်များနှင့် တွဲဖက်အသုံးပြုနိုင်ပြီး NFS ဆာဗာမုဒ်ကိုလည်း ပံ့ပိုးပေးသည်။ သေးငယ်သည်နှင့် အလွန်ကြီးသော အရာဝတ္ထုများကို သိမ်းဆည်းရန် အကောင်းဆုံးဖြစ်အောင် လုပ်ဆောင်မှုများ ရှိပြီး တပ်ဆင်ထားသော ကက်ရှ်ယန္တရား ပါရှိပြီး ဒေတာစင်တာများကြား သိုလှောင်မှု ထပ်တူပြုခြင်း ဖြစ်နိုင်သည်။ ပရောဂျက်၏ ရည်မှန်းချက်များတွင် ထပ်နေသော ထပ်နေသောပုံတူပွားမှုများမှတစ်ဆင့် ယုံကြည်စိတ်ချရမှု 99.9999999% ရရှိစေရန်နှင့် ကျရှုံးမှုအမှတ်တစ်ခုတည်းကို ဖယ်ရှားပစ်ရန် ပါဝင်သည်။ ပရောဂျက်ကုဒ်ကို Erlang ဖြင့် ရေးသားထားသည်။

LeoFS တွင် အစိတ်အပိုင်း သုံးခု ပါဝင်ပါသည်။

  • LeoFS သိုလှောင်မှု — အရာဝတ္ထုများနှင့် မက်တာဒေတာများကို ပေါင်းထည့်ခြင်း၊ ပြန်လည်ရယူခြင်းနှင့် ဖျက်ခြင်းလုပ်ငန်းများကို လုပ်ဆောင်ပေးခြင်း၊ ကူးယူဖော်ပြခြင်း၊ ပြန်လည်ရယူခြင်းနှင့် သုံးစွဲသူတောင်းဆိုမှုများကို တန်းစီစောင့်ဆိုင်းခြင်းအတွက် တာဝန်ရှိသည်။
  • LeoFS Gateway — HTTP တောင်းဆိုမှုများကို လုပ်ဆောင်ပြီး REST-API သို့မဟုတ် S3-API ကို အသုံးပြု၍ သုံးစွဲသူများထံ တုံ့ပြန်မှုများကို ပြန်လည်လမ်းညွှန်ပေးကာ၊ မှတ်ဉာဏ်နှင့် ဒစ်ခ်တွင် အလိုအပ်ဆုံးဒေတာများကို သိမ်းဆည်းခြင်းကို သေချာစေသည်။
  • LeoFS မန်နေဂျာ — LeoFS Gateway နှင့် LeoFS Storage node များ၏ လည်ပတ်မှုကို စောင့်ကြည့်သည်၊ nodes များ၏ အခြေအနေကို စောင့်ကြည့်ပြီး checksums များကို စစ်ဆေးသည်။ ဒေတာခိုင်မာမှုနှင့် မြင့်မားသောသိုလှောင်မှုရရှိနိုင်မှုကို အာမခံပါသည်။

ဤပို့စ်တွင် ကျွန်ုပ်တို့သည် ansible-playbook နှင့် S3, NFS ကို အသုံးပြု၍ Leofs ကို ထည့်သွင်းပါမည်။

တရားဝင် Playbooks များကို အသုံးပြု၍ LeoFS ကို ထည့်သွင်းရန် ကြိုးစားပါက၊ သင်သည် အမျိုးမျိုးသော အမှားအယွင်းများကို ကြုံတွေ့ရလိမ့်မည်- 1,2. ဒီပို့စ်မှာ ဒီလိုအမှားတွေမဖြစ်အောင် လုပ်သင့်တာတွေကို ရေးပေးပါမယ်။

သင် ansible-playbook ကို run မည့်နေရာတွင် 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

ustanovka 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

အသုံးပြုသူတစ်ဦးကို ဖန်တီးခြင်းဖြင့် ၎င်းကို ဘီးအဖွဲ့သို့ ပေါင်းထည့်သည်။

    - 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

မူလတန်းနှင့် အလယ်တန်းကို ansible-playbook မှတ်တမ်းများတွင် တွေ့မြင်နိုင်သည်။

S3၊ NFS သုံးသော client များနှင့် တွဲဖက်အသုံးပြုနိုင်သော ဖြန့်ဝေထားသော အမှား-ခံနိုင်ရည်ရှိသော LeoFS အရာဝတ္ထုသိုလှောင်မှုကို တပ်ဆင်ခြင်း။

S3၊ NFS သုံးသော client များနှင့် တွဲဖက်အသုံးပြုနိုင်သော ဖြန့်ဝေထားသော အမှား-ခံနိုင်ရည်ရှိသော 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

Bucket တစ်ခုဖန်တီးပါ။

ရေပုံးလုပ်တယ်။

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 error: 403 (AccessDenied): Access Denied:

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 သည် False ဖြစ်ပါက၊ ဤကဲ့သို့သော error တစ်ခုရှိလိမ့်မည်-

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

Load စမ်းသပ်ခြင်း။

1GB ဖိုင်တစ်ခုဖန်တီးပါ။

fallocate -l 1GB 1gb

၎င်းကို Leofs သို့ အပ်လုဒ်လုပ်ပါ။

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

စာရင်းအင်း

node 1 အတွက် 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 ဘယ်မှာ 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 ကို အသက်သွင်းပါ။

ကျွန်ုပ်တို့သည် Leo Gateway 172.26.9.184 ဆာဗာတွင် NFS ကို စတင်အသုံးပြုပါသည်။

ဆာဗာနှင့် client တွင် nfs-utils ကို ထည့်သွင်းပါ။

sudo yum install nfs-utils

ညွှန်ကြားချက်များအရ၊ ကျွန်ုပ်တို့သည် configuration file ကိုပြင်ပေးပါမည်။ /usr/local/leofs/current/leo_gateway/etc/leo_gateway.conf

protocol = nfs

ဆာဗာ 172.26.9.184 တွင် rpcbind နှင့် leofs-gateway ကို run သည်

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 client မှတဆင့် disk space ကိုကြည့်ရှုပါ။

သိုလှောင်မှု node တစ်ခုစီတွင် 40GB ဒစ်ခ် (အသုံးပြုနေသော လမ်းကြောင်း 3 ခု၊ တွဲဆက်ထားသည့် node 1 ခု) ကို ထည့်သွင်းစဉ်းစား၍ ဒစ်ခ်နေရာလွတ်၊

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

သိုလှောင်မှုအမှတ် ၆ ဖြင့် 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
-------+----------------------+--------------+---------+----------------+----------------+----------------------------

သိုလှောင်မှု node တစ်ခုစီတွင် 40GB ဒစ်ခ် (6 ခုလည်ပတ်နေသော node XNUMX ခုပါရှိသည်) ကို ထည့်သွင်းစဉ်းစား၍ Disk space ၊

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

အကယ်၍ 5 storage node ကိုသုံးပါ။

[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

source: www.habr.com

မှတ်ချက် Add