标签:file fstab ip地址 user container mount 下载 intern https
本文参照官方教程:http://docs.openstack.org/project-install-guide/object-storage/draft/environment-networking.html
我们要设置的swift节点名称为object1,主控节点和proxy节点都是controller。
在controller节点的/etc/hosts文件里写上节点名称和ip地址,必须是能ping通的地址,同理,swift节点的/etc/hosts文件要写上各种地址。
在controller节点上进行以下操作:
source /root/admin-openrc.sh #必须找到该配置文件
创建swift用户:
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
创建endpoints:
openstack endpoint create --region RegionOne object-store public http://controller:8080/v1/AUTH_%\(tenant_id\)s
openstack endpoint create --region RegionOne object-store internal http://controller:8080/v1/AUTH_%\(tenant_id\)s
openstack endpoint create --region RegionOne object-store admin http://controller:8080/v1
安装需要的组件:
yum install openstack-swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached
下载配置文件:
curl -o /etc/swift/proxy-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/proxy-server.conf-sample?h=stable/newton
修改配置文件/etc/swift/proxy-server.conf:
[DEFAULT] bind_port = 8080 user = swift swift_dir = /etc/swift
[pipeline:main] 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]
use = egg:swift#keystoneauth
...
operator_roles = admin,user
[filter:authtoken] paste.filter_factory = keystonemiddleware.auth_token:filter_factory ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 #这里有时候需要改成127.0.0.1:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = swift password = 要设置的swift用户的密码 delay_auth_decision = True
[filter:cache] use = egg:swift#memcache ... memcache_servers = controller:11211 #这里有时候需要改成127.0.0.1:11211
接下来在storage节点上操作,也就是swift节点,若节点机器有多个,需要在每台节点机器上都执行
安装依赖组件:
yum install xfsprogs rsync
预先连接几块未格式化的硬盘,不要挂载和格式化,然后执行以下命令,一般为两块到三块
mkfs.xfs /dev/sdb mkfs.xfs /dev/sdc
mkfs.xfs /dev/sdd
创建对应的挂载节点目录:
mkdir -p /srv/node/sdb mkdir -p /srv/node/sdc
mkdir -p /srv/node/sdd
修改以下文件/etc/fstab:
/dev/sdb /srv/node/sdb xfs noatime,nodiratime,nobarrier,logbufs=8 0 2 /dev/sdc /srv/node/sdc xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
/dev/sdd /srv/node/sdd xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
挂载盘:
mount /srv/node/sdb mount /srv/node/sdc
mount /srv/node/sdd
修改/etc/rsyncd.conf文件:
uid = swift gid = swift log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid address = storage节点用来与外部访问的地址 [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
创建并重启服务:
systemctl enable rsyncd.service
systemctl start rsyncd.service
以上是针对proxy连接组件的安装配置,接下来是account组件的配置,先安装组件包:
yum install openstack-swift-account openstack-swift-container openstack-swift-object
修改/etc/swift/account-server.conf文件:
[DEFAULT] ... bind_ip = storage(swift)节点用于外部访问的连接地址 bind_port = 6002 user = swift swift_dir = /etc/swift devices = /srv/node mount_check = True
[pipeline:main] pipeline = healthcheck recon account-server
[filter:recon] use = egg:swift#recon ... recon_cache_path = /var/cache/swift
修改container的配置文件/etc/swift/container-server.conf:
[DEFAULT] ... bind_ip =storage(swift)节点用于外部访问的连接地址
bind_port = 6001
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
[pipeline:main] pipeline = healthcheck recon container-server
[filter:recon] use = egg:swift#recon ... recon_cache_path = /var/cache/swift
修改object配置文件/etc/swift/object-server.conf:
[DEFAULT] ... bind_ip =storage(swift)节点用于外部访问的连接地址
bind_port = 6000
user = swift
swift_dir = /etc/swift
devices = /srv/node
mount_check = True
[pipeline:main] pipeline = healthcheck recon object-server
[filter:recon] use = egg:swift#recon ... recon_cache_path = /var/cache/swift recon_lock_path = /var/lock
给节点赋予权限
chown -R swift:swift /srv/node
mkdir -p /var/cache/swift
chown -R root:swift /var/cache/swift
chmod -R 775 /var/cache/swift
标签:file fstab ip地址 user container mount 下载 intern https
原文地址:http://www.cnblogs.com/slqt/p/6228222.html