CentOS Stream 9
Sponsored Link

OpenStack Yoga : Swift 設定 (Storage ノード)2022/06/10

 
OpenStack Object Storage(Swift)を設定します。
当例では以下のような環境を例に Swift サービスを設定します。
------------+-----------------------------+---------------+---
            |                             |               |
        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  httpd     |     |                       |   |
|  Keystone             |     |                       |   |
+-----------------------+     +-----------------------+   |
                                                          |
------------+-----------------------------+---------------+-------------+-----------
        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      |
+-----------------------+     +-----------------------+     +-----------------------+

 
Storage ノードの設定をします。
Storage ノードは、基本的に台数分全て同じ設定で OK ですが、IP アドレスについては異なりますので、それぞれ注意して変更ください。
なお、当例では、Storage ノードとするサーバーにディスクを増設し、[/dev/sdb1] にパーティションを作成して設定しています。
[1] 全 Storage ノード で、こちらの [3] を参考に OpenStack Yoga リポジトリを設定した後、Swift-Account, Swift-Container, Swift-Object 等々をインストールします。
# Yoga, EPEL, CRB からインストール

[root@snode01 ~]#
dnf --enablerepo=centos-openstack-yoga,epel,crb -y install openstack-swift-account openstack-swift-container openstack-swift-object openstack-selinux xfsprogs rsync rsync-daemon openssh-clients
[2] 全 Storage ノード でディスクの空き領域を XFS でフォーマットし、[/srv/node] にマウントします。
[root@snode01 ~]#
mkfs.xfs -i size=1024 -s size=4096 /dev/sdb1

meta-data=/dev/vdb1              isize=1024   agcount=4, agsize=5242816 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=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=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[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 ~]#
vi /etc/fstab
# 最終行に追記

/dev/sdb1               /srv/node/device       xfs     noatime,nodiratime 0 0
[3] Proxy ノードから 全 Storage ノードへ Swift Ring ファイルをコピーします。
[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] 全 Storage ノードで Swift および Rsync の設定をします。
[root@snode01 ~]#
chown swift. /etc/swift/*.gz

[root@snode01 ~]#
vi /etc/swift/swift.conf
# プロキシノードに設定したものと同じ値

[swift-hash]
swift_hash_path_suffix =
swift_shared_path
swift_hash_path_prefix = swift_shared_path
[root@snode01 ~]#
vi /etc/swift/account-server.conf
# 6行目 : 変更

bind_ip =
0.0.0.0

bind_port = 6202
[root@snode01 ~]#
vi /etc/swift/container-server.conf
# 6行目 : 変更

bind_ip =
0.0.0.0

bind_port = 6201
[root@snode01 ~]#
vi /etc/swift/object-server.conf
# 6行目 : 変更

bind_ip =
0.0.0.0

bind_port = 6200
[root@snode01 ~]#
vi /etc/rsyncd.conf
# 最終行に追記

pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
uid = swift
gid = swift
# それぞれのノードの IP アドレスを指定
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] Storage ノードで SELinux を有効にしている場合は、ポリシーの変更が必要です。
[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] Storage ノードで Firewalld を有効にしている場合は、サービスポートの許可が必要です。
[root@snode01 ~]#
firewall-cmd --add-port={873/tcp,6200/tcp,6201/tcp,6202/tcp}

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

success
[7] 各サービスを起動します。
[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

関連コンテンツ