CentOS 7
 

OpenStack Ocata : Swift 設定#2 (Proxy ノード)
2017/03/05
 
OpenStack Object Storage(Swift)を設定します。
当例では以下のような環境を例に Swift サービスを設定します。
-+---------------+----------------------------+------------
 |               |                            |
 |           eth0|10.0.0.30               eth0|10.0.0.50
 |   +-----------+-----------+    +-----------+-----------+
 |   |    [ 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
     +-----------+-----------+    +-----------+-----------+    +-----------+-----------+
     |   [ 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      |
     +-----------------------+    +-----------------------+    +-----------------------+

[1] Proxy ノードに Swift-Proxy をインストールします。
# Ocata, EPEL からインストール

[root@proxy ~]#
yum --enablerepo=centos-openstack-ocata,epel -y install openstack-swift-proxy python-memcached openssh-clients
[2] Swift-Proxy を設定します。
[root@proxy ~]#
vi /etc/swift/proxy-server.conf
[filter:cache]
use = egg:swift#memcache
# 42行目:Memcached サーバーを指定

memcache_servers =
10.0.0.30:11211
# 最終行:以下のように変更 (認証ノードの Keystone に登録した値)

[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
#
admin_tenant_name = %SERVICE_TENANT_NAME%
#
admin_user = %SERVICE_USER%
#
admin_password = %SERVICE_PASSWORD%
#
auth_host = 127.0.0.1
#
auth_port = 35357
#
auth_protocol = http
#
signing_dir = /tmp/keystone-signing-swift
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = swift
password = servicepassword
delay_auth_decision = true
[root@proxy ~]#
vi /etc/swift/swift.conf
# 以下のように追記 & 変更 (Swiftノード間でシェアする値 - 適当な文字列でよい)

[swift-hash]
swift_hash_path_suffix =
swift_shared_path
swift_hash_path_prefix = swift_shared_path
[3] Swift Ring ファイルの設定です。
[root@proxy ~]#
swift-ring-builder /etc/swift/account.builder create 12 3 1

[root@proxy ~]#
swift-ring-builder /etc/swift/container.builder create 12 3 1

[root@proxy ~]#
swift-ring-builder /etc/swift/object.builder create 12 3 1
[root@proxy ~]#
swift-ring-builder /etc/swift/account.builder add r0z0-10.0.0.71:6202/device0 100

Device d0r0z0-10.0.0.71:6202R10.0.0.71:6202/device0_"" with 100.0 weight got id 0
[root@proxy ~]#
swift-ring-builder /etc/swift/container.builder add r0z0-10.0.0.71:6201/device0 100

Device d0r0z0-10.0.0.71:6201R10.0.0.71:6201/device0_"" with 100.0 weight got id 0
[root@proxy ~]#
swift-ring-builder /etc/swift/object.builder add r0z0-10.0.0.71:6200/device0 100

Device d0r0z0-10.0.0.71:6200R10.0.0.71:6200/device0_"" with 100.0 weight got id 0
[root@proxy ~]#
swift-ring-builder /etc/swift/account.builder add r1z1-10.0.0.72:6202/device1 100

Device d1r1z1-10.0.0.72:6202R10.0.0.72:6202/device1_"" with 100.0 weight got id 1
[root@proxy ~]#
swift-ring-builder /etc/swift/container.builder add r1z1-10.0.0.72:6201/device1 100

Device d1r1z1-10.0.0.72:6201R10.0.0.72:6201/device1_"" with 100.0 weight got id 1
[root@proxy ~]#
swift-ring-builder /etc/swift/object.builder add r1z1-10.0.0.72:6200/device1 100

Device d1r1z1-10.0.0.72:6200R10.0.0.72:6200/device1_"" with 100.0 weight got id 1
[root@proxy ~]#
swift-ring-builder /etc/swift/account.builder add r2z2-10.0.0.73:6202/device2 100

Device d2r2z2-10.0.0.73:6202R10.0.0.73:6202/device2_"" with 100.0 weight got id 2
[root@proxy ~]#
swift-ring-builder /etc/swift/container.builder add r2z2-10.0.0.73:6201/device2 100

Device d2r2z2-10.0.0.73:6201R10.0.0.73:6201/device2_"" with 100.0 weight got id 2
[root@proxy ~]#
swift-ring-builder /etc/swift/object.builder add r2z2-10.0.0.73:6200/device2 100

Device d2r2z2-10.0.0.73:6200R10.0.0.73:6200/device2_"" with 100.0 weight got id 2
[root@proxy ~]#
swift-ring-builder /etc/swift/account.builder rebalance

Reassigned 4096 (100.00%) partitions. Balance is now 0.00.
[root@proxy ~]#
swift-ring-builder /etc/swift/container.builder rebalance

Reassigned 4096 (100.00%) partitions. Balance is now 0.00.
[root@proxy ~]#
swift-ring-builder /etc/swift/object.builder rebalance

Reassigned 4096 (100.00%) partitions. Balance is now 0.00.
[root@proxy ~]#
chown swift. /etc/swift/*.gz

[root@proxy ~]#
systemctl start openstack-swift-proxy

[root@proxy ~]#
systemctl enable openstack-swift-proxy

[4] Firewalld を有効にしている場合は、サービスポートの許可が必要です。
[root@proxy ~]#
firewall-cmd --add-port=8080/tcp --permanent

success
[root@proxy ~]#
firewall-cmd --reload

success
 
Tweet