Ubuntu 16.04
Sponsored Link

OpenStack Mitaka (三鷹) : Swift 設定#3 ( Storage ノード )2016/06/08

 
OpenStack Object Storage(Swift)を設定します。
ここでは以下のように、Control ノード、Proxy ノード、Storage ノードと、 ノードごとにサーバーを用意して、計5台を使って設定します。
                                    |
     +------------------+           |           +-----------------+
     | [ Control Node ] |10.0.0.30  |  10.0.0.50|  [ Proxy Node ] |
     |     Keystone     |-----------+-----------|                 |
     +------------------+           |           +-----------------+
                                    |
        +---------------------------+--------------------------+
        |                           |                          |
        |10.0.0.71                  |10.0.0.72                 |10.0.0.73 
+-------+----------+       +--------+---------+       +--------+---------+
| [Storage Node#1] |       | [Storage Node#2] |       | [Storage Node#3] |
|                  |-------|                  |-------|                  |
+------------------+       +------------------+       +------------------+

 
ここでは Storage ノードの設定をします。
Storage ノードは、基本的に台数分全て同じ設定でOKですが、IPアドレスやデバイス名の数字については異なりますので、それぞれ注意して変更してください。
なお、この例では、Storage ノードとするサーバーにディスクを増設し、/dev/sdb1 にパーティションを作成して設定しています。
[1] 全 Storage ノード で Swift-Account, Swift-Container, Swift-Object 等々をインストールします。
root@snode01:~#
apt-get -y install swift swift-account swift-container swift-object xfsprogs
[2] 全 Storage ノード でディスクの空き領域を XFS でフォーマットし、/srv/node にマウントします。 (「device*」の数字は Storage ノードごとに異なる箇所です)
root@snode01:~#
mkfs.xfs -i size=1024 -s size=4096 /dev/sdb1

meta-data=/dev/sdb1              isize=1024   agcount=4, agsize=1310656 blks
         =                       sectsz=4096  attr=2, projid32bit=0
data     =                       bsize=4096   blocks=5242624, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

root@snode01:~#
mkdir -p /srv/node/device0

root@snode01:~#
mount -o noatime,nodiratime,nobarrier /dev/sdb1 /srv/node/device0

root@snode01:~#
chown -R swift. /srv/node

root@snode01:~#
vi /etc/fstab
# 最終行に追記

/dev/sdb1               /srv/node/device0       xfs     noatime,nodiratime,nobarrier 0 0
[3] Proxy ノードから 全 Storage ノードへ Swift Ring ファイルをコピーします。
root@proxy:~#
scp /etc/swift/*.gz 10.0.0.71:/etc/swift/

root@10.0.0.71's password:
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 = 6002
root@snode01:~#
vi /etc/swift/container-server.conf
# 6行目:設定確認

bind_ip = 0.0.0.0
bind_port = 6001
root@snode01:~#
vi /etc/swift/object-server.conf
# 6行目:設定確認

bind_ip = 0.0.0.0
bind_port = 6000
root@snode01:~#
vi /etc/rsyncd.conf
# 新規作成

pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
uid = swift
gid = swift
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

root@snode01:~#
vi /etc/default/rsync
# 8行目:変更

RSYNC_ENABLE=
true
[5] 各サービスを起動します。
root@snode01:~#
systemctl start rsync

root@snode01:~#
systemctl enable rsync

root@snode01:~#
for ringtype in account container object; do
    systemctl start swift-$ringtype
    systemctl enable swift-$ringtype
    for service in replicator updater auditor; do
        if [ $ringtype != 'account' ] || [ $service != 'updater' ]; then
            systemctl start swift-$ringtype-$service
            systemctl enable swift-$ringtype-$service
        fi
    done
done 
swift-account start/running
swift-account-replicator start/running
swift-account-auditor start/running
swift-container start/running
swift-container-replicator start/running
swift-container-updater start/running
swift-container-auditor start/running
swift-object start/running
swift-object-replicator start/running
swift-object-updater start/running
swift-object-auditor start/running
関連コンテンツ