Installazione e configurazione del servizio Object Storage (Swift)

Installazione e configurazione di Storage node

  • Installare i pacchetti di Storage node
    # yum install openstack-swift-account openstack-swift-container openstack-swift-object xfsprogs
    

  • Create and populate configuration directories on all nodes:
    # mkdir -p /etc/swift
    # chown -R swift:swift /etc/swift/    
    

  • Create /etc/swift/swift.conf:
    [swift-hash]
    # random unique string that can never change (DO NOT LOSE)
    swift_hash_path_suffix = fLIbertYgibbitZ
    

  1. 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.
    
    
  2. 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 .
    
    
  3. Creare la directory dove si intende montare il volume appena creato:
    # mkdir -p /srv/node/swift
    
    
    
  4. 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
    
    
    
  5. Montare il volume:
    # mount –a 
    
    
    
  6. Settare i proprietari della directory superiore:
    # chown -R swift:swift /srv/node
    


Installazione e configurazione di Proxy server

  • Installare i pacchetti del Proxy server
    # yum install openstack-swift-proxy memcached
    

  • Installare i pacchetti di python-keystone:
    # yum install python-keystone python-keystoneclient
    

  • Creare un certificato auto-firmato per SSL:
cd /etc/swift openssl req -new -x509 -nodes -out cert.crt -keyout cert.key

  • Modify memcached to listen on the default interfaces. Preferably this should be on a local, non-public network. Edit the following line in /etc/memcached.conf, changing:
-l 127.0.0.1 to -l

  • Far partire il servizio memcached
    service memcached restart
    

  • Create /etc/swift/proxy-server.conf:
    [DEFAULT]
    bind_port = 8888
    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>
    
    [filter:cache]
    use = egg:swift#memcache
    set log_name = cache
    
    [filter:catch_errors]
    use = egg:swift#catch_errors
    
    [filter:healthcheck]
    use = egg:swift#healthcheck
    

  • Create the account, container and object rings. The builder command is basically creating a builder file with a few parameters. The parameter with the value of 18 represents 2 ^ 18th, the value that the partition will be sized to. Set this “partition power” value based on the total amount of storage you expect your entire ring to use. The value of 3 represents the number of replicas of each object, with the last value being the number of hours to restrict moving a partition more than once.
    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
    
    Nota bene: il numero di repliche non può essere superiore al numero di nodi storage.

  • Su ognuno degli storage node lanciare i seguenti comandi:
    swift-ring-builder account.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP>:6002/<DEVICE> 100
    swift-ring-builder container.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6001/<DEVICE> 100
    swift-ring-builder object.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6000/<DEVICE> 100
    
    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
    

  • Verify the ring contents for each 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
    

*Rebalance the rings:

# 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 

Copy the account.ring.gz, container.ring.gz, and object.ring.gz files to each of the Proxy and Storage nodes in /etc/swift.

Make sure all the config files are owned by the swift user:

chown -R swift:swift /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
    

  • Sul server Proxy far partire il servizio proxy:
    # swift-init proxy start
    

Verifica: # export ADMINPASS=secretword # swift -V 2 -A http://:5000/v2.0 -U adminUser:admin -K $ADMINPASS stat [root@openstack-04 etc]# swift -V 2 -A http://openstack-01.cnaf.infn.it:5000/v2.0 -U adminUser:adminUser -K $ADMINPASS stat There is no object-store endpoint on this auth server.

-- EnricoFattibene - 2012-10-12


This topic: MarcheCloud > MarcheCloud > InstallingAndConfiguringSwift
Topic revision: r2 - 2012-10-12 - EnricoFattibene
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback