Ubuntu 18.04
Sponsored Link

OpenStack Stein : Configure Swift (Proxy Node)2019/04/16

 
Configure OpenStack Object Storage (Swift).
This example is based on the emvironment like follows.
------------+---------------------------+-------------+---
            |                           |             |
        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] Install Swift-Proxy.
root@proxy:~#
apt -y install swift swift-proxy python3-swiftclient python3-keystonemiddleware python3-memcache
[2] Configure Swift-Proxy.
root@proxy:~#
mkdir /etc/swift

root@proxy:~#
vi /etc/swift/proxy-server.conf
# create new

[DEFAULT]
bind_ip = 0.0.0.0
bind_port = 8080
user = swift

[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server

[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
account_autocreate = true

# Keystone auth info
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
www_authenticate_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:5000
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

[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = admin,SwiftOperator

[filter:healthcheck]
use = egg:swift#healthcheck

[filter:cache]
use = egg:swift#memcache
memcache_servers = 10.0.0.30:11211

[filter:ratelimit]
use = egg:swift#ratelimit

[filter:domain_remap]
use = egg:swift#domain_remap

[filter:catch_errors]
use = egg:swift#catch_errors

[filter:cname_lookup]
use = egg:swift#cname_lookup

[filter:staticweb]
use = egg:swift#staticweb

[filter:tempurl]
use = egg:swift#tempurl

[filter:formpost]
use = egg:swift#formpost

[filter:name_check]
use = egg:swift#name_check

[filter:list-endpoints]
use = egg:swift#list_endpoints

[filter:proxy-logging]
use = egg:swift#proxy_logging

[filter:bulk]
use = egg:swift#bulk

[filter:slo]
use = egg:swift#slo

[filter:dlo]
use = egg:swift#dlo

[filter:container-quotas]
use = egg:swift#container_quotas

[filter:account-quotas]
use = egg:swift#account_quotas

[filter:gatekeeper]
use = egg:swift#gatekeeper

[filter:container_sync]
use = egg:swift#container_sync

[filter:xprofile]
use = egg:swift#xprofile

[filter:versioned_writes]
use = egg:swift#versioned_writes

root@proxy:~#
vi /etc/swift/swift.conf
# create new (it is shared among Swift Nodes - any words you like)

[swift-hash]
swift_hash_path_suffix = swift_shared_path
swift_hash_path_prefix = swift_shared_path
root@proxy:~#
chown -R swift. /etc/swift
[3] Configure Swift Ring files.
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:6002/device0 100

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

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

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

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

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

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

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

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

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

Reassigned 12288 (300.00%) partitions. Balance is now 0.00.
root@proxy:~#
swift-ring-builder /etc/swift/container.builder rebalance

Reassigned 12288 (300.00%) partitions. Balance is now 0.00.
root@proxy:~#
swift-ring-builder /etc/swift/object.builder rebalance

Reassigned 12288 (300.00%) partitions. Balance is now 0.00.
root@proxy:~#
chown swift. /etc/swift/*.gz

root@proxy:~#
systemctl restart swift-proxy

Matched Content