Quantcast
Channel: Lingesh, Author at UnixArena
Viewing all articles
Browse latest Browse all 369

Openstack – Create Initial Rings – Object Storage – Part 16

$
0
0

This article will demonstrates that how to create the initial account, container, and object rings. These rings creates configuration files that each node uses to determine and deploy the storage architecture. The account server uses the account ring to maintain lists of containers. The container server uses the container ring to maintain lists of objects . The object server uses the object ring to maintain lists of object locations on local devices. For tutorial simplicity, we will deploy in one region and zone with 1024 maximum partitions, 3 replicas of each object, and 1 hour minimum time between moving a partition more than once. For Object Storage, a partition indicates a directory on a storage device rather than a conventional partition table.

NOTE: Here My storage node IP is 192.168.203.133.

Create the  Account ring:

 

1.Login to the  openstack controller node.

2.Navigate to /etc/swift directory.

root@OSCTRL-UA:~# cd /etc/swift/
root@OSCTRL-UA:/etc/swift# ls -lrt
total 28
-rw-r--r-- 1 root root 24807 Oct 21 10:59 proxy-server.conf
root@OSCTRL-UA:/etc/swift#

 

3.Create the base account.builder file.

root@OSCTRL-UA:/etc/swift# swift-ring-builder account.builder create 10 3 1
root@OSCTRL-UA:/etc/swift# ls -lrt
total 36
-rw-r--r-- 1 root root 24807 Oct 21 10:59 proxy-server.conf
drwxr-xr-x 2 root root  4096 Oct 22 06:38 backups
-rw-r--r-- 1 root root   236 Oct 22 06:38 account.builder
root@OSCTRL-UA:/etc/swift#

 

4. Add the storage node to the ring.

root@OSCTRL-UA:/etc/swift# swift-ring-builder account.builder add r1z1-192.168.203.133:6002/sdc1 100
Device d0r1z1-192.168.203.133:6002R192.168.203.133:6002/sdc1_"" with 100.0 weight got id 0
root@OSCTRL-UA:/etc/swift#

IP – Storage Node IP
Disk – Object storage Mount point disk
Weight – 100

 

5.Verify the rings contents.

root@OSCTRL-UA:/etc/swift# swift-ring-builder account.builder
account.builder, build version 1
1024 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1 192.168.203.133  6002 192.168.203.133              6002      sdc1 100.00          0 -100.00
root@OSCTRL-UA:/etc/swift#

 

6.Re-Balance the account rings.

root@OSCTRL-UA:/etc/swift# swift-ring-builder account.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00.
root@OSCTRL-UA:/etc/swift#

 

Create the Container ring:

 

1.Login to the controller node.

2. Navigate to the /etc/swift directory.

3.Create the base container ring.

root@OSCTRL-UA:/etc/swift# swift-ring-builder container.builder create 10 3 1
root@OSCTRL-UA:/etc/swift# ls -lrt
total 52
-rw-r--r-- 1 root root 24807 Oct 21 10:59 proxy-server.conf
-rw-r--r-- 1 root root   206 Oct 22 06:44 account.ring.gz
-rw-r--r-- 1 root root  8700 Oct 22 06:44 account.builder
-rw-r--r-- 1 root root   236 Oct 22 06:46 container.builder
drwxr-xr-x 2 root root  4096 Oct 22 06:46 backups
root@OSCTRL-UA:/etc/swift#

 

4.Add the storage node to the ring.

root@OSCTRL-UA:/etc/swift# swift-ring-builder container.builder add r1z1-192.168.203.133:6001/sdc1 100
Device d0r1z1-192.168.203.133:6001R192.168.203.133:6001/sdc1_"" with 100.0 weight got id 0
root@OSCTRL-UA:/etc/swift#

 

5.Verify the container ring contents.

root@OSCTRL-UA:/etc/swift# swift-ring-builder container.builder
container.builder, build version 1
1024 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1 192.168.203.133  6001 192.168.203.133              6001      sdc1 100.00          0 -100.00
root@OSCTRL-UA:/etc/swift#

 

6.Re-Balance the container ring and verify it.

root@OSCTRL-UA:/etc/swift# swift-ring-builder container.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00.
root@OSCTRL-UA:/etc/swift# swift-ring-builder container.builder
container.builder, build version 1
1024 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1 192.168.203.133  6001 192.168.203.133              6001      sdc1 100.00       3072    0.00
root@OSCTRL-UA:/etc/swift#

 

