Tags:
create new tag
,
view all tags
---+!! Installazione e configurazione del servizio Object Storage (Swift) %TOC% ---+ Installazione e configurazione di Storage node * Installare i pacchetti di Storage node <verbatim> # yum install openstack-swift-account openstack-swift-container openstack-swift-object xfsprogs </verbatim> * Creare la directory di configurazione e settate i proprietari: <verbatim> # mkdir -p /etc/swift # chown -R swift:swift /etc/swift/ </verbatim> * Creare il file /etc/swift/swift.conf: <verbatim> [swift-hash] # random unique string that can never change (DO NOT LOSE) swift_hash_path_suffix = fLIbertYgibbitZ </verbatim> Creare e montare un volume logico attraverso i seguenti passi: 1. Creare un volume logico di 800 Gigabyte sul server: <verbatim> # lvcreate -L 800G -n lv_swift <VOLUME_NAME> </verbatim> dove <VOLUME_NAME> è il nome del volume fisico sul quale si intende creare il volume logico. <pre></pre> 1. Formattare la partizione appena creata su filesystem xfs con blocchi da 1024 byte: <verbatim> # mkfs.xfs -i size=1024 <LV_PATH> </verbatim> dove <LV_PATH> è il percorso del volume logico ricavabile tramite il comando =lvdisplay= . <pre></pre> 1. Creare la directory dove si intende montare il volume appena creato: <verbatim> # mkdir -p /srv/node/swift </verbatim> <pre></pre> 1. Per consentire che il volume logico sia montato all'avvio del server, editare il file =/etc/fstab= aggiungendo la seguente riga: <verbatim> <LV_PATH> /srv/node/swift xfs noatime,nodiratime,nobarrier,logbufs=8 0 0 </verbatim> <pre></pre> 1. Montare il volume: <verbatim> # mount –a </verbatim> <pre></pre> 1. Settare i proprietari della directory superiore: <verbatim> # chown -R swift:swift /srv/node </verbatim> * Creare il file di configuarazione per rsync /etc/rsyncd.conf: <verbatim> uid = swift gid = swift log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid address = <STORAGE_LOCAL_NET_IP> [account] max connections = 2 path = /srv/node/ read only = false lock file = /var/lock/account.lock [container] max connections = 2 path = /srv/node/ read only = false lock file = /var/lock/container.lock [object] max connections = 2 path = /srv/node/ read only = false lock file = /var/lock/object.lock </verbatim> Dove <STORAGE_LOCAL_NET_IP> è l'indirizzo IP dello Storage node. * Editare la seguente riga nel file /etc/default/rsync: <verbatim> RSYNC_ENABLE = true </verbatim> * Creare uno script /etc/rc.d/init.d/rsyncd che possa far partire il servizio rsync: <verbatim> #!/bin/bash # Source function library. . /etc/rc.d/init.d/functions [ -f /usr/bin/rsync ] || exit 0 case "$1" in start) action "Starting rsyncd: " /usr/bin/rsync --daemon ;; stop) action "Stopping rsyncd: " killall rsync ;; *) echo "Usage: rsyncd {start|stop}" exit 1 esac exit 0 </verbatim> * Settare il default SELinux file context per lo script appena creato: <verbatim> # restorecon -R -v /etc/rc.d/init.d/rsyncd </verbatim> * Lanciare rsyncd attraverso il nuovo script creato: <verbatim> # service rsyncd start </verbatim> *Nota bene:* non è possibile usare il comando =chkconfig= per far partire il servizio rsyncd in automatico all'avvio del server, quindi è necessario farlo partire manualmente ad ogni riavvio. * Creare il file /etc/swift/account-server.conf: <verbatim> [DEFAULT] bind_ip = <STORAGE_LOCAL_NET_IP> workers = 1 [pipeline:main] pipeline = account-server [app:account-server] use = egg:swift#account [account-replicator] [account-auditor] [account-reaper] </verbatim> * Creare il file /etc/swift/container-server.conf: <verbatim> [DEFAULT] bind_ip = <STORAGE_LOCAL_NET_IP> workers = 1 [pipeline:main] pipeline = container-server [app:container-server] use = egg:swift#container [container-replicator] [container-updater] [container-auditor] [container-sync] </verbatim> * Creare il file /etc/swift/object-server.conf: <verbatim> [DEFAULT] bind_ip = <STORAGE_LOCAL_NET_IP> workers = 1 [pipeline:main] pipeline = object-server [app:object-server] use = egg:swift#object [object-replicator] [object-updater] [object-auditor] [object-expirer] </verbatim> <br /> ---+ Installazione e configurazione di Proxy server * Installare i pacchetti del Proxy server <verbatim> # yum install openstack-swift-proxy memcached </verbatim> * Installare i pacchetti di python-keystone: <verbatim> # yum install python-keystone python-keystoneclient </verbatim> * Creare un certificato auto-firmato per SSL: <verbatim> # cd /etc/swift # openssl req -new -x509 -nodes -out cert.crt -keyout cert.key </verbatim> * Far partire il servizio memcached <verbatim> # service memcached restart </verbatim> Fare in modo che memcached parta all'avvio del server: <verbatim> # chkconfig memcached on </verbatim> * Create /etc/swift/proxy-server.conf: <verbatim> [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 </verbatim> * Creare i ring per account, container e oggetti: <verbatim> # cd /etc/swift # swift-ring-builder account.builder create 7 1 24 # swift-ring-builder container.builder create 7 1 24 # swift-ring-builder object.builder create 7 1 24 </verbatim> Dove: * Il primo valore numerico (7 nell'esempio) è calcolato come segue: considerata la potenza in base 2 appena superiore al valore della partizione di storage in Gigabyte diviso 10, il valore da riportare è l'esponente di tale potenza. Nell'esempio riportato la partizione è di 800 GB, 2^7 (128) è la potenza di 2 appena superiore a 800/10=80. * Il secondo valore numerico (1 nell'esempio) è il numero di repliche di ogni oggetto. *Nota bene:* tale numero non può essere superiore al numero di nodi storage. * Il terzo valore numerico (24 nell'esempio) indica che la prtizione può essere spostata una volta ogni 24 ore. * *Su ognuno degli Storage node* lanciare i seguenti comandi: <verbatim> 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> </verbatim> 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: <verbatim> # 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 </verbatim> * Verificare il contenuto di ogni ring: <verbatim> # 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 </verbatim> * Ri-bilanciare i ring: <verbatim> # swift-ring-builder account.builder rebalance Reassigned 128 (100.00%) partitions. Balance is now 0.00. # swift-ring-builder container.builder rebalance Reassigned 128 (100.00%) partitions. Balance is now 0.00. # swift-ring-builder object.builder rebalance Reassigned 128 (100.00%) partitions. Balance is now 0.00. </verbatim> * Verificare nuovamente il contenuto di ogni ring: <verbatim> # 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 </verbatim> * Copiare i file account.ring.gz, container.ring.gz e object.ring.gz *su ognuno dei server Proxy e Storage* node in /etc/swift. * Assicurarsi che i file di configurazione abbiano i seguenti proprietari: <verbatim> chown -R swift:swift /etc/swift </verbatim> * *Su tutti gli Storage node* far partire i servizi di Swift: <verbatim> # 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 </verbatim> Si possono usare i seguenti comandi compatti: <verbatim> # swift-init main start # swift-init rest start </verbatim> Fare in modo che i servizi di swift partano all'avvio del server: <verbatim> # chkconfig openstack-swift-account on # chkconfig openstack-swift-container on # chkconfig openstack-swift-object on </verbatim> * *Sul server Proxy* far partire il servizio proxy: <verbatim> # swift-init proxy start </verbatim> Fare in modo che i servizi di swift partano all'avvio del server: <verbatim> # chkconfig openstack-swift-proxy on </verbatim> <br /> ---+ Troubleshooting * Da linea di comando usare il comando =swift= per mostrare informationi su account, container o oggetti. <verbatim> # swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> stat </verbatim> Dove: * <KEYSTONE_HOSTNAME> è l'hostname del server Keystone (nel prototipo in esempio è openstack-01.cnaf.infn.it) * <SERVICE_TENANT> è il tenant del DB di Keystone che racchiude gli utenti dei servizi !OpenStack * <SWIFT_USER> è il nome dell'utente del servizio Swift nel DB di Keystone * <ADMIN_PASSWORD> è la password dell'utente del servizio Swift nel DB di Keystone * Caricare un file (viene creato automaticamente il container): <verbatim> # swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> upload <CONTAINER_NAME> <FILE_NAME> </verbatim> Dove * <CONTAINER_NAME> è il nome del container che si intende creare * <FILE_NAME> è il nome del file che si intende caricare * Scaricare un file: <verbatim> # swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> download <CONTAINER_NAME> <FILE_NAME> </verbatim> * Mostrare i container esistenti: <verbatim> # swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> list </verbatim> <br /> -- Main.EnricoFattibene - 2012-10-12
E
dit
|
A
ttach
|
PDF
|
H
istory
: r9
<
r8
<
r7
<
r6
<
r5
|
B
acklinks
|
V
iew topic
|
M
ore topic actions
Topic revision: r9 - 2012-10-22
-
EnricoFattibene
Home
Site map
CEMon web
CREAM web
Cloud web
Cyclops web
DGAS web
EgeeJra1It web
Gows web
GridOversight web
IGIPortal web
IGIRelease web
MPI web
Main web
MarcheCloud web
MarcheCloudPilotaCNAF web
Middleware web
Operations web
Sandbox web
Security web
SiteAdminCorner web
TWiki web
Training web
UserSupport web
VOMS web
WMS web
WMSMonitor web
WeNMR web
MarcheCloudPilotaCNAF Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
E
dit
A
ttach
Copyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback