InstallandConfigureOpenStackObjectStorage(Swift)forUbuntu14.04-成都快上网建站

InstallandConfigureOpenStackObjectStorage(Swift)forUbuntu14.04

Based on Ubuntu 14.04 LTS x86_64

会泽ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!

Install and Configure OpenStack Object Storage (Swift) for Ubuntu 14.04

On keystone auth node:

# add swift user
keystone user-create --tenant service --name swift --pass SWIFT-USER-PASSWORD

# add swift user in admin role
keystone user-role-add --user swift --tenant service --role admin

# add an entry for swift service
keystone service-create --name=swift --type=object-store --description="Swift Service"

# add an entry for swift endpoint
keystone endpoint-create --region RegionOne --service swift --publicurl=http://LOAD-BALANCER-OF-PROXY:8080/v1/AUTH_%\(tenant_id\)s --internalurl=http://LOAD-BALANCER-OF-PROXY:8080/v1/AUTH_%\(tenant_id\)s --adminurl=http://LOAD-BALANCER-OF-PROXY:8080

On Swift Storage nodes:

1. using eth0 to connect proxy servers and other storage nodes

2.  vi /etc/hosts

# remove or comment the line beginning with 127.0.1.1

192.168.20.30    proxynode1
192.168.20.31    proxynode2

3. aptitude -y install ntp
vi /etc/ntp.conf
server 192.168.20.30 perfer
server 192.168.20.31
restrict 192.168.20.30
restrict 192.168.20.31

service ntp restart

4. aptitude -y install python-MySQLdb

5. aptitude -y install swift swift-account swift-container swift-object xfsprogs

6. RAID on the storage drives is not required and not recommended, use a single partition per drive

7. vi /etc/swift/swift.conf
# change (it is shared between Nodes - any words you like)
[swift-hash]
swift_hash_path_suffix = swift_shared_path


swift storage node1:

single partition, using fdisk, /dev/sdb --> /dev/sdb1 --> /srv/node/sdb1

                              /dev/sdc --> /dev/sdc1 --> /srv/node/sdc1

partprobe /dev/sdb /dev/sdc

mkfs.xfs -i size=1024 /dev/sdb1

mkfs.xfs -i size=1024 /dev/sdc1

mkdir -p /srv/node/sdb1; mkdir -p /srv/node/sdc1
echo "/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
echo "/dev/sdc1 /srv/node/sdc1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
mount /srv/node/sdb1; mount /srv/node/sdc1
chown -R swift:swift /srv/node

vi /etc/swift/account-server.conf
bind_ip =192.168.20.40

vi /etc/swift/container-server.conf
bind_ip =192.168.20.40

vi /etc/swift/object-server.conf
bind_ip =192.168.20.40


vi /etc/rsyncd.conf
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = STORAGE_LOCAL_NET_IP # 192.168.20.40

[account]
max connections = 25
path = /srv/node/
read only = false
lock file = /var/lock/account.lock

[container]
max connections = 25
path = /srv/node/
read only = false
lock file = /var/lock/container.lock

[object]
max connections = 25
path = /srv/node/
read only = false
lock file = /var/lock/object.lock

vi /etc/default/rsync
RSYNC_ENABLE=true

service rsync start

mkdir -p /var/swift/recon; chown -R swift:swift /var/swift/recon

On Swift Proxy Server:

1. eth0 for management/public/floating (192.168.1.0/24), eth2 for internal/flat (192.168.20.0/24), it's recommended to use seperated nic for management network

2. vi /etc/hosts

# remove or comment the line beginning with 127.0.1.1

192.168.1.10    controller
192.168.1.11    node1
192.168.1.30    proxynode1

192.168.1.31    proxynode2

3. aptitude -y install ntp

vi /etc/ntp.conf
server 192.168.1.10
restrict 192.168.1.10

restrict 192.168.20.0 mask 255.255.255.0 nomodify notrap


service ntpd restart

4. aptitude -y install python-mysqldb

aptitude -y install swift swift-proxy memcached python-keystoneclient python-swiftclient python-webob

vi /etc/memcached.conf
-l 192.168.20.30

service memcached restart

5. vi /etc/swift/proxy-server.conf
[DEFAULT]
bind_port = 8080
user = swift

[pipeline:main]
pipeline = healthcheck cache authtoken keystoneauth proxy-server

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

[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = Member,admin,swiftoperator

[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory

# Delaying the auth decision is required to support token-less
# usage for anonymous referrers ('.r:*').
delay_auth_decision = true

# cache directory for signing certificate
signing_dir = /home/swift/keystone-signing

# auth_* settings refer to the Keystone server
auth_protocol = http
auth_host = controller
auth_port = 35357

# the service tenant and swift username and password created in Keystone
admin_tenant_name = service
admin_user = swift
admin_password = SWIFT-USER-PASSWORD

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

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

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

mkdir -p /home/swift/keystone-signing
chown -R swift:swift /home/swift/keystone-signing

6. vi /etc/swift/swift.conf
# change (it is shared between Nodes - any words you like)
[swift-hash]
swift_hash_path_suffix = swift_shared_path

7. please check http://rackerlabs.github.io/swift-ppc/, you should have at least 3 disks for the ring (my thought :))

cd /etc/swift
swift-ring-builder account.builder create 8 3 1
swift-ring-builder container.builder create 8 3 1
swift-ring-builder object.builder create 8 3 1

you should run above commands only once, so take care of the part_power value

Notes: checkhttps://swiftstack.com/blog/2012/04/09/swift-capacity-management/ for more info on weight, you can use disk capacity in GB for weight value during first initilization

swift-ring-builder account.builder add r1z1-192.168.20.40:6002/sdb1 25
swift-ring-builder container.builder add r1z1-192.168.20.40:6001/sdb1 25
swift-ring-builder object.builder add r1z1-192.168.20.40:6000/sdb1 25

swift-ring-builder account.builder add r1z1-192.168.20.40:6002/sdc1 25
swift-ring-builder container.builder add r1z1-192.168.20.40:6001/sdc1 25
swift-ring-builder object.builder add r1z1-192.168.20.140:6000/sdc1 25

swift-ring-builder account.builder add r1z1-192.168.20.40:6002/sdd1 25
swift-ring-builder container.builder add r1z1-192.168.20.40:6001/sdd1 25
swift-ring-builder object.builder add r1z1-192.168.20.140:6000/sdd1 25

Verify the ring contents for each ring (cd /etc/swift to run below commands):
swift-ring-builder account.builder
swift-ring-builder container.builder
swift-ring-builder object.builder


swift-ring-builder account.builder rebalance
swift-ring-builder container.builder rebalance
swift-ring-builder object.builder rebalance

chown -R swift:swift /etc/swift

scp /etc/swift/*.gz 192.168.20.40:/etc/swift/

service swift-proxy restart

on swift storage node1

1. chown -R swift:swift /etc/swift

2. for service in swift-object swift-object-replicator swift-object-updater swift-object-auditor swift-container swift-container-replicator swift-container-updater swift-container-auditor swift-account swift-account-replicator swift-account-reaper swift-account-auditor; do
service $service start
done

On keystone auth node:

swift stat


新闻名称:InstallandConfigureOpenStackObjectStorage(Swift)forUbuntu14.04
转载来于:http://kswjz.com/article/jjiigp.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流