Create the Object ring:

 

1. Login to the Controller Node.

2. Navigate to the /etc/swift directory.

3. Create the base object.builder file .

root@OSCTRL-UA:/etc/swift# swift-ring-builder object.builder create 10 3 1
root@OSCTRL-UA:/etc/swift# ls -lrt
total 68
-rw-r--r-- 1 root root 24807 Oct 21 10:59 proxy-server.conf
-rw-r--r-- 1 root root   206 Oct 22 06:44 account.ring.gz
-rw-r--r-- 1 root root  8700 Oct 22 06:44 account.builder
-rw-r--r-- 1 root root   208 Oct 22 06:48 container.ring.gz
-rw-r--r-- 1 root root  8700 Oct 22 06:48 container.builder
-rw-r--r-- 1 root root   236 Oct 22 06:50 object.builder
drwxr-xr-x 2 root root  4096 Oct 22 06:50 backups
root@OSCTRL-UA:/etc/swift#

 

4.Add the storage node to the object ring.

root@OSCTRL-UA:/etc/swift# swift-ring-builder object.builder add r1z1-192.168.203.133:6000/sdc1 100
Device d0r1z1-192.168.203.133:6000R192.168.203.133:6000/sdc1_"" with 100.0 weight got id 0
root@OSCTRL-UA:/etc/swift#

 

5. Verify the object ring contents.

root@OSCTRL-UA:/etc/swift# swift-ring-builder object.builder
object.builder, build version 1
1024 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1 192.168.203.133  6000 192.168.203.133              6000      sdc1 100.00          0 -100.00
root@OSCTRL-UA:/etc/swift#

 

6. Re-Balance the Object ring and verify it.

root@OSCTRL-UA:/etc/swift# swift-ring-builder object.builder rebalance
Reassigned 1024 (100.00%) partitions. Balance is now 0.00.
root@OSCTRL-UA:/etc/swift# swift-ring-builder object.builder
object.builder, build version 1
1024 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
             0       1     1 192.168.203.133  6000 192.168.203.133              6000      sdc1 100.00       3072    0.00
root@OSCTRL-UA:/etc/swift#

 

Distribute ring configuration files to the Storage Nodes:

root@OSCTRL-UA:/etc/swift# scp -r account.ring.gz container.ring.gz object.ring.gz root@192.168.203.133:/etc/swift/
account.ring.gz                                                                                                                    100%  206     0.2KB/s   00:00
container.ring.gz                                                                                                                  100%  208     0.2KB/s   00:00
object.ring.gz                                                                                                                     100%  204     0.2KB/s   00:00
root@OSCTRL-UA:/etc/swift#

 

Configure the default storage Policy:

 

1. Login to the controller node.

2. Navigate to the /etc/swift directory

3. Download the sample swift configuration file from internet source.

root@OSCTRL-UA:/etc/swift# curl -o /etc/swift/swift.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/swift.conf-sample
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4763  100  4763    0     0   1381      0  0:00:03  0:00:03 --:--:--  1381
root@OSCTRL-UA:/etc/swift# ls -lrt /etc/swift/swift.conf
-rw-r--r-- 1 root root 4763 Oct 22 06:56 /etc/swift/swift.conf
root@OSCTRL-UA:/etc/swift#

 

4. Edit the /etc/swift/swift.conf file and update the following sections.

In the [swift-hash] section,

[swift-hash]
swift_hash_path_suffix = swifthash123
swift_hash_path_prefix = swifthash123

Note: Keep this values secret and do not lose it.

In [storage-ploicy:0] section,

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

 

5. Copy the /etc/swift/swift.conf file to the storage nodes.

root@OSCTRL-UA:/etc/swift# scp -r /etc/swift/swift.conf root@192.168.203.133:/etc/swift/
swift.conf                                                                                                                         100% 4771     4.7KB/s   00:00
root@OSCTRL-UA:/etc/swift#

 

6. Change the ownership of /etc/swift/swift.conf in storage node.

