赞
踩
a. 对象服务:管理实际存储的数据
b. 容器服务:管理容器
c. 账号服务:管理用户账号信息
c. 代理服务:对外提供访问接口,可以有多个。
d. 其它服务:必要的后台处理程序,例如副本维护,状态更新等。
一般分两种服务器:
a. 存储服务器:运行前两种服务,同时还运行sqlite和rsync
b.代理服务器:运行代理服务
a. 对外网络:即代理服务器的对外接口网络,外部主机可以通过该接口访问swift存储服务。
b. 存储网络:用于集群内部通讯。
c. 复制网络:专用于数据复制的通讯。
复制网络不是必须的。
如果有复制网络,则对象服务和容器/账号服务除监听STORAGE_LOCAL_NET之外,还得监听STORAGE_REPLICATION_NET,但是rsync服务只需监听STORAGE_REPLICATION_NET即可
一个zone包含一个或多个存储设备,其宕机不会影响集群运行。
基本安装方式中可以把一台主机作为一个zone,建议一个集群至少包含5个zone。
实现对象存储数据到实际存储设备之间的映射。
yum install mysql mysql-server MySQL-python
vim /etc/my.cnf
[mysqld]
bind-address=xxxx
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
# service mysqld start
# chkconfig mysqld on
# mysql_install_db
# mysql_secure_installation
</pre><p>[mysqld]</p><p><pre name="code" class="plain">auth=no
由于认证需要,部署swift之前必须先部署keystone。
KEYSTONE_DBPASS修改为想要的密码,controller修改为数据库所在主机的地址。
用户名设置为keystone,设置keystone用户对其有完全访问权限。密码设置为和前面的KEYSTONE_DBPASS一样。
$ mysql -u root -p
mysql> CREATE DATABASE keystone;
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY 'KEYSTONE_DBPASS';
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY 'KEYSTONE_DBPASS';
mysql> exit
# keystone-manage pki_setup --keystone-user keystone --keystone-group
keystone
# chown -R keystone:keystone /etc/keystone/ssl
# chmod -R o-rwx /etc/keystone/ssl
# (crontab -l -u keystone 2>&1 | grep -q token_flush) || echo '@hourly /usr/bin/keystone-manage token_flush >/var/log/keystone/keystone-tokenflush.log 2>&1' >> /var/spool/cron/keystone
定义用户,租户和角色的目的是为了使服务和端点的访问变得有效。
$ export OS_SERVICE_TOKEN=ADMIN_TOKEN # ADMIN_TOKEN见上文
$ export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0# controller即控制节点的ip
创建管理员用户:keystone user-create --name=admin --pass=ADMIN_PASS --email=ADMIN_EMAIL
创建管理员角色:keystone role-create --name=admin
创建管理员租户:keystone tenant-create --name=admin --description="Admin Tenant"
把以上三者联系起来:keystone user-role-add --user=admin --tenant=admin --role=admin
把admin和_member_角色联系起来:keystone user-role-add --user=admin --role=_member_ --tenant=admin
export OS_USERNAME=admin
export OS_PASSWORD=ADMIN_PASS
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller:35357/v2.0
cp admin-openrc.sh /etc/profile.d/
[swift-hash]
# random unique string that can never change (DO NOT LOSE)
swift_hash_path_prefix = xrfuniounenqjnw
swift_hash_path_suffix = fLIbertYgibbitZ
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = STORAGE_LOCAL_NET_IP<span style="white-space:pre"> </span><span style="color:#ff0000;">#如果有独立的副本同步网络,则替换为STORAGE_REPLICATION_NET_IP</span>
[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
<h3>lock file = /var/lock/container.lock</h3>[object]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/object.lock
vim /etc/xinetd.d/rsync
disable = no
# service xinetd start
OPTIONS="-l PROXY_LOCAL_NET_IP"<span style="white-space:pre"> </span>#本机的私网地址
[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
# 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_PASS
[filter:cache]
use = egg:swift#memcache
[filter:catch_errors]
use = egg:swift#catch_errors
[filter:healthcheck]
use = egg:swift#healthcheck
10.1.2.3:11211,10.1.2.4:11211
[filter:cache]
use = egg:swift#memcache
memcache_servers = PROXY_LOCAL_NET_IP:11211
4.把ring信息复制到本地
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。