# yum install openstack-swift-account openstack-swift-container openstack-swift-object xfsprogs
# mkdir -p /etc/swift # chown -R swift:swift /etc/swift/
[swift-hash] # random unique string that can never change (DO NOT LOSE) swift_hash_path_suffix = fLIbertYgibbitZ
# lvcreate -L 800G -n lv_swift <VOLUME_NAME>dove <VOLUME_NAME> è il nome del volume fisico sul quale si intende creare il volume logico.
# mkfs.xfs -i size=1024 <LV_PATH>dove <LV_PATH> è il percorso del volume logico ricavabile tramite il comando
lvdisplay
.
# mkdir -p /srv/node/swift
/etc/fstab
aggiungendo la seguente riga: <LV_PATH> /srv/node/swift xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
# mount –a
# chown -R swift:swift /srv/node
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.lockDove <STORAGE_LOCAL_NET_IP> è l'indirizzo IP dello Storage node.
RSYNC_ENABLE = true
#!/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
# restorecon -R -v /etc/rc.d/init.d/rsyncd
# service rsyncd startNota 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.
[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]
[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]
[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]
# yum install openstack-swift-proxy memcached
# yum install python-keystone python-keystoneclient
# cd /etc/swift # openssl req -new -x509 -nodes -out cert.crt -keyout cert.key
# service memcached restartFare in modo che memcached parta all'avvio del server:
# chkconfig memcached on
[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
# 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 24Dove:
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
# 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
# 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.
# 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
chown -R swift:swift /etc/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 startSi possono usare i seguenti comandi compatti:
# swift-init main start # swift-init rest startFare 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
# swift-init proxy startFare in modo che i servizi di swift partano all'avvio del server:
# chkconfig openstack-swift-proxy on
swift
per mostrare informationi su account, container o oggetti. # swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> statDove:
# swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> upload <CONTAINER_NAME> <FILE_NAME>Dove
# swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> download <CONTAINER_NAME> <FILE_NAME>
# swift -V 2 -A http://<KEYSTONE_HOSTNAME>:5000/v2.0 -U <SERVICE_TENANT>:<SWIFT_USER> -K <ADMIN_PASSWORD> list
![]() |
![]() |
|
![]() |
|
![]() |