root@OSCTRL-UA:/etc/swift# ssh root@192.168.203.133 chown -R swift:swift /etc/swift
root@OSCTRL-UA:/etc/swift# ssh root@192.168.203.133 ls -ld /etc/swift
drwxr-xr-x 2 swift swift 4096 Oct 22 07:04 /etc/swift
root@OSCTRL-UA:/etc/swift# ssh root@192.168.203.133 ls -lrt /etc/swift
total 48
-rw-r--r-- 1 swift swift  6126 Oct 22 05:26 account-server.conf
-rw-r--r-- 1 swift swift  6398 Oct 22 05:29 container-server.conf
-rw-r--r-- 1 swift swift 10021 Oct 22 05:42 object-server.conf
-rw-r--r-- 1 swift swift   204 Oct 22 06:54 object.ring.gz
-rw-r--r-- 1 swift swift   208 Oct 22 06:54 container.ring.gz
-rw-r--r-- 1 swift swift   206 Oct 22 06:54 account.ring.gz
-rw-r--r-- 1 swift swift  4771 Oct 22 07:04 swift.conf
root@OSCTRL-UA:/etc/swift#

 

7. Restart the proxy service and it’s dependence service.

root@OSCTRL-UA:/var/log# service memcached restart
Restarting memcached: memcached.
root@OSCTRL-UA:/var/log# service swift-proxy restart
swift-proxy stop/waiting
swift-proxy start/running
root@OSCTRL-UA:/var/log#

 

8. Login to the Storage node and restart the swift services.

root@OSSTG-UA:/# swift-init all start
container-updater running (21255 - /etc/swift/container-server.conf)
container-updater already started...
account-auditor running (21256 - /etc/swift/account-server.conf)
account-auditor already started...
object-replicator running (21257 - /etc/swift/object-server.conf)
object-replicator already started...
container-sync running (21258 - /etc/swift/container-server.conf)
container-sync already started...
container-replicator running (21259 - /etc/swift/container-server.conf)
container-replicator already started...
object-auditor running (21260 - /etc/swift/object-server.conf)
object-auditor already started...
Unable to locate config for object-expirer
container-auditor running (21261 - /etc/swift/container-server.conf)
container-auditor already started...
container-server running (21262 - /etc/swift/container-server.conf)
container-server already started...
object-server running (21263 - /etc/swift/object-server.conf)
object-server already started...
account-reaper running (21264 - /etc/swift/account-server.conf)
account-reaper already started...
Unable to locate config for proxy-server
account-replicator running (21265 - /etc/swift/account-server.conf)
account-replicator already started...
object-updater running (21268 - /etc/swift/object-server.conf)
object-updater already started...
Unable to locate config for container-reconciler
account-server running (21269 - /etc/swift/account-server.conf)
account-server already started...
root@OSSTG-UA:/var/log#

 

Verify the Swift Object Storage Configuration:

1.Login to the controller node.

2.Source the tenant credentials for CLI.

root@OSCTRL-UA:~# cat lingesh.rc
export OS_USERNAME=lingesh
export OS_PASSWORD=ling123
export OS_TENANT_NAME=lingesh
export OS_AUTH_URL=http://OSCTRL-UA:35357/v2.0
root@OSCTRL-UA:~# source lingesh.rc
root@OSCTRL-UA:~#

 

3. Verify the swift service status.

root@OSCTRL-UA:~# swift stat
        Account: AUTH_abe3af30f46b446fbae35a102457890c
     Containers: 0
        Objects: 0
          Bytes: 0
   Content-Type: text/plain; charset=utf-8
    X-Timestamp: 1445479602.24665
     X-Trans-Id: tx82cd48b76d954ff581b35-00562844b2
X-Put-Timestamp: 1445479602.24665
root@OSCTRL-UA:~#

 

4. Upload the file to swift storage.

root@OSCTRL-UA:~# swift upload lingesh.container lingesh.pem
lingesh.pem
root@OSCTRL-UA:~# swift list
lingesh.container
root@OSCTRL-UA:~#

Here we have uploaded lingesh.pem file to  lingesh.container on  swift storage service.

 

5. Let’s download the uploaded file. Here we are downloading the file from “lingesh.container” to current directory.

root@OSCTRL-UA:~# swift download lingesh.container lingesh.pem
lingesh.pem [auth 0.172s, headers 0.194s, total 0.194s, 0.077 MB/s]
root@OSCTRL-UA:~#

Awesome. It works.

 

Now your openstack environment has the Object storage service.

The post Openstack – Create Initial Rings – Object Storage – Part 16 appeared first on UnixArena.


Viewing all articles
Browse latest Browse all 369

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>