Swift Concepts

السلام عليكم ورحمة الله وبركاته 

.نتحدث اليوم عن الجزء النظري او المصطلحات قبل اكمال الاعدادات swift  مواصلة في شرح ال

:بعض المصطلحات التي ستقابلنا 

 الشرح مبسط قدر الامكان

PS: It’s not servers it’s service but they used to call it server in the docs, so we go on using server term

Proxy Server:

 Proxy Server لا يتم التعامل مع وحدة التخزين مباشرة بل عن طريق ال Http requests هو المسئول عن استقبال والرد على 

Can be standalone VM or Installed in the Controller node, depends on your scenario.

Account Server:

 Containers  هي قاعدة بيانات تحوي ال

Container Server:

Objects قاعدة بيانات تحتوي على  اسماء Account server ايضا ك 

Object Server :

Objects يتم تخيزن الملفات فيها او 

 

Ring :

Objects هي تمثيل منطقي لكيفة تخزين ال

in which account which container and which disk where the Object is stored

سنتطرق لها لاحقا

: نكمل في اكمال التثبيت

 

Create and distribute initial rings:

تذكير قبل انا نبدأ

Assuming we have 2 VMs and each VMs has 2 Others HDD (SDB/SDC) 

We are running the proxy service on Controller node.

Ring كما ذكرنا سابقا لابد من انشاء الحلقات 

:الصيغة العامة لأمر انشاء الحلقات هي 

swift-ring-builder <builder_file> create <part_power> <replicas> <min_part_hours>

<builder_file>     

إسم الملف الذي سيتم إنشاؤه 

<part_power

Partitions هي القيمة التي يكون العدد 2 مرفوعا لها لإنشاء اقصى عدد من 

 

<replicas>

Object عدد النسخ الإحتياطية المراد إنشاؤها لكل 

<min_part_hours

is the time in hours before a specific partition can be moved in succession

 

Create rings:

Change to the /etc/swift directory.

1.Account ring:

Create the base account.builder file:

swift-ring-builder account.builder create 10 3 1

يعني ان العدد 2 مرفوع للرقم 10  مما يعطي 1024 

Add each storage node to the ring:

 swift-ring-builder account.builder add \
  --region 1 --zone 1 --ip 10.0.0.51 --port 6202 --device sdb --weight 100

 swift-ring-builder account.builder add \
  --region 1 --zone 1 --ip 10.0.0.51 --port 6202 --device sdc --weight 100

 swift-ring-builder account.builder add \
  --region 1 --zone 2 --ip 10.0.0.52 --port 6202 --device sdb --weight 100

 swift-ring-builder account.builder add \
  --region 1 --zone 2 --ip 10.0.0.52 --port 6202 --device sdc --weight 100


Change IP to your IP and Device with Your disks name

Verify the ring contents:

swift-ring-builder account.builder

output like:

account.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
The minimum number of hours before a partition can be reassigned is 1
The overload factor is 0.00% (0.000000)
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1       10.0.0.51  6202       10.0.0.51              6202      sdb  100.00          0 -100.00
             1       1     1       10.0.0.51  6202       10.0.0.51              6202      sdc  100.00          0 -100.00
             2       1     2       10.0.0.52  6202       10.0.0.52              6202      sdb  100.00          0 -100.00
             3       1     2       10.0.0.52  6202       10.0.0.52              6202      sdc  100.00          0 -100.00

Rebalance the ring:

 swift-ring-builder account.builder rebalance

2.Create container ring:

Change to the /etc/swift directory.

Create the base container.builder file:

 swift-ring-builder container.builder create 10 3 1

Add each storage node to the ring

 swift-ring-builder container.builder add \
  --region 1 --zone 1 --ip 10.0.0.51 --port 6201 --device sdb --weight 100
swift-ring-builder container.builder add \ --region 1 --zone 1 --ip 10.0.0.51 --port 6201 --device sdc --weight 100 swift-ring-builder container.builder add \ --region 1 --zone 2 --ip 10.0.0.52 --port 6201 --device sdb --weight 100 swift-ring-builder container.builder add \ --region 1 --zone 2 --ip 10.0.0.52 --port 6201 --device sdc --weight 100

Verify the ring contents:

 swift-ring-builder container.builder

Output:

container.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
The minimum number of hours before a partition can be reassigned is 1
The overload factor is 0.00% (0.000000)
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1       10.0.0.51  6201       10.0.0.51              6201      sdb  100.00          0 -100.00
             1       1     1       10.0.0.51  6201       10.0.0.51              6201      sdc  100.00          0 -100.00
             2       1     2       10.0.0.52  6201       10.0.0.52              6201      sdb  100.00          0 -100.00
             3       1     2       10.0.0.52  6201       10.0.0.52              6201      sdc  100.00          0 -100.00

Rebalance the ring:

 swift-ring-builder container.builder rebalance

3.Create object ring:

   Change to the /etc/swift directory.

   Create the base object.builder file:

 swift-ring-builder object.builder create 10 3 1

  Add each storage node to the ring:

 swift-ring-builder object.builder add \
  --region 1 --zone 1 --ip 10.0.0.51 --port 6200 --device sdb --weight 100
 swift-ring-builder object.builder add \
  --region 1 --zone 1 --ip 10.0.0.51 --port 6200 --device sdc --weight 100
 swift-ring-builder object.builder add \
  --region 1 --zone 2 --ip 10.0.0.52 --port 6200 --device sdb --weight 100
 swift-ring-builder object.builder add \
  --region 1 --zone 2 --ip 10.0.0.52 --port 6200 --device sdc --weight 100

Verify the ring contents:

 swift-ring-builder object.builder

object.builder, build version 4
1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion The minimum number of hours before a partition can be reassigned is 1 The overload factor is 0.00% (0.000000) Devices: id region zone ip address port replication ip replication port name weight partitions balance meta 0 1 1 10.0.0.51 6200 10.0.0.51 6200 sdb 100.00 0 -100.00 1 1 1 10.0.0.51 6200 10.0.0.51 6200 sdc 100.00 0 -100.00 2 1 2 10.0.0.52 6200 10.0.0.52 6200 sdb 100.00 0 -100.00 3 1 2 10.0.0.52 6200 10.0.0.52 6200 sdc 100.00 0 -100.00

Rebalance the ring:

 swift-ring-builder object.builder rebalance

Distribute ring configuration files:

Copy the account.ring.gzcontainer.ring.gz, and object.ring.gz files to the /etc/swift directory on each storage node and any additional nodes running the proxy service.

 

Finalize installation:

On Controller node:

Obtain the /etc/swift/swift.conf file from the Object Storage source repository:

 curl -o /etc/swift/swift.conf \
  https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample?h=stable/queens

Edit the /etc/swift/swift.conf file and complete the following actions:

  • In the [swift-hash] section, configure the hash path prefix and suffix for your environment.

    [swift-hash]
    ...
    swift_hash_path_suffix = HASH_PATH_SUFFIX
    swift_hash_path_prefix = HASH_PATH_PREFIX

     

Replace HASH_PATH_PREFIX and HASH_PATH_SUFFIX with unique values.

 

n the [storage-policy:0] section, configure the default storage policy:

[storage-policy:0]
...
name = Policy-0
default = yes

Copy the swift.conf file to the /etc/swift directory on each storage node and any additional nodes running the proxy service.

On all nodes, ensure proper ownership of the configuration directory:

 chown -R root:swift /etc/swift

On the controller node and any other nodes running the proxy service, start the Object Storage proxy service including its dependencies and configure them to start when the system boots:

 systemctl enable openstack-swift-proxy.service memcached.service
 systemctl start openstack-swift-proxy.service memcached.service

On the storage nodes, start the Object Storage services and configure them to start when the system boots:

 systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service \
  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
 systemctl start openstack-swift-account.service openstack-swift-account-auditor.service \
  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
 systemctl enable openstack-swift-container.service \
  openstack-swift-container-auditor.service openstack-swift-container-replicator.service \
  openstack-swift-container-updater.service
 systemctl start openstack-swift-container.service \
  openstack-swift-container-auditor.service openstack-swift-container-replicator.service \
  openstack-swift-container-updater.service
 systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service \
  openstack-swift-object-replicator.service openstack-swift-object-updater.service
 systemctl start openstack-swift-object.service openstack-swift-object-auditor.service \
  openstack-swift-object-replicator.service openstack-swift-object-updater.service

Verify operation:

On Controller node:

Source the admin credentials:

 . admin-openrc

Show the service status:

 swift stat

Create container1 container:

 openstack container create container1

Replace container1 with any name you like

Upload a test file to the container1 container:

 openstack object create container1 FILE

Replace FILE with the file you want to upload

 

List files in the container1 container:

 openstack object list container1

Download a test file from the container1 container:

 openstack object save container1 FILE

Swift Storgae Openstack نكون بعون الله وصلنا لختام ال

نترحم على شهداء ثورتنا المجدية ونرجو من الله ان يتقبلهم في عليين 

 نلقاكم في مقبل الدروس 

 

Leave a Reply