шпаргалки склеротиков

Previous Entry Share Next Entry
openstack swift
anonymus88

Cтенд из 3х нод:
swift1.swift.nct = 10.7.29.1
swift2.swift.nct = 10.7.29.2
swift3.swift.nct = 10.7.29.3
Все ноды выполняют роль прокси, а также хранилища объектов, контейнеров и аккаунтов.

cat /etc/swift/make_block_dev.sh

>>
#!/bin/sh
# Device size in GB
SIZE=1
DATA=/data
MOUNT=/srv/node
mkdir ${DATA}
for ZONE in 1; do
    for DEVICE in 1 2 ; do
        truncate ${DATA}/swift-z${ZONE}d${DEVICE} --size ${SIZE}G
        LOOPDEVICE=$(losetup --show -f ${DATA}/swift-z${ZONE}d${DEVICE})
        mkfs.ext4 -I 1024 ${LOOPDEVICE}
        mkdir -p ${MOUNT}/z${ZONE}d${DEVICE}
        mount -o noatime,nodiratime,nobarrier,user_xattr ${LOOPDEVICE} \
              ${MOUNT}/z${ZONE}d${DEVICE}
    done
done
chown -R swift:swift /srv/node
exit 0

cat   ring_create.sh

>>
#!/bin/bash
swift-ring-builder /etc/swift/account.builder create 12 2 1
swift-ring-builder /etc/swift/container.builder create 12 2 1
swift-ring-builder /etc/swift/object.builder create 12 2 1
swift-ring-builder /etc/swift/account.builder add z1-10.7.29.1:6002/z1d1 100
swift-ring-builder /etc/swift/account.builder add z2-10.7.29.2:6002/z1d1 100
swift-ring-builder /etc/swift/account.builder add z3-10.7.29.3:6002/z1d1 100
swift-ring-builder /etc/swift/container.builder add z1-10.7.29.1:6001/z1d1 100
swift-ring-builder /etc/swift/container.builder add z2-10.7.29.2:6001/z1d1 100
swift-ring-builder /etc/swift/container.builder add z3-10.7.29.3:6001/z1d1 100
swift-ring-builder /etc/swift/object.builder add z1-10.7.29.1:6000/z1d1 100
swift-ring-builder /etc/swift/object.builder add z2-10.7.29.2:6000/z1d1 100
swift-ring-builder /etc/swift/object.builder add z3-10.7.29.3:6000/z1d1 100
exit 0

cat /etc/rsyncd.conf

>>
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 10.7.29.1

[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

cat /etc/swift/account-server.conf

>>
[DEFAULT]
bind_ip = 10.7.29.1
bind_port = 6002
workers = 2
[pipeline:main]
pipeline = recon account-server
[app:account-server]
use = egg:swift#account
[account-replicator]
[account-auditor]
[account-reaper]
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
account_recon = true

cat /etc/swift/container-server.conf

>>
[DEFAULT]
bind_ip = 10.7.29.1
bind_port = 6001
workers = 2
[pipeline:main]
pipeline = recon container-server
[app:container-server]
use = egg:swift#container
[container-replicator]
[container-updater]
[container-auditor]
[container-sync]
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
container_recon = true

cat object-server.conf

>>
[DEFAULT]
bind_ip = 10.7.29.1
bind_port = 6000
workers = 3
[pipeline:main]
pipeline = recon object-server
[app:object-server]
use = egg:swift#object
[object-replicator]
[object-updater]
[object-auditor]
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
object_recon = true

cat /etc/xinetd.d/rsync

>>
service rsync

{

disable    = no
   flags        = IPv6
   socket_type     = stream
   wait            = no
   user            = root
   server          = /usr/bin/rsync
   server_args     = --daemon
   log_on_failure  += USERID

}

cat openrc                                                                                      

>>
export ST_AUTH=http://10.7.29.1:8080/auth/v1.0
export ST_USER=admin:admin
export ST_KEY=admin

cat cat /etc/swift/proxy-server.conf
>>

[DEFAULT]
bind_ip = 10.7.29.2
bind_port = 8080
workers = 8
user = swift

[pipeline:main]
pipeline = healthcheck cache tempauth proxy-server

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

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

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

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

[filter:tempauth]
use = egg:swift#tempauth
# user_<tenant>_<username> = <password> <privileges>
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3

                                                                                                                                                          


$ bash make_block_dev.sh
$ bash ring_create.sh

$ swift-ring-builder account.builder rebalance
$ swift-ring-builder container.builder rebalance
$ swift-ring-builder object.builder rebalance
$ chkconfig memcached on
$ service memcached start

$ for service in openstack-swift-object openstack-swift-object-replicator openstack-swift-object-updater openstack-swift-object-auditor openstack-swift-container openstack-swift-container-replicator openstack-swift-container-updater openstack-swift-container-auditor openstack-swift-account openstack-swift-account-replicator openstack-swift-account-reaper openstack-swift-account-auditor; do service $service start; chkconfig $service on; done

$ scp /etc/swift/*.ring.gz root@swift2.swift.nct:/etc/swift/
$ scp /etc/swift/*.ring.gz root@swift3.swift.nct:/etc/swift/
$ swift-init all restart
$ source openrc
$ swift list

$ yaourt -S cloudfuse


cat .cloudfuse

>>
username=admin:admin
api_key=admin
authurl=http://10.7.29.2:8080/auth/v1.0/
verify_ssl=false
$ mkdir /mnt/swift
$ cloudfuse /mnt/swift

?

Log in