CentOS Stream 9
Sponsored Link

OpenStack Zed : Configure Swift (Storage Node)2022/11/11

 
Configure OpenStack Object Storage (Swift).
This example is based on the environment like follows.
------------+-----------------------------+---------------+---
            |                             |               |
        eth0|10.0.0.30                eth0|10.0.0.50      |
+-----------+-----------+     +-----------+-----------+   |
|   [ dlp.srv.world ]   |     | [ network.srv.world ] |   |
|     (Control Node)    |     |      (Proxy Node)     |   |
|                       |     |                       |   |
|  MariaDB    RabbitMQ  |     |      Swift Proxy      |   |
|  Memcached  Nginx     |     |         Nginx         |   |
|  Keystone   httpd     |     |                       |   |
+-----------------------+     +-----------------------+   |
                                                          |
------------+-----------------------------+---------------+-------------+-----------
        eth0|10.0.0.71                eth0|10.0.0.72                eth0|10.0.0.73
+-----------+-----------+     +-----------+-----------+     +-----------+-----------+
|  [snode01.srv.world]  |     |  [snode02.srv.world]  |     |  [snode03.srv.world]  |
|    (Storage Node#1)   |     |    (Storage Node#2)   |     |    (Storage Node#3)   |
|                       |     |                       |     |                       |
|     Swift-Account     |     |     Swift-Account     |     |     Swift-Account     |
|    Swift-Container    |     |    Swift-Container    |     |    Swift-Container    |
|     Swift-Object      |     |     Swift-Object      |     |     Swift-Object      |
+-----------------------+     +-----------------------+     +-----------------------+

 
Configure Storage Node on this section.
It's OK to set the same settings mostly on all Storage Nodes, but only IP address are different each other.
For the storage partition, it needs enough size of free area on disks to create new partitions.
[1] On all Storage Nodes, Configure OpenStack Zed repository first like here of [3] and Install Swift-Account, Swift-Container, Swift-Object and others on all Storage Node like follows.
# install from Zed, EPEL, CRB

[root@snode01 ~]#
dnf --enablerepo=centos-openstack-zed,epel,crb -y install openstack-swift-account openstack-swift-container openstack-swift-object openstack-selinux xfsprogs rsync rsync-daemon openssh-clients
[2] Format free space of disk ([/dev/sdb1] on this example) with XFS and mount on [/srv/node/device] on all Storage Node like follows.
[root@snode01 ~]#
mkfs.xfs /dev/sdb1

meta-data=/dev/sdb1              isize=512    agcount=4, agsize=5242816 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=1 inobtcount=1
data     =                       bsize=4096   blocks=20971264, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=10239, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.

[root@snode01 ~]#
mkdir -p /srv/node/device

[root@snode01 ~]#
mount -o noatime,nodiratime /dev/sdb1 /srv/node/device

[root@snode01 ~]#
chown -R swift. /srv/node
[root@snode01 ~]#
blkid | grep sdb1

/dev/sdb1: UUID="612cfcdd-a2ff-441e-9f64-3b61b5280804" TYPE="xfs" PARTUUID="bc0f8b5e-01"
[root@snode01 ~]#
vi /etc/fstab
# add to the end

UUID=612cfcdd-a2ff-441e-9f64-3b61b5280804 /srv/node/device xfs defaults,noatime,nodiratime 0 0
[3] Copy Swift Ring files from the Swift Proxy Node to all Storage Nodes.
[root@network ~]#
scp /etc/swift/*.gz 10.0.0.71:/etc/swift/

account.ring.gz                    100% 3912     3.8KB/s   00:00
container.ring.gz                  100% 3904     3.8KB/s   00:00
object.ring.gz                     100% 3895     3.8KB/s   00:00
[4] Configure Swift and Rsync on all Storage Nodes.
[root@snode01 ~]#
chown swift. /etc/swift/*.gz

[root@snode01 ~]#
vi /etc/swift/swift.conf
# set the value which is set on Proxy Node

[swift-hash]
swift_hash_path_suffix =
swift_shared_path
swift_hash_path_prefix = swift_shared_path
[root@snode01 ~]#
vi /etc/swift/account-server.conf
# line 6 : change

bind_ip =
0.0.0.0

bind_port = 6202
[root@snode01 ~]#
vi /etc/swift/container-server.conf
# line 6 : change

bind_ip =
0.0.0.0

bind_port = 6201
[root@snode01 ~]#
vi /etc/swift/object-server.conf
# line 6 : change

bind_ip =
0.0.0.0

bind_port = 6200
[root@snode01 ~]#
vi /etc/rsyncd.conf
# add to the end

pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
uid = swift
gid = swift
# specify the IP address of each storage node
address = 10.0.0.71

[account]
path            = /srv/node
read only       = false
write only      = no
list            = yes
incoming chmod  = 0644
outgoing chmod  = 0644
max connections = 25
lock file =     /var/lock/account.lock

[container]
path            = /srv/node
read only       = false
write only      = no
list            = yes
incoming chmod  = 0644
outgoing chmod  = 0644
max connections = 25
lock file =     /var/lock/container.lock

[object]
path            = /srv/node
read only       = false
write only      = no
list            = yes
incoming chmod  = 0644
outgoing chmod  = 0644
max connections = 25
lock file =     /var/lock/object.lock

[swift_server]
path            = /etc/swift
read only       = true
write only      = no
list            = yes
incoming chmod  = 0644
outgoing chmod  = 0644
max connections = 5
lock file =     /var/lock/swift_server.lock
[5] On Storage Node, if SELinux is enabled, change policy like follows.
[root@snode01 ~]#
setsebool -P domain_can_mmap_files on

[root@snode01 ~]#
semanage fcontext -a -t swift_data_t /srv/node/device

[root@snode01 ~]#
restorecon /srv/node/device
[6] On Storage Node, if Firewalld is running, allow service ports.
[root@snode01 ~]#
firewall-cmd --add-port={873/tcp,6200/tcp,6201/tcp,6202/tcp}

success
[root@snode01 ~]#
firewall-cmd --runtime-to-permanent

success
[7] Start Swift services.
[root@snode01 ~]#
systemctl enable --now rsyncd \
openstack-swift-account-auditor \
openstack-swift-account-replicator \
openstack-swift-account \
openstack-swift-container-auditor \
openstack-swift-container-replicator \
openstack-swift-container-updater \
openstack-swift-container \
openstack-swift-object-auditor \
openstack-swift-object-replicator \
openstack-swift-object-updater \
openstack-swift-object

Matched Content