啓動admin
證書:$ source admin-openrc.sh
node
建立swift
用戶:
<pre>$ keystone user-create --name swift --pass SWIFT_PASS
python
Property | Value |
---|---|
enabled | True |
id | dcf5d53f027b44d38c205ad06717812c |
name | swift |
username | swift |
+----------+----------------------------------+</pre>
用合適的密碼代替SWIFT_PASS。git
把admin
角色賦予給swift
用戶: $ keystone user-role-add --user swift --tenant service --role admin
這條命令不產生輸出顯示。github
建立swift
服務實體:
<pre>$ keystone service-create --name swift --type object-store \
數據庫
--description "OpenStack Object Storage" | |
---|---|
Property | Value |
description | OpenStack Object Storage |
enabled | True |
id | 11519978722e4fb4be75f086aca49334 |
name | swift |
type | object-store |
+-------------+----------------------------------+</pre>swift
$ keystone endpoint-create \
--service-id $(keystone service-list | awk '/ object-store / {print$2}') \
--publicurl 'http://controller:8080/v1/AUTH_%(tenant_id)s' \
--internalurl 'http://controller:8080/v1/AUTH_%(tenant_id)s' \
--adminurl http://controller:8080 \網絡
--region regionOne | |
---|---|
Property | Value |
adminurl | http://controller:8080 |
id | ec003b88a6144afda3fc2b34acb93ded |
internalurl | http://controller:8080/v1/AUTH_%(tenant_id)s |
publicurl | http://controller:8080/v1/AUTH_%(tenant_id)s |
region | regionOne |
service_id | 11519978722e4fb4be75f086aca49334 |
+-------------+----------------------------------------------+</pre>app
# apt-get install swift swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached
/etc/swift
# curl -o /etc/swift/proxy-server.conf https://raw.githubusercontent...
# vi /etc/swift/proxy-server.conf
文件:在[DEFAULT]
部分,設置bind port,用戶和配置文件存放目錄:
<pre>[DEFAULT]
curl
...
bind_port = 8080
user = swift
swift_dir = /etc/swift</pre>ide
在[pipeline:main]
部分,啓用合適的模塊:
<pre>[pipeline:main]
</pre>
pipeline = authtoken cache healthcheck keystoneauth proxy-logging proxy-server
在[app:proxy-server]
部分,啓用賬戶管理:
<pre>[app:proxy-server]
</pre>
...
allow_account_management = true
account_autocreate = true
在[filter:keystoneauth]
部分,設定操做者角色(operator role):
<pre>[filter:keystoneauth]
</pre>
use = egg:swift#keystoneauth
...
operator_roles = admin,_member_
在[filter:authtoken]
部分,設定認證服務:
<pre>[filter:authtoken]
</pre>
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
...
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = swift
admin_password = SWIFT_PASS
delay_auth_decision = true
SWIFT_PASS爲建立swift
用戶時使用的密碼。註釋掉 auth_host,auth_port,和auth_protocol的選項,由於identity_uri選項是直接代替它們的。
在[filter:cache]
部分,設定memcached location:
<pre>[filter:cache]
</pre>
...
memcache_servers = 127.0.0.1:11211
這裏要求兩個object存儲節點,每個都包含兩個空的本地塊存儲設備(two empty local block storage devices)。每一個設備(/dev/sdb
和/dev/sdc
)都必須包含一個合適的分區表,整個設備就一個分區(Each of the devices, /dev/sdb and /dev/sdc, must contain a suitable partition table with one partition occupying the entire device. )。
爲object節點增添兩塊硬盤:設置->存儲->控制器:SATA->添加虛擬硬盤。
由前文所述的虛擬機模版建立兩個存儲節點,分別爲object1和object2節點,基礎環境配置以下:
object節點虛擬機網絡設置,設置->網絡:
啓動虛擬機後,配置其網絡,經過更改# vi /etc/network/interfaces
文件,添加以下代碼:
object1:
<pre># The management network interface
auto eth0
iface eth0 inet static
address 10.10.10.14 netmask 255.255.255.0
auto eth1
iface eth1 inet dhcp</pre>
object2:
<pre># The management network interface
auto eth0
iface eth0 inet static
address 10.10.10.15 netmask 255.255.255.0
auto eth1
iface eth1 inet dhcp</pre>
配置命名的解決方案,更改# vi /etc/hostname文件,將主機名改成object1
和object2
,更改# vi /etc/hosts文件,添加如下代碼:
<pre>10.10.10.10 controller
</pre>
10.10.10.11 compute
10.10.10.12 network
10.10.10.13 block
10.10.10.14 object1
10.10.10.15 object2
修改配置文件# vi /etc/ntp.conf
,添加以下代碼:
<pre>server controller iburst
</pre>
其餘server所有都註釋掉。若是/var/lib/ntp/ntp.conf.dhcp
文件存在,則刪除之。
重啓NTP服務:# service ntp restart
# apt-get install xfsprogs rsync
/dev/sdb
和/dev/sdc
爲XFS格式:# mkfs.xfs /dev/sdb
meta-data=/dev/sdb isize=256 agcount=4, agsize=524288 blks
= sectsz=512 attr=2, projid32bit=0
data = bsize=4096 blocks=2097152, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0</pre>
<pre># mkfs.xfs /dev/sdc
meta-data=/dev/sdc isize=256 agcount=4, agsize=524288 blks
= sectsz=512 attr=2, projid32bit=0
data = bsize=4096 blocks=2097152, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0></pre>
# mkdir -p /srv/node/sdb
# mkdir -p /srv/node/sdc
# vi /etc/fstab
文件,添加以下內容:<pre>/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</pre>
# mount /srv/node/sdb
# mount /srv/node/sdc
# vi /etc/rsyncd.conf
文件,添加以下內容:uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = MANAGEMENT_INTERFACE_IP_ADDRESS
[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</pre>
MANAGEMENT_INTERFACE_IP_ADDRESS爲object節點在management網絡中的IP地址,object1爲10.10.10.14,object2爲10.10.10.15。
# vi /etc/default/rsync
文件,啓用rsync服務:RSYNC_ENABLE=true
</pre># service rsync start
# apt-get install swift swift-account swift-container swift-object
# curl -o /etc/swift/account-server.conf https://raw.githubusercontent...
# curl -o /etc/swift/container-server.conf https://raw.githubusercontent...
# curl -o /etc/swift/object-server.conf https://raw.githubusercontent...
# vi /etc/swift/account-server.conf
文件:[DEFAULT]
部分,設定bind IP地址,bind port,用戶,配置文件目錄和掛載點目錄:[DEFAULT]
...
bind_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
bind_port = 6002
user = swift
swift_dir = /etc/swift
devices = /srv/node</pre>
MANAGEMENT_INTERFACE_IP_ADDRESS爲object節點在management網絡中的IP地址,object1爲10.10.10.14,object2爲10.10.10.15。
在[pipeline:main]
部分,啓用合適的模塊:
<pre>[pipeline:main]
</pre>
pipeline = healthcheck recon account-server
在[filter:recon]
部分,設定recon(metrics)cache目錄:
<pre>[filter:recon]
</pre>
...
recon_cache_path = /var/cache/swift
# vi /etc/swift/container-server.conf
文件:[DEFAULT]
部分,設定bind IP地址,bind port,用戶,配置文件目錄和掛載點目錄:[DEFAULT]
...
bind_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
bind_port = 6001
user = swift
swift_dir = /etc/swift
devices = /srv/node</pre>
MANAGEMENT_INTERFACE_IP_ADDRESS爲object節點在management網絡中的IP地址,object1爲10.10.10.14,object2爲10.10.10.15。
在[pipeline:main]
部分,啓用合適的模塊:
<pre>[pipeline:main]
</pre>
pipeline = healthcheck recon container-server
在[filter:recon]
部分,設定recon(metrics)cache目錄:
<pre>[filter:recon]
</pre>
...
recon_cache_path = /var/cache/swift
# vi /etc/swift/object-server.conf
文件:在[DEFAULT]
部分,設定bind IP地址,bind port,用戶,配置文件目錄和掛載點目錄:
<pre>[DEFAULT]
...
bind_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
bind_port = 6000
user = swift
swift_dir = /etc/swift
devices = /srv/node</pre>
MANAGEMENT_INTERFACE_IP_ADDRESS爲object節點在management網絡中的IP地址,object1爲10.10.10.14,object2爲10.10.10.15。
在[pipeline:main]
部分,啓用合適的模塊:
<pre>[pipeline:main]
</pre>
pipeline = healthcheck recon object-server
在[filter:recon]
部分,設定recon(metrics)cache目錄:
<pre>[filter:recon]
</pre>
...
recon_cache_path = /var/cache/swift
# chown -R swift:swift /srv/node
recon
目錄,並確保權限正確:# mkdir -p /var/cache/swift
# chown -R swift:swift /var/cache/swift