• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

OpenStackSwift源码安装

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

1、安装拓扑

  

 

2、准备环境(所有节点)

2.1 由于本次安装选择的Ubuntu Server 12.04,需要安装以下必需软件包:

apt-get install build-essential git python-dev python-setuptools python-pip libxml2-dev libxslt-dev memcached

 

2.2 为每个节点创建swift用户

useradd -mk /home/swift/ -s /bin/bash swift 
passwd swift       #为swift用户添加密码,在此我将其设为了swift  
编辑/etc/sudoer文件,在文件末尾添加如下代码
swift ALL=(ALL) NOPASSWD:ALL

 

3、Auth节点的安装(详见《Keystone源码安装文档》)

4、Storage和Proxy节点安装(所有节点)

4.1、源码安装

su swift        #切换到swift用户  
Mkdir -p /home/swift/openstack        #创建一个目录来存放 
cd /home/swift/openstack 
git clone https://github.com/openstack/swift.git    #下载swift  
git clone https://github.com/openstack/keystone.git  
 
cd swift; pip install -r tools/pip-requires; python setup.py install
cd keystone; pip install -r tools/pip-requires; python setup.py install

 

4.2 简单配置

1、将Swift源码目录的etc/下所有文件复制到/etc/keystone中,依次执行以下命令:

Mkdir -p /etc/swift

chown -R swift:swift /etc/swift
cp -r /home/swift/openstack/swift/etc/* /etc/swift
cd /etc/swift
 
mv proxy-server.conf-sample proxy-server.conf
mv account-server.conf-sample account-server.conf
mv memcache.conf-sample memcache.conf
mv container-server.conf-sample container-server.conf
mv object-server.conf-sample object-server.conf
mv rsyncd.conf-sample rsyncd.conf
mv swift.conf-sample swift.conf

 

2、修改swift.conf

首先生成随机数: md5sum swift.conf

221d17a3ddbec73528400a12d6d29fe6  swift.conf

将swift.conf中swift_hash_path_suffix的值用得到的随机数替换。

swift_hash_path_suffix = 221d17a3ddbec73528400a12d6d29fe6

 

3、修改rsyncd.conf

 uid = swift
 gid = swift
 log file = /var/log/rsyncd.log
 pid file = /var/run/rsyncd.pid
 address = 127.0.0.1
 
 [account]
 max connections = 2
 path = /srv/node
 read only = false
 lock file = /var/lock/account.lock
 
 [container]
 max connections = 4
 path = /srv/node
 read only = false
 1lock file = /var/lock/container.lock
 
 [object]
 max connections = 8
 path = /srv/node
 read only = false
 lock file = /var/lock/object.lock

将rsyncd.conf拷贝到/etc目录下:

Mv rsyncd.conf ../

修改/etc/default/rsync,将RSYNC_ENABLE的值设为true,RSYNC_ENABLE=true。

service rsync restart   #最后重启rsync

 

4、修改proxy-server.conf

 [DEFAULT]
 bind_ip = 192.168.0.115   #proxy节点的ip,根据需要修改
 bind_port = 8888
 bind_timeout = 30
 backlog = 4096
 swift_dir = /etc/swift
 workers = 2
 user = swift
 
 [pipeline:main]
 pipeline = authtoken keystoneauth proxy-server
 
 [app:proxy-server]
 use = egg:swift#proxy
 allow_account_management = true
 account_autocreate = true
 
 [filter:authtoken]
 paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
 auth_host = 192.168.0.114     #keystone服务器的ip
 auth_port = 35357
 auth_protocol = http
 auth_uri = http://192.168.0.114:5000/
 admin_tenant_name = service
 admin_user = swift
 admin_password = openstack
 admin_token = anytime
 delay_auth_decision = 10
 signing_dir=/etc/swift/signing_dir
 
 [filter:keystoneauth]
 paste.filter_factory = keystone.middleware.swift_auth:filter_factory
 operator_roles = admin, swiftoperator

 

5、修改memcached.conf

[memcache]
memcache_servers = 192.168.0.115:11211
memcache_serialization_support = 2

 

6、修改account-server.conf

[DEFAULT]
bind_ip = 192.168.0.115   #其他节点修改为相应的ip
bind_port = 6012
bind_timeout = 30
backlog = 4096
workers = 2
user = swift
swift_dir = /etc/swift
devices = /srv/node
 
[pipeline:main]
pipeline = healthcheck recon account-server
 
[app:account-server]
use = egg:swift#account
 
[filter:healthcheck]
use = egg:swift#healthcheck
 
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift

 

7、修改container-server.conf

[DEFAULT]
bind_ip = 192.168.0.115   #其他节点修改为相应的ip
bind_port = 6011
bind_timeout = 30
backlog = 4096
workers = 2
user = swift
swift_dir = /etc/swift
devices = /srv/node
 
[pipeline:main]
pipeline = healthcheck recon container-server
 
[app:account-server]
use = egg:swift#container
 
[filter:healthcheck]
use = egg:swift#healthcheck
 
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift

 

8、修改object-server.conf

[DEFAULT]
bind_ip = 192.168.0.115   #其他节点修改为相应的ip
bind_port = 6010
bind_timeout = 30
backlog = 4096
workers = 2
user = swift
swift_dir = /etc/swift
devices = /srv/node
 
[pipeline:main]
pipeline = healthcheck recon object-server
 
[app:account-server]
use = egg:swift#object
 
[filter:healthcheck]
use = egg:swift#healthcheck
 
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift

 

9、设置存储点

新增一个独立的未使用的分区作为存储点,/dev/sdb1。

mkdir -p /srv/node/sdb1 
mkfs.xfs -i size=1024 /dev/sdb1 #以xfs方式格式化分区 
chmod a+w /etc/fstab 
echo “/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0” >> /etc/fstab 
mount /srv/node/sdb1 
chown -R swift:swift /srv/node/sdb1 
chmod a+w -R /srv/node/sdb1 

 

10、配置节点信息

生成ring文件,

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

在ring基础上生成zone,在这里仅以一个节点为例,

swift-ring-builder account.builder add z1-192.168.0.115:6012/sdb1 100
swift-ring-builder container.builder add z1-192.168.0.115:6011/sdb1 100
swift-ring-builder object.builder add z1-192.168.0.115:6010/sdb1 100

验证ring文件的正确性,

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

生成最终的ring,

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

 

11、其他存储节点的配置

其他存储节点的配置和上面的步骤基本一致,但是在配置多存储节点时,需要注意第十步zone的生成,如果是配置两个节点,如下,更多的节点以此类推。

swift-ring-builder account.builder add z1-192.168.0.115:6012/sdb1 100
swift-ring-builder container.builder add z1-192.168.0.115:6011/sdb1 100
swift-ring-builder object.builder add z1-192.168.0.115:6010/sdb1 100
swift-ring-builder account.builder add z1-192.168.0.116:6012/sdb1 100
swift-ring-builder container.builder add z1-192.168.0.116:6011/sdb1 100
swift-ring-builder object.builder add z1-192.168.0.116:6010/sdb1 100

 

12、安装后的验证

swift-init all start
swift -V 2 -A http://192.168.0.114:5000/v2.0 -U adminTenant:admin -K openstack stat

 

 

 

 

 

 

 

 

 

 

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
[Swift]数学库函数math.h | math.h -- mathematical library function发布时间:2022-07-13
下一篇:
[Swift]LeetCode258.各位相加|AddDigits发布时间:2022-07-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap