1、控制节点操作
1.1、先决条件
设置 admin 凭证
获得 admin 凭证来获取只有管理员能执行的命令的访问权限,执行如下命令:
. /root/admin-openrc
创建身份认证服务的凭证
创建 swift 用户(密码设置为:zhitu2017):
openstack user create --domain default --password-prompt swift
给 swift 用户添加 admin 角色:
openstack role add --project service --user swift admin
创建 swift 服务实体:
openstack service create --name swift --description "OpenStack Object Storage" object-store
创建对象存储服务API入口点,命令如下(依次执行三条命令):
openstack endpoint create --region RegionOne object-store public http://192.168.122.143:8080/v1/AUTH_%\(project_id\)s
openstack endpoint create --region RegionOne object-store internal http://192.168.122.143:8080/v1/AUTH_%\(project_id\)s
1.2、安装并配置组件
安装Swift及相关包
命令如下:
yum -y install openstack-swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached
获取代理服务的配置文件
将最新的代理服务的配置文件覆盖到/etc/swift目录,命令如下:
cp /usr/local/zhitu/swift/proxy-server.conf /etc/swift/proxy-server.conf
修改代理服务的配置文件proxy-server.conf
执行如下命令编辑/etc/swift/proxy-server.conf:
vi /etc/swift/proxy-server.conf
在文件中[DEFAULT]块下配置绑定端口,用户和配置目录:
bind_port = 8080
user = swift
swift_dir = /etc/swift
在文件中[pipeline:main]块删除tempurl和tempauth模块并增加authtoken和keystoneauth模块,也就是将原来的pipeline修改为如下:
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server
在文件中[app:proxy-server]块下启动自动账户创建:
use = egg:swift#proxy
account_autocreate = true
在文件中[filter:keystoneauth]块下配置操作员角色:
取消[filter:keystoneauth]注释
use = egg:swift#keystoneauth
operator_roles = admin,user
在文件中[filter:authtoken]块下配置认证服务访问(注释或者删除掉在 [filter:authtoken] 部分的所有其他的内容,放开[filter:authtoken]本身的注释):注意ip换成实验环境所提供的的
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
auth_uri = http://10.10.82.135:5000
auth_url = http://10.10.82.135:35357
memcached_servers = 10.10.82.135:11211
auth_type = password
project_domain_id = default