Swift安装
Server1 .Update
sudo apt-get update
sudo apt-get upgrade .
sudo apt-get install bridge-utils .IP
3.1
sudo vi /etc/network/interfaces
----------------------------------------------
auto lo
iface lo inet loopback auto eth0
iface eth0 inet static
address 192.168.75.110
netmask 255.255.255.0
broadcast 192.168.75.255
gateway 192.168.75.2
dns-nameservers 192.168.75.2 auto eth1
iface eth1 inet static
address 192.168.4.1
netmask 255.255.255.0
network 192.168.4.0
broadcast 192.168.4.255
3.2
sudo /etc/init.d/networking restart .NTP Server
4.1
sudo apt-get install ntp 4.2
sudo vi /etc/ntp.conf --------------------------------
server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 4.3
sudo service ntp restart .database
5.1
sudo apt-get install mysql-server python-mysqldb 设置密码:gis 5.2
sudo vi /etc/mysql/my.cnf -------------------------------------
bind-address = 0.0.0.0 5.3
sudo restart mysql sudo mysql -u root -p
use mysql select host, user, password from user;
delete from user where user='root' and host='localhost';
delete from user where user='root' and host='::1';
delete from user where user='root' and host='127.0.0.1';
delete from user where user='';
update user set host='%' where user='root';
commit;
sudo restart mysql 5.4
sudo mysql -u root -p -e 'CREATE DATABASE keystone;' 5.5
sudo mysql -u root -p -e 'CREATE USER keystone;' 5.6
sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%';"
sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'" 5.7
sudo mysql -u root -p -e "SET PASSWORD FOR 'keystone'@'%' = PASSWORD('gis');" .
sudo apt-get install keystone 6.1
sudo rm /var/lib/keystone/keystone.db 6.2
sudo vi /etc/keystone/keystone.conf bind_host = 0.0.0.0
public_port =
admin_port =
admin_token = 012345SECRET99TOKEN012345
compute_port =
verbose = True
debug = True
log_config = /etc/keystone/logging.conf
use_syslog = False connection = mysql://keystone:gis@192.168.75.110/keystone 6.3
sudo keystone-manage pki_setup sudo chown -R keystone:keystone /etc/keystone/ sudo chmod g+rx,o+rx -R /etc/keystone/ sudo chmod -R g+rwx,o+rwx /var/log/keystone/ 6.4
sudo service keystone restart 6.5
sudo keystone-manage db_sync identity
7.1
export OS_SERVICE_TOKEN=012345SECRET99TOKEN012345
export OS_SERVICE_ENDPOINT=http://192.168.75.110:35357/v2.0 keystone tenant-create --name demo --description "Default Tenant" +-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Default Tenant |
| enabled | True |
| id | 3b440084158a42c0917603e066261aaf |
| name | demo |
+-------------+----------------------------------+ keystone user-create --tenant-id 3b440084158a42c0917603e066261aaf --name admin --pass secrete +----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | |
| enabled | True |
| id | d99081655e834ded8abea8e6f6e111bb |
| name | admin |
| tenantId | 3b440084158a42c0917603e066261aaf |
+----------+----------------------------------+ keystone role-create --name admin +----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| id | c55516c9bcae400bad38b96e98e35279 |
| name | admin |
+----------+----------------------------------+ keystone user-role-add --user-id d99081655e834ded8abea8e6f6e111bb --tenant-id 3b440084158a42c0917603e066261aaf --role-id c55516c9bcae400bad38b96e98e35279 7.2 keystone tenant-create --name service --description "Service Tenant" +-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Service Tenant |
| enabled | True |
| id | d5f00c8160b94fc5acdf2f2a79d790dc |
| name | service |
+-------------+----------------------------------+ keystone user-create --tenant-id d5f00c8160b94fc5acdf2f2a79d790dc --name glance --pass glance +----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | |
| enabled | True |
| id | 2d16d19937fd4f3eba46a48d0a5d1c90 |
| name | glance |
| tenantId | d5f00c8160b94fc5acdf2f2a79d790dc |
+----------+----------------------------------+ keystone user-role-add --user-id 2d16d19937fd4f3eba46a48d0a5d1c90 --tenant-id d5f00c8160b94fc5acdf2f2a79d790dc --role-id c55516c9bcae400bad38b96e98e35279 keystone user-create --tenant-id d5f00c8160b94fc5acdf2f2a79d790dc --name ec2 --pass ec2 +----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | |
| enabled | True |
| id | 2782536bd49a4802a575301ccdb44324 |
| name | ec2 |
| tenantId | d5f00c8160b94fc5acdf2f2a79d790dc |
+----------+----------------------------------+ keystone user-role-add --user-id 2782536bd49a4802a575301ccdb44324 --tenant-id d5f00c8160b94fc5acdf2f2a79d790dc --role-id c55516c9bcae400bad38b96e98e35279 keystone user-create --tenant-id d5f00c8160b94fc5acdf2f2a79d790dc --name swift --pass swiftpass +----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | |
| enabled | True |
| id | cdee582c005745808f064ceea1e20953 |
| name | swift |
| tenantId | d5f00c8160b94fc5acdf2f2a79d790dc |
+----------+----------------------------------+ keystone user-role-add --user-id cdee582c005745808f064ceea1e20953 --tenant-id d5f00c8160b94fc5acdf2f2a79d790dc --role-id c55516c9bcae400bad38b96e98e35279 7.3 keystone service-create --name=keystone --type=identity --description="Identity Service" +-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Identity Service |
| id | c697cfd78fa14b8eaf296af2569b711c |
| name | keystone |
| type | identity |
+-------------+----------------------------------+ keystone endpoint-create \
--region RegionOne \
--service-id=c697cfd78fa14b8eaf296af2569b711c \
--publicurl=http://192.168.75.110:5000/v2.0 \
--internalurl=http://192.168.75.110:5000/v2.0 \
--adminurl=http://192.168.75.110:35357/v2.0 +-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| adminurl | http://192.168.75.110:35357/v2.0 |
| id | 6a32df6c6c714e30a9830cfe39e8d64f |
| internalurl | http://192.168.75.110:5000/v2.0 |
| publicurl | http://192.168.75.110:5000/v2.0 |
| region | RegionOne |
| service_id | c697cfd78fa14b8eaf296af2569b711c |
+-------------+----------------------------------+ keystone service-create --name=ec2 --type=ec2 --description="EC2 Compatibility Layer" +-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | EC2 Compatibility Layer |
| id | 528b19e43cec466192c770c26d3a73a3 |
| name | ec2 |
| type | ec2 |
+-------------+----------------------------------+ keystone --token 012345SECRET99TOKEN012345 \
--endpoint http://192.168.75.110:35357/v2.0/ \
endpoint-create \
--region RegionOne \
--service-id=528b19e43cec466192c770c26d3a73a3 \
--publicurl=http://192.168.75.110:8773/services/Cloud \
--internalurl=http://192.168.75.110:8773/services/Cloud \
--adminurl=http://192.168.75.110:8773/services/Admin +-------------+-------------------------------------------+
| Property | Value |
+-------------+-------------------------------------------+
| adminurl | http://192.168.75.110:8773/services/Admin |
| id | 64007630d09c450a8418985c98dbcd07 |
| internalurl | http://192.168.75.110:8773/services/Cloud |
| publicurl | http://192.168.75.110:8773/services/Cloud |
| region | RegionOne |
| service_id | 528b19e43cec466192c770c26d3a73a3 |
+-------------+-------------------------------------------+ keystone service-create --name=swift --type=object-store --description="Object Storage Service" +-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | Object Storage Service |
| id | b162fbd8a371465bba07b9c0ea3f9c32 |
| name | swift |
| type | object-store |
+-------------+----------------------------------+ keystone endpoint-create \
--region RegionOne \
--service-id=b162fbd8a371465bba07b9c0ea3f9c32 \
--publicurl 'http://192.168.75.110:8888/v1/AUTH_%(tenant_id)s' \
--adminurl 'http://192.168.75.110:8888/v1' \
--internalurl 'http://192.168.75.110:8888/v1/AUTH_%(tenant_id)s' +-------------+--------------------------------------------------+
| Property | Value |
+-------------+--------------------------------------------------+
| adminurl | http://192.168.75.110:8888/v1 |
| id | 5eb5295ee08d4967838f2b8f3fd44939 |
| internalurl | http://192.168.75.110:8888/v1/AUTH_%(tenant_id)s |
| publicurl | http://192.168.75.110:8888/v1/AUTH_%(tenant_id)s |
| region | RegionOne |
| service_id | b162fbd8a371465bba07b9c0ea3f9c32 |
+-------------+--------------------------------------------------+ .
unset OS_SERVICE_TOKEN
unset OS_SERVICE_ENDPOINT .
keystone --os-auth-url=http://192.168.75.110:35357/v2.0 token-get keystone --os-username=admin --os-password=secrete --os-auth-url=http://192.168.75.110:35357/v2.0 token-get keystone --os-username=admin --os-password=secrete --os-tenant-name=demo --os-auth-url=http://192.168.75.110:35357/v2.0 token-get keystone --os-username=admin --os-password=secrete --os-auth-url=http://192.168.75.110:35357/v2.0 token-get keystone --os-username=admin --os-password=secrete --os-tenant-name=service --os-auth-url=http://192.168.75.110:35357/v2.0 token-get .
vi keystonerc export OS_USERNAME=swift
export OS_PASSWORD=swiftpass
export OS_TENANT_NAME=service
export OS_AUTH_URL=http://192.168.75.110:35357/v2.0
export OS_REGION_NAME=RegionOne
export OS_SERVICE_TOKEN=012345SECRET99TOKEN012345
export OS_SERVICE_ENDPOINT=http://192.168.75.110:35357/v2.0 export OS_USERNAME=admin
export OS_PASSWORD=secrete
export OS_TENANT_NAME=demo
export OS_AUTH_URL=http://192.168.75.110:35357/v2.0 source keystonerc .
keystone user-list
keystone role-list -------------------------------------Server1, Server2, Server3, Server4---------------------------------------------------- .安装SSH和Swift的核心包 sudo apt-get install swift openssh-server rsync memcached python-netifaces python-xattr python-memcache .在所有节点上创创建配置文件目录 sudo mkdir -p /etc/swift
sudo chown -R swift:swift /etc/swift/ . 在所有节点上创创建swift配置文件(/etc/swift/swift.conf)
sudo vi /etc/swift/swift.conf [swift-hash]
# random unique string that can never change (DO NOT LOSE)
swift_hash_path_suffix = fLIbertYgibbitZ sudo chown -R swift:swift /etc/swift/ ------------------------------------Server , Server , Server ----------------------------------------------------------- .在所有存贮节点上安装Swift包 sudo apt-get install swift-account swift-container swift-object xfsprogs . 建立XFS文件系统存贮 sudo fdisk /dev/sdb //#然后一次选择 n, p, 1, 默认, 默认, w sudo mkfs.xfs -f -i size= /dev/sdb1
( 命令格式: sudo mkfs -t ext3 /dev/sdb1 ) sudo mkdir -p /srv/node/sdb1 sudo echo "/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab sudo mount /srv/node/sdb1 sudo chown -R swift:swift /srv/node . 创建数据同步配置文件(/etc/rsyncd.conf) sudo vi /etc/rsyncd.conf uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 192.168.4.2 或 192.168.4.3 或 192.168.4.4 [account]
max connections =
path = /srv/node/
read only = false
lock file = /var/lock/account.lock [container]
max connections =
path = /srv/node/
read only = false
lock file = /var/lock/container.lock [object]
max connections =
path = /srv/node/
read only = false
lock file = /var/lock/object.lock .启用系统同步
sudo vi /etc/default/rsync RSYNC_ENABLE = true sudo service rsync start .创建目录
sudo mkdir -p /var/swift/recon sudo chown -R swift:swift /var/swift/recon ---------------------------------------------------Server ---------------------------------------------------------- .安装swift-proxy节点包 sudo apt-get install swift-proxy memcached python-keystoneclient python-swiftclient python-webob .生成SSL认证文件 cd /etc/swift
sudo openssl req -new -x509 -nodes -out cert.crt -keyout cert.key .修改缓存配置文件 sudo vi /etc/memcached.conf
将
-l 127.0.0.1
改为
-l 192.168.4.1 .重启缓存服务
sudo service memcached restart .修改swift-proxy缓存配置文件
sudo vi /etc/swift/proxy-server.conf [DEFAULT]
cert_file = /etc/swift/cert.crt
key_file = /etc/swift/cert.key
bind_port =
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 # cache directory for signing certificate
signing_dir = /home/swift/keystone-signing # auth_* settings refer to the Keystone server
auth_protocol = http
auth_host = 192.168.75.110
auth_port = # the same admin_token as provided in keystone.conf
admin_token = 012345SECRET99TOKEN012345 # the service tenant and swift userid and password created in Keystone
admin_tenant_name = service
admin_user = swift
admin_password = swiftpass [filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.75.110: [filter:catch_errors]
use = egg:swift#catch_errors [filter:healthcheck]
use = egg:swift#healthcheck . 创建swift的认证目录 sudo mkdir -p /home/swift/keystone-signing
sudo chown -R swift:swift /home/swift/keystone-signing .创建account, container, object的ring cd /etc/swift
sudo swift-ring-builder account.builder create
sudo swift-ring-builder container.builder create
sudo swift-ring-builder object.builder create . 将存贮实体加入到环中 sudo swift-ring-builder account.builder add z1-192.168.4.2:/sdb1
sudo swift-ring-builder container.builder add z1-192.168.4.2:/sdb1
sudo swift-ring-builder object.builder add z1-192.168.4.2:/sdb1 sudo swift-ring-builder account.builder add z2-192.168.4.3:/sdb1
sudo swift-ring-builder container.builder add z2-192.168.4.3:/sdb1
sudo swift-ring-builder object.builder add z2-192.168.4.3:/sdb1 sudo swift-ring-builder account.builder add z3-192.168.4.4:/sdb1
sudo swift-ring-builder container.builder add z3-192.168.4.4:/sdb1
sudo swift-ring-builder object.builder add z3-192.168.4.4:/sdb1 . 查看各个环
sudo swift-ring-builder account.builder
sudo swift-ring-builder container.builder
sudo swift-ring-builder object.builder . 平衡各个环
sudo swift-ring-builder account.builder rebalance
sudo swift-ring-builder container.builder rebalance
sudo swift-ring-builder object.builder rebalance . 将生成的环信息复制到Proxy节点与Storage节点的/etc/swift目录下
account.ring.gz
container.ring.gz
object.ring.gz sudo chown -R swift:swift /etc/swift sudo chmod g+rw,o+rw -R /etc/swift/ sudo scp account.ring.gz zyx@192.168.75.111:/etc/swift
sudo scp account.ring.gz zyx@192.168.75.112:/etc/swift
sudo scp account.ring.gz zyx@192.168.75.113:/etc/swift sudo scp container.ring.gz zyx@192.168.75.111:/etc/swift
sudo scp container.ring.gz zyx@192.168.75.112:/etc/swift
sudo scp container.ring.gz zyx@192.168.75.113:/etc/swift sudo scp object.ring.gz zyx@192.168.75.111:/etc/swift
sudo scp object.ring.gz zyx@192.168.75.112:/etc/swift
sudo scp object.ring.gz zyx@192.168.75.113:/etc/swift . 将各个配置文件的用户改为swift sudo chown -R swift:swift /etc/swift . 启动代理服务
sudo service proxy-server start
sudo swift-init proxy start (有效) ------------------------------------------Server , Server , Server ----------------------------------------------------------- .启动存贮服务 sudo service swift-object start
sudo service swift-object-replicator start
sudo service swift-object-updater start
sudo service swift-object-auditor start
sudo service swift-container start
sudo service swift-container-replicator start
sudo service swift-container-updater start
sudo service swift-container-auditor start
sudo service swift-account start
sudo service swift-account-replicator start
sudo service swift-account-updater start
sudo service swift-account-auditor start sudo swift-init all start (有效)
或 sudo swift-init object-server start
sudo swift-init object-replicator start
sudo swift-init object-updater start
sudo swift-init object-auditor start
sudo swift-init container-server start
sudo swift-init container-replicator start
sudo swift-init container-updater start
sudo swift-init container-auditor start
sudo swift-init account-server start
sudo swift-init account-replicator start
sudo swift-init account-auditor start ------------------------------------------Verify the Installation-------------------------------------------------------------
.验证Swift安装
.1设置变量
export ADMINPASS=swiftpass export SWIFT_PROXY_CONF="/etc/swift/proxy-server.conf" .1验证
swift -V 2.0 -A http://192.168.75.110:5000/v2.0 -U service:swift -K swiftpass stat (有效) curl -d '{"auth":{"tenantName": "service","passwordCredentials":{"username": "swift","password": "swiftpass"}}}' -H "Content-type:application/json" http://192.168.75.110:35357/v2.0/tokens (有效) {
"access": {
"token": {
"issued_at": "2013-07-20T02:20:19.836225",
"expires": "2013-07-21T02:20:19Z",
"id": "MIIHHAYJ.....",
"tenant": {
"description": "Service Tenant",
"enabled": true,
"id": "5e3af2dac2d1451ba90c4f151a40a463",
"name": "service"
}
},
"serviceCatalog": [
{
"endpoints": [
{
"adminURL": "http://192.168.75.110:8888/v1",
"region": "RegionOne",
"internalURL": "http://192.168.75.110:8888/v1/AUTH_5e3af2dac2d1451ba90c4f151a40a463",
"id": "944b056c8ea44f4bb2f85f350fc6d749",
"publicURL": "http://192.168.75.110:8888/v1/AUTH_5e3af2dac2d1451ba90c4f151a40a463"
}
],
"endpoints_links": [],
"type": "object-store",
"name": "swift"
},
{
"endpoints": [
{
"adminURL": "http://192.168.75.110:8773/services/Admin",
"region": "RegionOne",
"internalURL": "http://192.168.75.110:8773/services/Cloud",
"id": "14c95395690d4d5393ad91c4c9ce0191",
"publicURL": "http://192.168.75.110:8773/services/Cloud"
}
],
"endpoints_links": [],
"type": "ec2",
"name": "ec2"
},
{
"endpoints": [
{
"adminURL": "http://192.168.75.110:35357/v2.0",
"region": "RegionOne",
"internalURL": "http://192.168.75.110:5000/v2.0",
"id": "2c48f04762304a46ae6ae2bacfa0d91a",
"publicURL": "http://192.168.75.110:5000/v2.0"
}
],
"endpoints_links": [],
"type": "identity",
"name": "keystone"
}
],
"user": {
"username": "swift",
"roles_links": [],
"id": "eef77f25cf8b4563bffbcb4d9a6091bc",
"roles": [
{
"name": "_member_"
},
{
"name": "admin"
}
],
"name": "swift"
},
"metadata": {
"is_admin": ,
"roles": [
"9fe2ff9ee4384b1894a90878d3e92bab",
"76f281288ce7401bbb5472f17e7197ec"
]
}
}
} swift -A http://192.168.75.110:5000/v2.0 -U service:swift -K swiftpass upload myfiles bigfile1.tgz .3上传文件
swift upload myfiles bigfile1.tgz (有效) swift -V 2.0 -A http://192.168.75.110:5000/v2.0 -U service:swift -K swiftpass stat (有效)
.4下载文件 swift -A http://192.168.75.110:5000/v2.0 -U service:swift -K swiftpass download myfiles swift download myfiles (有效) http://blog.csdn.net/gjhnorth/article/details/9036869 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
http://www.openstack.org.cn/ask/?q-24.html
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Swift多节点安装 安装环境:
Proxy Node:192.168.5.152
Storage Node1:192.168.5.155
Storage Node1:192.168.5.156
Storage Node1:192.168.5.157 一、 安装配置存储节点(Storage Node)
在192.168.5.155存储节点上进行操作,其他存储节点操作内容相同 、 安装需要的软件包 apt-get update apt-get install swift swift-account swift-container swift-object swift-doc xfsprogs 、 创建loopback设备(假设为sdb1)分出一个分区然后格式化 fdisk /dev/sdb mkfs.xfs -i size= /dev/sdb1 上面的方法是官方文档上的方法,也是推荐的方法,我使用的是创建回环设备来存
dd if=/dev/zero of=/srv/swift-node bs= count= seek=
mkfs.xfs -i size= /srv/swift-node 、 更新fstab文件 cat >> /etc/fstab <<EOF /dev/sdb1 /swift/node/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=
/dev/sdc1 /swift/node/sdc1 xfs loop,noatime,nodiratime,nobarrier,logbufs=
/dev/sdd1 /swift/node/sdd1 xfs loop,noatime,nodiratime,nobarrier,logbufs=
/dev/sde1 /swift/node/sde1 xfs loop,noatime,nodiratime,nobarrier,logbufs=
EOF 、 挂载 mkdir -p /swift/node/sdb1
mkdir -p /swift/node/sdc1
mkdir -p /swift/node/sdd1
mkdir -p /swift/node/sde1 mount /swift/node/sdb1
mount /swift/node/sdc1
mount /swift/node/sdd1
mount /swift/node/sde1 chown -R swift:swift /swift 注意 没有赋权限,会导致创建失败 、 创建swift的配置文件 cat >/etc/swift/swift.conf <<EOF [swift-hash] # random unique string that can never change (DO NOT LOSE) swift_hash_path_suffix = `od -t x8 -N -A n </dev/random` EOF Note: 这个文件所有的存储节点和代理节点共用,可以用scp拷贝到其它节点 、 安装rsync apt-get install rsync 、 创建rsync配置文件 cat > /etc/rsyncd.conf << EOF
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 192.168.5.155 [account]
max connections =
path = /swift/node
read only = false
lock file = /var/lock/account.lock [container]
max connections =
path = /swift/node
read only = false
lock file = /var/lock/container.lock [object]
max connections =
path = /swift/node
read only = false
lock file = /var/lock/object.lock EOF
注意:path 写你实际的(刚才新建的)分区的位置。address修改为当前storage的地址。 、 启用rsync perl -pi -e 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/' /etc/default/rsync 、 启动rsync service rsync start 、 配置account服务 cat > /etc/swift/account-server.conf << EOF
[DEFAULT] devices = /swift/node mount_check = false bind_ip = 0.0.0.0 bind_port = workers = log_facility = LOG_LOCAL3 [pipeline:main] pipeline = account-server [app:account-server] use = egg:swift#account [account-replicator] [account-auditor] [account-reaper] EOF 、 配置container服务 cat > /etc/swift/container-server.conf << EOF
[DEFAULT] devices = /swift/node mount_check = false bind_ip = 0.0.0.0 bind_port = workers = log_facility = LOG_LOCAL2 [pipeline:main] pipeline = container-server [app:container-server] use = egg:swift#container [container-replicator] [container-updater] [container-auditor] [container-sync] EOF 、 配置object服务 cat > /etc/swift/object-server.conf << EOF
[DEFAULT] devices = /swift/node/ mount_check = false bind_ip = 0.0.0.0 bind_port = workers = log_facility = LOG_LOCAL1 [pipeline:main] pipeline = object-server [app:object-server] use = egg:swift#object [object-replicator] [object-updater] [object-auditor] [object-expirer] EOF 、 创建swift日志配置文件 cat > /etc/rsyslog.d/-swift.conf << EOF local1,local2,local3.* /var/log/swift/all.log local1.* /var/log/swift/object.log local2.* /var/log/swift/container.log local3.* /var/log/swift/account.log EOF 、 创建日志目录 mkdir -p /var/log/swift chown -R syslog.adm /var/log/swift 、 重启日志服务进程 service rsyslog restart 二、 安装配置代理节点(Proxy Node) 、 安装需要的软件包 apt-get update apt-get install swift swift-proxy swift-doc memcached 、 修改memcached配置文件 perl -pi -e "s/-l 127.0.0.1/-l 192.168.5.152/" /etc/memcached.conf 、 重启memcached服务 service memcached restart 、 从存储节点拷贝swift配置文件 mkdir /etc/swift scp root@192.168.5.155:/etc/swift/swift.conf /etc/swift 、 创建proxy-server配置文件
--------------------------tempauth认证------------------------------------------------
cat > /etc/swift/proxy-server.conf << EOF
[DEFAULT]
bind_port =
bind_ip = 192.168.5.152
user = swift [pipeline:main]
pipeline = healthcheck cache tempauth proxy-server [app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
account_autocreate = true [filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3 [filter:healthcheck]
use = egg:swift#healthcheck [filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.5.152:
EOF -----------------------------keystone认证----------------------------------------------------------
cat > /etc/swift/proxy-server.conf << EOF
[DEFAULT]
bind_port =
bind_ip = 192.168.5.152
user = swift
log_level = DEBUG
log_facility = LOG_LOCAL1 [pipeline:main]
pipeline = healthcheck cache authtoken keystone proxy-server [app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
account_autocreate = true [filter:keystone]
paste.filter_factory = keystone.middleware.swift_auth:filter_factory
operator_roles = admin, swiftoperator [filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
delay_auth_decision =
auth_port =
auth_host = 192.168.5.152
auth_protocol = http
service_protocol = http
service_host = 192.168.5.152
service_port =
admin_tenant_name = service
admin_user = swift
admin_password = [filter:healthcheck]
use = egg:swift#healthcheck [filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.5.152:
EOF 、 创建swift日志配置文件 cat > /etc/rsyslog.d/-swift.conf << EOF local1.* /var/log/swift/proxy.log EOF 、 创建日志目录 mkdir -p /var/log/swift chown -R syslo.adm /var/log/swift 、 重启日志服务进程 service rsyslog restart 、 首先创建环 cd /etc/swift swift-ring-builder account.builder create swift-ring-builder container.builder create swift-ring-builder object.builder create Note: 后面的数字第一个为存储分区数,第二个为备份次数,备份次数不能小于ZONE数目,第三个为延迟删除的时间,以小时为单位 、向环里添加存储设备我前面配置了三台存储节点: |---------+------+-----------+-----------+------+--------| | Storage | Zone | IP | Server | Port | Device | |---------+------+-----------+-----------+------+--------| | | |192.168.5.155| account | | sdb1 | | | | | container | | sdb1 | | | | | object | | sdb1 | |---------+------+-----------+-----------+------+--------| | | |192.168.5.156 | account | | sdb1 | | | | | container | | sdb1 | | | | | object | | sdb1 | |---------+------+-----------+-----------+------+--------| | | |192.168.5.157 | account | | sdb1 | | | | | container | | sdb1 | | | | | object | | sdb1 |
|---------+------+-----------+-----------+------+--------| cd /etc/swift swift-ring-builder account.builder add z1-192.168.5.155:/sdb1 swift-ring-builder container.builder add z1-192.168.5.155:/sdb1 swift-ring-builder object.builder add z1-192.168.5.155:/sdb1 swift-ring-builder account.builder add z2-192.168.5.156:/sdb1 swift-ring-builder container.builder add z2-192.168.5.156:/sdb1 swift-ring-builder object.builder add z2-192.168.5.156:/sdb1 swift-ring-builder account.builder add z3-192.168.5.157:/sdb1 swift-ring-builder container.builder add z3-192.168.5.157:/sdb1 swift-ring-builder object.builder add z3-192.168.5.157:/sdb1 Note: IP,端口,设备和前面的配置对应 、 检验每个环里的条目 cd /etc/swift swift-ring-builder account.builder swift-ring-builder container.builder swift-ring-builder object.builder 应该得到类似这样的输出 account.builder, build version
partitions, replicas, zones, devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is
Devices: id zone ip address port name weight partitions balance meta
192.168.5.155 sdb1 100.00 0.00
192.168.5.156 sdb1 100.00 0.00
192.168.5.157 sdb1 100.00 0.00 、 平衡环 cd /etc/swift swift-ring-builder account.builder rebalance swift-ring-builder container.builder rebalance swift-ring-builder object.builder rebalance Note: 这个过程可能需要一些时间 Note: 这三条命令会产生以gz结尾的文件,这些文件就是所有节点要用到的环文件,可以用scp拷贝到其它各节点 Note: 如果创建环的时候指定的副本数大于环的数量,平衡环的时候可能会报类似下面的错误 ... in _initial_balance while available_devs[index]['zone'] in other_zones: IndexError: list index out of range 、 分发新生成的环文件 scp /etc/swift/*.gz root@192.168.5.155:/etc/swift/ scp /etc/swift/*.gz root@192.168.5.156:/etc/swift/ scp /etc/swift/*.gz root@192.168.5.157:/etc/swift/ 16、 启动各节点相关的服务 # 代理节点 swift-init proxy start # 存储节点 swift-init all start 三、测试swift 1、得到an X-Storage-Url 和X-Auth-Token
root@node11:/etc/swift# curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://192.168.5.152:8080/auth/v1.0
* About to connect() to 192.168.5.152 port 8080 (#0)
* Trying 192.168.5.152... connected
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 192.168.5.152:8080
> Accept: */*
> X-Storage-User: test:tester
> X-Storage-Pass: testing
>
< HTTP/1.1 OK
< X-Storage-Url: http://192.168.5.152:8080/v1/AUTH_test
< X-Storage-Token: AUTH_tk51644b8e782040f6ab788caa23ad6a1b
< X-Auth-Token: AUTH_tk51644b8e782040f6ab788caa23ad6a1b
< Content-Length:
< Date: Thu, Oct :: GMT
<
* Connection # to host 192.168.5.152 left intact
* Closing connection # root@node11:/etc/swift# curl -v -H 'X-Auth-Token: AUTH_tk51644b8e782040f6ab788caa23ad6a1b' http://192.168.5.152:8080/v1/AUTH_test
* About to connect() to 192.168.5.152 port (#)
* Trying 192.168.5.152... connected
> GET /v1/AUTH_test HTTP/1.1
> User-Agent: curl/7.22. (x86_64-pc-linux-gnu) libcurl/7.22. OpenSSL/1.0. zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 192.168.5.152:
> Accept: */*
> X-Auth-Token: AUTH_tk51644b8e782040f6ab788caa23ad6a1b
>
< HTTP/1.1 204 No Content
< X-Account-Object-Count: 0
< X-Account-Bytes-Used: 0
< X-Account-Container-Count: 0
< Accept-Ranges: bytes
< Content-Length: 0
< Date: Thu, 11 Oct 2012 07:48:24 GMT
<
* Connection #0 to host 192.168.5.152 left intact
* Closing connection #0 测试swift目前工作状态
swift -A http://192.168.5.152:8080/auth/v1.0 -U test:tester -K testing stat 将当前目录下test.txt文件上传到myfiles目录
swift -A http://192.168.5.152:8080/auth/v1.0 -U test:tester -K testing upload myfiles test.txt
Swift安装的更多相关文章
- OpenStack swift安装
由于实验室项目需要云存储系统,因此在实验室服务器上搭建一个基于OpenStack swift的云存储系统. 最开始按照官方网站上介绍的方法,使用SAIO方式安装http://docs.openstac ...
- Object Storage(Swift)安装过程——Havana
自从看了Havana安装文档有关Swift的安装一节,发现H版的安装过程与以前还是有些差别的.不过大致过程还是那些.下面简单介绍下我们安装的过程吧,具体请参考官方文档http://docs.opens ...
- openstack swift 安装(单独对象存储服务)
参考:https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/swift.html 安装YUM包 yum install centos-re ...
- 快速上传到rackspace cdn工具turbolift swift 安装
快速上传到rackspace cdn 工具安装,2步即可完成: 1.安装git CentOS的yum源中没有git,只能自己编译安装,现在记录下编译安装的内容,留给自己备忘. 确保已安装了依赖的包 y ...
- 理解 OpenStack Swift (1):OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置
本系列文章着重学习和研究OpenStack Swift,包括环境搭建.原理.架构.监控和性能等. (1)OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置 ( ...
- Linux(Ubuntu)安装Swift和Swiftlint
很多时候iOS开发完毕需要接入CI中,而很多CI是基于Linux的,需要在Linux平台安装Swift和Swiftlint,下面就是针对这两个软件的安装步骤. Swift安装 环境 系统:Ubuntu ...
- swift 单独部署,开发
部署环境 virtualBox Ubuntu 14.04 desktop OpenStack Swift (kilo) 说明 此文档为基于官方修改的只针对Ubuntu 14.04,完整的参阅官方文档 ...
- OpenStack云计算快速入门之二:OpenStack安装与配置
原文:http://blog.chinaunix.net/uid-22414998-id-3265685.html OpenStack云计算----快速入门(2) 该教程基于Ubuntu12.04版, ...
- 【OpenStack】OpenStack系列3之Swift详解
Swift安装部署(与keystone依赖包有冲突,需要安装不同版本eventlet) 参考:http://www.server110.com/openstack/201402/6662.html h ...
随机推荐
- Tools - Git与GitHub
Git Wiki - Git 开源的分布式版本控制系统,用于敏捷高效地管理项目版本. Git - HomePage Git - CHEAT SHEET git_cheat_sheet.pdf GitH ...
- 初探JavaScript(三)——JS带我"碰壁"带我飞
已经写了两篇关于小白的JavaScript之行,不可否认,每一种语言都有其精华与糟粕之处,来不及细细体味其精华奥妙,也没法对其评头论足,只能先了解,后深入.到目前为止已经看完<JavaScrip ...
- 3.创建第一个android项目
安卓开发学习笔记 1.安卓开发之环境搭建 2.SDK目录结构和adb工具及命令介绍 3.创建第一个android项目 1.打开Eclipse,选择File——>new——>others.. ...
- asp.net App_Code文件夹相关操作
最近用到了App_Code文件夹,想要实现动态编译文件的方式,即替换文件夹中的类文件从而达到实时修改代码的效果,类似web.config,网上查到的资料基本都是把文件夹中的类文件修改属性为" ...
- jQuery 简介和安装
什么是jQuery jQuery是一个轻量级的"写的少,做的多"的JavaScript库. jQuery库包含以下功能: HTML 元素选取 HTML 元素操作 CSS 操作 HT ...
- web框架--bottle
安装 2 3 4 pip install bottle easy_install bottle apt-get install python-bottle wget http://bottlepy.o ...
- SQL Server时间粒度系列----第5节小时、分钟时间粒度详解
本文目录列表: 1.SQL Server小时时间粒度2.SQL Server分钟时间粒度 3.总结语 4.参考清单列表 SQL Server小时时间粒度 这里说的时间粒度是指带有 ...
- REOBJECT 结构
REOBJECT 结构 包含有关 rich edit 控件中的 OLE 或图像对象的信息. 语法 typedef struct _reobject { DWORD cbStru ...
- VS2012 JSON、XML自动生成对应的类
在VS编辑下拉框中,选择选择性粘贴(Paste Special)
- 使用ViewModel来实现多个Model传送至视图
在开发ASP.NET MVC时,我们会遇上这样的情形,需要一次性传送多个Model从控制器Controller至视图View. 实现很简单,只是创建一个集合类即可. Ok,下面先在数据库准备一些数据, ...