Installazione e configurazione del servizio Object Storage (Swift)
Installazione e configurazione di Storage node
Creare e montare un volume logico attraverso i seguenti passi:
- Creare un volume logico di 800 Gigabyte sul server:
# lvcreate -L 800G -n lv_swift <VOLUME_NAME>
dove <VOLUME_NAME> è il nome del volume fisico sul quale si intende creare il volume logico.
- Formattare la partizione appena creata su filesystem xfs con blocchi da 1024 byte:
# mkfs.xfs -i size=1024 <LV_PATH>
dove <LV_PATH> è il percorso del volume logico ricavabile tramite il comando lvdisplay
.
- Creare la directory dove si intende montare il volume appena creato:
# mkdir -p /srv/node/swift
- Per consentire che il volume logico sia montato all'avvio del server, editare il file
/etc/fstab
aggiungendo la seguente riga:
<LV_PATH> /srv/node/swift xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
- Montare il volume:
# mount –a
- Settare i proprietari della directory superiore:
# chown -R swift:swift /srv/node
- Editare la seguente riga nel file /etc/default/rsync:
RSYNC_ENABLE = true
- Lanciare rsyncd attraverso il nuovo script creato:
# service rsyncd start
Installazione e configurazione di Proxy server
- Create /etc/swift/proxy-server.conf:
[DEFAULT]
bind_port = 8080
user = <SWIFT_USER_NAME>
[pipeline:main]
pipeline = catch_errors healthcheck cache authtoken keystone proxy-server
[app:proxy-server]
use = egg:swift#proxy
account_autocreate = true
[filter:keystone]
paste.filter_factory = keystone.middleware.swift_auth:filter_factory
operator_roles = admin, swiftoperator
[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
# Delaying the auth decision is required to support token-less
# usage for anonymous referrers ('.r:*').
delay_auth_decision = 1
service_port = 5000
service_host = <KEYSTONE_HOSTNAME>
auth_port = 35357
auth_host = <KEYSTONE_HOSTNAME>
auth_token = <ADMIN_TOKEN>
admin_token = <ADMIN_TOKEN>
auth_protocol = http
[filter:cache]
use = egg:swift#memcache
set log_name = cache
[filter:catch_errors]
use = egg:swift#catch_errors
[filter:healthcheck]
use = egg:swift#healthcheck
- Su ognuno degli Storage node lanciare i seguenti comandi:
swift-ring-builder account.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP>:6002/<DEVICE> <NUM>
swift-ring-builder container.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6001/<DEVICE> <NUM>
swift-ring-builder object.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6000/<DEVICE> <NUM>
Per esempio sul nodo openstack-04.cnaf.infn.it si setta uno storage node con una partizione in Zona 1 sull'IP del server (131.154.100.113). Il mount point di questa partizione è /srv/node/swift, la partizione è il volume logico "swift", e 80 è il numero di Terabyte della partizione moltiplicato per 100. I comandi da lanciare sono:
# swift-ring-builder account.builder add z1-131.154.100.113:6002/swift 80
Device z1-131.154.100.113:6002/swift_"" with 80.0 weight got id 0
# swift-ring-builder container.builder add z1-131.154.100.113:6001/swift 80
Device z1-131.154.100.113:6001/swift_"" with 80.0 weight got id 0
# swift-ring-builder object.builder add z1-131.154.100.113:6000/swift 80
Device z1-131.154.100.113:6000/swift_"" with 80.0 weight got id 0
- Verificare il contenuto di ogni ring:
# swift-ring-builder account.builder
account.builder, build version 1
128 partitions, 1 replicas, 1 zones, 1 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 24
Devices: id zone ip address port name weight partitions balance meta
0 1 131.154.100.113 6002 swift 80.00 0 -100.00
# swift-ring-builder container.builder
container.builder, build version 1
128 partitions, 1 replicas, 1 zones, 1 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 24
Devices: id zone ip address port name weight partitions balance meta
0 1 131.154.100.113 6001 swift 80.00 0 -100.00
# swift-ring-builder object.builder
object.builder, build version 1
128 partitions, 1 replicas, 1 zones, 1 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 24
Devices: id zone ip address port name weight partitions balance meta
0 1 131.154.100.113 6000 swift 80.00 0 -100.00
- Verificare nuovamente il contenuto di ogni ring:
# swift-ring-builder container.builder
container.builder, build version 1
128 partitions, 1 replicas, 1 zones, 1 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 24
Devices: id zone ip address port name weight partitions balance meta
0 1 131.154.100.113 6001 swift 80.00 128 0.00
# swift-ring-builder object.builder
object.builder, build version 1
128 partitions, 1 replicas, 1 zones, 1 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 24
Devices: id zone ip address port name weight partitions balance meta
0 1 131.154.100.113 6000 swift 80.00 128 0.00
# swift-ring-builder account.builder
account.builder, build version 1
128 partitions, 1 replicas, 1 zones, 1 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 24
Devices: id zone ip address port name weight partitions balance meta
0 1 131.154.100.113 6002 swift 80.00 128 0.00
- Copiare i file account.ring.gz, container.ring.gz e object.ring.gz su ognuno dei server Proxy e Storage node in /etc/swift.
- Su tutti gli Storage node far partire i servizi di Swift:
# swift-init object-server start
# swift-init object-replicator start
# swift-init object-updater start
# swift-init object-auditor start
# swift-init container-server start
# swift-init container-replicator start
# swift-init container-updater start
# swift-init container-auditor start
# swift-init account-server start
# swift-init account-replicator start
# swift-init account-auditor start
Si possono usare i seguenti comandi compatti:
# swift-init main start
# swift-init rest start
Fare in modo che i servizi di swift partano all'avvio del server:
# chkconfig openstack-swift-account on
# chkconfig openstack-swift-container on
# chkconfig openstack-swift-object on
Troubleshooting
--
EnricoFattibene - 2012-10-12
This topic: MarcheCloudPilotaCNAF
> MarcheCloud > InstallingAndConfiguringSwift
Topic revision: r5 - 2012-10-17 - MatteoManzali