apt 安装swift
2016-10-26 22:04:00 weixin_33858336 阅读数 26

一、Swift的安装

安装目标,使用Keystone替代swift内置的认证节点,配套代理节点与存储节点提供存储服务

  1. 创建代理节点虚拟机
  2. 创建存储节点虚拟机
  3. 安装Proxy代理服务
  4. 安装配置Swift依赖的Keystone
  5. 注册Swift服务:就是将Swift服务注册到Keystone中,这时候Keystone扮演了服务治理的角色

二、配置Proxy服务

  1. 添加用户:保证swift存储服务能在linux上运行
  2. 生成散列值:将数据分割存放到某些指定的目录
  3. 配置memcached服务,允许从任意节点访问
  4. default的配置:默认IP、端口及用户的配置
  5. 生成证书:就是设置openssl证书
  6. 配置pipeline:提供pipeline的访问能力,通过filter的方式进行消息的处理
  7. Keystone认证配置:支持Keystone认证
  8. 修改权限:保证swift服务可以使用swift用户操作

三、启动Proxy服务

  1. 创建ring:定位存储节点所在位置,设定存储的分区,备份数量,迁移时间
  2. 添加存储节点:将存储节点添加到代理服务上,做好映射
  3. 启动服务:启动代理服务对外提供restful形式的调用能力

四、安装存储服务

  1. 磁盘格式化
    (1)创建swift用户
    (2)格式化分区
    (3)挂载分区
  2. 同步服务配置
    保证多重数据的一致性
  3. Swift存储子服务
    (1)对象服务配置
    (2)容器服务配置
    (3)账户服务配置
  4. 启动存储服务

五、存储服务管理

  1. 查看存储服务:客直接通过shell命令查看
  2. 删除存储节点:存储节点失效,可以删除,备份节点承担数据存储能力
  3. 添加存储节点:数据会按照规则进行迁移复制
  4. 添加代理节点:可以将其他代理节点的swift文件拷贝,直接启动服务即可
2018-08-09 16:28:51 ywmack 阅读数 605

openstack 版本为Q版

服务器系统:centos7

控制节点:192.168.50.31

swift存储节点: 192.168.50.32

swift存储节点: 192.168.50.33

swift存储节点: 192.168.50.33

所有存储节点操作:

#安装相关软件
yum install xfsprogs rsync 

#格式化对应分区 
mkfs.xfs /dev/sdc1

#创建文件夹
mkdir -p /swift/node/sdc1

#fstab挂载磁盘
vim /etc/fstab
/dev/sdc1 /swift/node/sdc1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 2

# mount挂载
mount /dev/sdc1 /swift/node/sdc1

# 编辑配置文件
vim /etc/rsyncd.conf
 
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 192.168.50.32(这里有几台 就写能对应的IP地址)

[account]
max connections = 2
path = /swift/node/
read only = False
lock file = /var/lock/account.lock

[container]
max connections = 2
path = /swift/node/
read only = False
lock file = /var/lock/container.lock

[object]
max connections = 2
path = /swift/node/
read only = False
lock file = /var/lock/object.lock


# 配置服务
systemctl enable rsyncd.service
systemctl start rsyncd.service


# 安装swift
yum install openstack-swift-account openstack-swift-container \
  openstack-swift-object
  

# 下载替换配置文件
curl -o /etc/swift/account-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/account-server.conf-sample?h=stable/queens
curl -o /etc/swift/container-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/container-server.conf-sample?h=stable/queens
curl -o /etc/swift/object-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/object-server.conf-sample?h=stable/queens 


# 编辑配置文件account-server.conf
vim /etc/swift/account-server.conf
[DEFAULT]
bind_ip = 192.168.50.32(对应存储节点的IP)
bind_port = 6202
user = swift
swift_dir = /etc/swift
devices = /swift/node/
mount_check = True
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift

# 编辑配置文件container-server.conf
vim /etc/swift/container-server.conf
[DEFAULT]
bind_ip = 192.168.50.32(对应存储节点的IP)
bind_port = 6201
user = swift
swift_dir = /etc/swift
devices = /swift/node/
mount_check = True

[pipeline:main]
pipeline = healthcheck recon container-server

[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift

# 编辑配置文件object-server.conf
vim /etc/swift/object-server.conf
[DEFAULT]
bind_ip = 192.168.50.32(对应存储节点的IP)
bind_port = 6200
user = swift
swift_dir = /etc/swift
devices = /swift/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 /swift/node/
mkdir -p /var/cache/swift
chown -R root:swift /var/cache/swift
chmod -R 775 /var/cache/swift

# 在控制节点操作

cd /etc/swift   在/etc/swift目录下面操作

swift-ring-builder account.builder create 10 3 1
swift-ring-builder account.builder add \
  --region 1 --zone 1 --ip 192.168.50.32 --port 6202 --device sdc1 --weight 100
swift-ring-builder account.builder add \
  --region 1 --zone 1 --ip 192.168.50.33 --port 6202 --device sdc1 --weight 100
swift-ring-builder account.builder add \
  --region 1 --zone 1 --ip 192.168.50.34 --port 6202 --device sdc1 --weight 100 
swift-ring-builder account.builder
swift-ring-builder account.builder rebalance


swift-ring-builder container.builder create 10 3 1
swift-ring-builder container.builder add \
  --region 1 --zone 1 --ip 192.168.50.32 --port 6201 --device sdc1 --weight 100
swift-ring-builder container.builder add \
  --region 1 --zone 1 --ip 192.168.50.33 --port 6201 --device sdc1 --weight 100  
swift-ring-builder container.builder add \
  --region 1 --zone 1 --ip 192.168.50.34 --port 6201 --device sdc1 --weight 100 
swift-ring-builder container.builder
swift-ring-builder container.builder rebalance


swift-ring-builder object.builder create 10 3 1
swift-ring-builder object.builder add \
  --region 1 --zone 1 --ip 192.168.50.32 --port 6200 --device sdc1 --weight 100
swift-ring-builder object.builder add \
  --region 1 --zone 1 --ip 192.168.50.33 --port 6200 --device sdc1 --weight 100  
swift-ring-builder object.builder add \
  --region 1 --zone 1 --ip 192.168.50.34 --port 6200 --device sdc1 --weight 100  
swift-ring-builder object.builder
swift-ring-builder object.builder rebalance

#把/etc/swift的gz文件复制到另外两台
scp /etc/swift/*.gz root@192.168.50.32:/etc/swift
scp /etc/swift/*.gz root@192.168.50.33:/etc/swift
scp /etc/swift/*.gz root@192.168.50.34:/etc/swift

# 下载替换配置文件
curl -o /etc/swift/swift.conf \
  https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample?h=stable/queens

vim /etc/swift/swift.conf 
[swift-hash]
swift_hash_path_suffix = jzdata
swift_hash_path_prefix = jzdata
[storage-policy:0]
name = Policy-0
default = yes

#把/etc/swift的swift.conf文件复制到另外两台
scp /etc/swift/swift.conf  root@192.168.50.32:/etc/swift
scp /etc/swift/swift.conf  root@192.168.50.33:/etc/swift
scp /etc/swift/swift.conf  root@192.168.50.34:/etc/swift

# 配置服务
systemctl enable openstack-swift-proxy.service memcached.service
systemctl restart openstack-swift-proxy.service memcached.service

所有存储节点执行:

# 给/etc/swift 加权限
chown -R root:swift /etc/swift
#配置服务
systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service \
  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
systemctl start openstack-swift-account.service openstack-swift-account-auditor.service \
  openstack-swift-account-reaper.service openstack-swift-account-replicator.service
systemctl enable openstack-swift-container.service \
  openstack-swift-container-auditor.service openstack-swift-container-replicator.service \
  openstack-swift-container-updater.service
systemctl start openstack-swift-container.service \
  openstack-swift-container-auditor.service openstack-swift-container-replicator.service \
  openstack-swift-container-updater.service
systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service \
  openstack-swift-object-replicator.service openstack-swift-object-updater.service
systemctl start openstack-swift-object.service openstack-swift-object-auditor.service \
  openstack-swift-object-replicator.service openstack-swift-object-updater.service

2017-05-10 11:38:14 xuqiaobo 阅读数 2272

Swift对象存储服务组件利用标准的x86架构服务器组成集群,提供具备冗余性和可扩展性的数据存储,它属于持久性存储,可以长久保存数据,支持对数据的检索和更新功能。swift对象存储服务组件使用分布式架构,没有控制单点,提供更高的冗余性和扩展性,数据被保存到多个主机节点的多个硬件设备上,由软件负责进行数据复制和数据容错,当主机节点不可用时,该主机节点上的数据会自动复制到其他可用的主机节点上。

一,控制节点的安装和配置

在控制节点上安装和配置Proxy服务,可以处理Account、Container和Object在存储节点上的请求。

1)准备

在Openstack项目中,Proxy服务依赖于keystone身份认证服务组件,需要keystone身份认证服务组件提供的认证和授权机制。

Swift对象存储不使用控制节点的SQL数据库,而是使用每个存储节点上分布式SQLite数据库。

(1)加载admin user 的环境变量

(2)创建Identity服务凭据

1,创建Swift用户

2,将admin role赋予swift user和service project

3,创建swift service entity

4,创建Swift对象存储服务组件的API endpoint

2)安装和配置swift对象存储服务组件

(1)安装软件包

(2)编辑/etc/swift/proxy-server.conf文件,完成以下操作

1,在[DEFAULT]项,配置Swift对象存储服务组件使用的端口、用户和配置路径

2,在[pipeline:main]项,启用相关的模块

3,在[app:proxy-server]项,启用自动账户创建

4,在[filter:keystoneauth]项,配置操作用户角色

5,在[filter:authtoken]项,配置keystone身份认证服务组件访问

6,在[filter:cache]项,配置MemCached的访问路径

二,存储节点的安装和配置

1)准备

Swift对象存储服务组件要求至少有两个存储节点,支持横向扩展,在本例中采用两个存储节点,每个存储节点包含两个块存储设备,分别是/dev/sdb和/dev/sdc。选择使用XFS文件系统

(1)安装软件包(XFSprogs)

(2)格式化/dev/sdb和/dev/sdc块存储设备为XFS

(3)创建挂载点

(4)编辑/etc/fstab文件,添加一些必要内容

(5)挂在文件系统

(6)编辑/etc/rsyncd.conf文件,添加以下内容

(7)启动rsyncd服务并设置为开机自启动

2)安装和配置Swift对象存储服务组件

(1)安装软件包

(2)编辑/etc/swift/account-server.conf文件,完成以下修改

1,在[DEFAULT]项,配置Account使用的IP地址、端口、用户、配置路径和挂载点。

2,在[pipeline:main]项,启动相关的功能模块

3,在[filter:recon]项,配置recon缓存目录

(3)编辑/etc/swift/contain-server.conf文件,完成以下操作

1,在[DEFAULT]项,配置Container使用的IP地址,端口、用户、配置路径和挂载点

2,在[pipe:main],启动相关功能模块

3,在[filter:recon],配置recon缓存目录

(4)编辑/etc/swift/object-server.conf文件,完成以下操作

1,在[DEFAULT]项,配置Object使用的IP地址,端口、用户、配置路径和挂载点

2,在[pipe:main],启动相关功能模块

3,在[filter:recon],配置recon缓存目录

(5)设置官灾点的属主

(6)创建rcon目录并设置属主

以下操作均在控制节点进行

3)创建Account Ring

Account服务器使用Account Ring维护多个Container

(1)创建/etc/swift/account.builder文件

(2)为Account Ring添加存储节点

(3)确认Ring的内容

(4)重平衡Ring

4)创建Container Ring

Container服务器使用Container Ring维护多个Object,但是Container不能确定Object位置

(1)创建/etc/swift/container.builder文件

(2)为Account Ring添加存储节点

(3)确认Ring的内容

(4)重平衡Ring

5)创建Object Ring

Object 服务器使用Object Ring维护Object的位置信息

(1)创建/etc/swift/object.builder文件

(2)为Account Ring添加存储节点

(3)确认Ring的内容

(4)重平衡Ring

6)分发Ring配置文件

复制控制节点上的/etc/swift/account.ring.gz、/etc/swift/container.ring.gz、/etc/swift/object.ring.gz文件到每个存储节点的/etc/swift目录下,后续添加新的存储节点,每个运行Proxy服务的存储节点都需要执行此操作


2013-03-05 17:43:59 robberboyboy 阅读数 4649
Swift 安装
1 Swift(Proxy+storage)
将swift 和keystone分离安装,4个zone用4块硬盘来替代
1.1 环境说明
机器名    eth0    说明
Cloudtest01    192.168.0.17/24    Keystone glance nova-api nova-volumes
Cloudtest03    192.168.0.21/24    Proxy+storage

1.2 系统ubuntu12.04
最小化安装,只需要安装ssh server就可以。
1.3 设置网络
编辑 /etc/network/interfaces
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.21
netmask 255.255.255.0
gateway 192.168.0.1
dns-search openstack.com
dns-nameservers 8.8.8.8

auto eth1
iface eth1 inet manual
up ifconfig eth1 up
查看当前网卡情况
root@cloudtest03:~# mii-tool
SIOCGMIIREG on eth0 failed: Input/output error
SIOCGMIIREG on eth0 failed: Input/output error
eth0: negotiated 100baseTx-FD flow-control, link ok
1.4 设置hostname
root@cloudtest03:~# hostname cloudtest03
root@cloudtest03:~# cat /etc/hosts
127.0.0.1       localhost
#127.0.1.1      cloudtest03
192.168.0.17    cloudtest01.openstack.com cloudtest01
192.168.0.20    cloudtest02.openstack.com cloudtest02
192.168.0.21    cloudtest03.openstack.com cloudtest03

root@cloudtest03:~# hostname -f
cloudtest03.openstack.com

1.5 安装软件
root@cloudtest03:~# apt-get update  更新源

apt-get -y install swift swift-proxy swift-account swift-container \
 swift-object xfsprogs curl python-pastedeploy python-keystone python-keystoneclient

1.6 分区
对四块硬盘进行分区,每块硬盘划分一块分区
 fdisk /dev/sdc
 fdisk /dev/sdd
fdisk /dev/sde
fdisk /dev/sdf
 mkfs.xfs -i size=1024 /dev/sdc1
mkfs.xfs -i size=1024 /dev/sdd1
mkfs.xfs -i size=1024 /dev/sde1
 mkfs.xfs -i size=1024 /dev/sdf1
 mkdir /mnt/swift_backend
 pushd /mnt/swift_backend
mkdir node1 node2 node3 node4
popd
 
修改/etc/fstab,末尾添加
/dev/sdc1 /mnt/swift_backend/node1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
/dev/sdd1 /mnt/swift_backend/node2 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
/dev/sde1 /mnt/swift_backend/node3 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
/dev/sdf1 /mnt/swift_backend/node4 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
挂载磁盘
mount -a
mount –l  可以查看挂载磁盘情况
创建连接文件
chown swift.swift /mnt/swift_backend/*
for i in {1..4}; do sudo ln -s /mnt/swift_backend/node$i /srv/node$i; done;
mkdir -p /etc/swift/account-server \
/etc/swift/container-server \
/etc/swift/object-server \
mkdir /run/swift
chown -L -R swift.swift /etc/swift /srv/node[1-4]/ /run/swift
系统启动时启动Swift服务,需要把如下两行命令写入 /etc/rc.local里,位置在“exit 0;”之前:
sudo mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
sudo chown swift:swift /var/cache/swift*
soudo mkdir -p /var/run/swift
sudo chown swift:swift /var/run/swift

1.7 配置rsync
sed -i 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' /etc/default/rsync

创建/etc/rsyncd.conf
# General stuff
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /run/rsyncd.pid
address = 127.0.0.1

# Account Server replication settings
[account6012]
max connections = 25
path = /srv/node1/
read only = false
lock file = /run/lock/account6012.lock

[account6022]
max connections = 25
path = /srv/node2/
read only = false
lock file = /run/lock/account6022.lock

[account6032]
max connections = 25
path = /srv/node3/
read only = false
lock file = /run/lock/account6032.lock

[account6042]
max connections = 25
path = /srv/node4/
read only = false
lock file = /run/lock/account6042.lock

# Container server replication settings

[container6011]
max connections = 25
path = /srv/node1/
read only = false
lock file = /run/lock/container6011.lock

[container6021]
max connections = 25
path = /srv/node2/
read only = false
lock file = /run/lock/container6021.lock

[container6031]
max connections = 25
path = /srv/node3/
read only = false
lock file = /run/lock/container6031.lock

[container6041]
max connections = 25
path = /srv/node4/
read only = false
lock file = /run/lock/container6041.lock

# Object Server replication settings

[object6010]
max connections = 25
path = /srv/node1/
read only = false
lock file = /run/lock/object6010.lock

[object6020]
max connections = 25
path = /srv/node2/
read only = false
lock file = /run/lock/object6020.lock

[object6030]
max connections = 25
path = /srv/node3/
read only = false
lock file = /run/lock/object6030.lock

[object6040]
max connections = 25
path = /srv/node4/
read only = false
lock file = /run/lock/object6040.lock

重启服务
service rsync restart

1.8 设置日志
创建 /etc/rsyslog.d/10-swift.conf
# Uncomment the following to have a log containing all logs together
#local1,local2,local3,local4,local5.*   /var/log/swift/all.log

# Uncomment the following to have hourly proxy logs for stats processing
#$template HourlyProxyLog,"/var/log/swift/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%"
#local1.*;local1.!notice ?HourlyProxyLog

local1.*;local1.!notice /var/log/swift/proxy.log
local1.notice           /var/log/swift/proxy.error
local1.*                ~

local2.*;local2.!notice /var/log/swift/storage1.log
local2.notice           /var/log/swift/storage1.error
local2.*                ~

local3.*;local3.!notice /var/log/swift/storage2.log
local3.notice           /var/log/swift/storage2.error
local3.*                ~

local4.*;local4.!notice /var/log/swift/storage3.log
local4.notice           /var/log/swift/storage3.error
local4.*                ~

local5.*;local5.!notice /var/log/swift/storage4.log
local5.notice           /var/log/swift/storage4.error
local5.*                ~
编辑 /etc/rsyslog.conf
$PrivDropToGroup adm
创建文件并重启rsyslog服务
mkdir -p /var/log/swift/hourly
chown -R syslog.adm /var/log/swift
chmod -R g+w /var/log/swift
service rsyslog restart

1.9 配置proxy-server
[DEFAULT]
bind_port = 8080
user = swift
swift_dir = /etc/swift

[pipeline:main]
# Order of execution of modules defined below
pipeline = catch_errors healthcheck cache authtoken keystone proxy-server

[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
account_autocreate = true
set log_name = swift-proxy
set log_facility = LOG_LOCAL0
set log_level = INFO
set access_log_name = swift-proxy
set access_log_facility = SYSLOG
set access_log_level = INFO
set log_headers = True
account_autocreate = True

[filter:healthcheck]
use = egg:swift#healthcheck

[filter:catch_errors]
use = egg:swift#catch_errors

[filter:cache]
use = egg:swift#memcache
set log_name = cache

[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
auth_protocol = http
auth_host = 192.168.0.17
auth_port = 35357
auth_token = zhizheng
service_protocol = http
service_host = 192.168.0.17
service_port = 5000
admin_token = zhizheng
admin_tenant_name = service
admin_user = swift
admin_password = zhizheng
delay_auth_decision = 0

[filter:keystone]
paste.filter_factory = keystone.middleware.swift_auth:filter_factory
operator_roles = admin, swiftoperator
is_admin = true
创建/etc/swift/swift.conf
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 8 -A n </dev/random`
EOF

2.0 Account Server, Container Server, Object Server
创建/etc/swift/account-server/1.conf
cat > /etc/swift/account-server/1.conf <<EOF
[DEFAULT]
devices = /srv/node1
mount_check = false
bind_port = 6012
user = swift
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
 
[pipeline:main]
pipeline = account-server

[app:account-server]
use = egg:swift#account
 
[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]
EOF
创建/etc/swift/container-server/1.conf
cat >/etc/swift/container-server/1.conf <<EOF
[DEFAULT]
devices = /srv/node1
mount_check = false
bind_port = 6011
user = swift
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift


[pipeline:main]
pipeline = container-server

[app:container-server]
use = egg:swift#container

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
EOF

创建/etc/swift/object-server/1.conf
cat > /etc/swift/object-server/1.conf <<EOF
[DEFAULT]
devices = /srv/node1
mount_check = false
bind_port = 6010
user = swift
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift

[pipeline:main]
pipeline = object-server

[app:object-server]
use = egg:swift#object

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]
EOF
创建/etc/swift/account-server/2.conf
cat > /etc/swift/account-server/2.conf <<EOF
[DEFAULT]
devices = /srv/node2
mount_check = false
bind_port = 6022
user = swift
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
 
[pipeline:main]
pipeline = account-server

[app:account-server]
use = egg:swift#account
 
[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]
EOF
创建/etc/swift/container-server/2.conf
cat >/etc/swift/container-server/2.conf <<EOF
[DEFAULT]
devices = /srv/node2
mount_check = false
bind_port = 6021
user = swift
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2


[pipeline:main]
pipeline = container-server

[app:container-server]
use = egg:swift#container

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
EOF

创建/etc/swift/object-server/2.conf
cat > /etc/swift/object-server/2.conf <<EOF
[DEFAULT]
devices = /srv/node2
mount_check = false
bind_port = 6020
user = swift
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2

[pipeline:main]
pipeline = object-server

[app:object-server]
use = egg:swift#object

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]
EOF
创建/etc/swift/account-server/3.conf
cat > /etc/swift/account-server/3.conf <<EOF
[DEFAULT]
devices = /srv/node3
mount_check = false
bind_port = 6032
user = swift
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
 
[pipeline:main]
pipeline = account-server

[app:account-server]
use = egg:swift#account
 
[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]
EOF
创建/etc/swift/container-server/3.conf
cat >/etc/swift/container-server/3.conf <<EOF
[DEFAULT]
devices = /srv/node3
mount_check = false
bind_port = 6031
user = swift
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3


[pipeline:main]
pipeline = container-server

[app:container-server]
use = egg:swift#container

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
EOF

创建/etc/swift/object-server/3.conf
cat > /etc/swift/object-server/3.conf <<EOF
[DEFAULT]
devices = /srv/node3
mount_check = false
bind_port = 6030
user = swift
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3

[pipeline:main]
pipeline = object-server

[app:object-server]
use = egg:swift#object

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]
EOF
创建/etc/swift/account-server/4.conf
cat > /etc/swift/account-server/4.conf <<EOF
[DEFAULT]
devices = /srv/node4
mount_check = false
bind_port = 6042
user = swift
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
 
[pipeline:main]
pipeline = account-server

[app:account-server]
use = egg:swift#account
 
[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]
EOF
创建/etc/swift/container-server/4.conf
cat >/etc/swift/container-server/4.conf <<EOF
[DEFAULT]
devices = /srv/node4
mount_check = false
bind_port = 6041
user = swift
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4


[pipeline:main]
pipeline = container-server

[app:container-server]
use = egg:swift#container

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
EOF

创建/etc/swift/object-server/4.conf
cat > /etc/swift/object-server/4.conf <<EOF
[DEFAULT]
devices = /srv/node4
mount_check = false
bind_port = 6040
user = swift
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4

[pipeline:main]
pipeline = object-server

[app:object-server]
use = egg:swift#object

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]
EOF

最后别忘了编辑 sync
cat <<EOF >>/etc/swift/container-server.conf
[container-sync]
EOF

2.1 确认目录更改权限
chown -R swift.swift /etc/swift
chown -R swift.swift /srv   
chown -R swift.swift /mnt/swift_backend/
2.2 ring server
pushd /etc/swift
swift-ring-builder object.builder create 18 3 1
swift-ring-builder container.builder create 18 3 1
swift-ring-builder account.builder create 18 3 1
swift-ring-builder object.builder add z1-192.168.0.21:6010/sdc 1
swift-ring-builder object.builder add z2-192.168.0.21:6020/sdd 1
swift-ring-builder object.builder add z3-192.168.0.21:6030/sde 1
swift-ring-builder object.builder add z4-192.168.0.21:6040/sdf 1
swift-ring-builder container.builder add z1-192.168.0.21:6011/sdc 1
swift-ring-builder container.builder add z2-192.168.0.21:6021/sdd 1
swift-ring-builder container.builder add z3-192.168.0.21:6031/sde 1
swift-ring-builder container.builder add z4-192.168.0.21:6041/sdf 1
swift-ring-builder account.builder add z1-192.168.0.21:6012/sdc 1
swift-ring-builder account.builder add z2-192.168.0.21:6022/sdd 1
swift-ring-builder account.builder add z3-192.168.0.21:6032/sde 1
swift-ring-builder account.builder add z4-192.168.0.21:6042/sdf 1
swift-ring-builder object.builder rebalance
swift-ring-builder container.builder rebalance
swift-ring-builder account.builder rebalance
2.3 启动服务
swift-init main start
swift-init rest start
2.4 启动proxy-server
swift-init proxy start
swift-init proxy restart
2.5 更改数据库的endpoint使其指向proxy-server地址
root@cloudtest01:/etc/apt# keystone endpoint-list
+----------------------------------+-----------+------------------------------------------------+------------------------------------------------+-------------------------------------------+
|                id                |   region  |                   publicurl                    |                  internalurl                   |                  adminurl                 |
+----------------------------------+-----------+------------------------------------------------+------------------------------------------------+-------------------------------------------+
| 2f73b7eff0844b6d8fea7b80d28696b4 | RegionOne | http://192.168.0.17:8776/v1/%(tenant_id)s      | http://192.168.0.17:8776/v1/%(tenant_id)s      | http://192.168.0.17:8776/v1/%(tenant_id)s |
| 69bf61249b384b75adc2b864a5f006e3 | RegionOne | http://192.168.0.17:9292/v1                    | http://192.168.0.17:9292/v1                    | http://192.168.0.17:9292/v1               |
| 8d34bbe8ffd84feabb0dba4ed522516d | RegionOne | http://192.168.0.17:8773/services/Cloud        | http://192.168.0.17:8773/services/Cloud        | http://192.168.0.17:8773/services/Admin   |
| 98f0d799541c4ae9ac37176a473dbe30 | RegionOne | http://192.168.0.17:5000/v2.0                  | http://192.168.0.17:5000/v2.0                  | http://192.168.0.17:35357/v2.0            |
| b7b2384fdbc1488293c1d38c0e7465e1 | RegionOne | http://192.168.0.17:8774/v2/%(tenant_id)s      | http://192.168.0.17:8774/v2/%(tenant_id)s      | http://192.168.0.17:8774/v2/%(tenant_id)s |
| d7c721763cec4827aecfff71d75b1020 | RegionOne | http://192.168.0.17:8080/v1/AUTH_%(tenant_id)s | http://192.168.0.17:8080/v1/AUTH_%(tenant_id)s | http://192.168.0.17:8080/v1               |
+----------------------------------+-----------+------------------------------------------------+------------------------------------------------+-------------------------------------------+
Swift的endpoint目前指向的是192.168.0.17 控制节点自身,修改数据库将其指向192.168.0.21的proxy-server地址
root@cloudtest01:/etc/apt# keystone endpoint-list
+----------------------------------+-----------+------------------------------------------------+------------------------------------------------+-------------------------------------------+
|                id                |   region  |                   publicurl                    |                  internalurl                   |                  adminurl                 |
+----------------------------------+-----------+------------------------------------------------+------------------------------------------------+-------------------------------------------+
| 2f73b7eff0844b6d8fea7b80d28696b4 | RegionOne | http://192.168.0.17:8776/v1/%(tenant_id)s      | http://192.168.0.17:8776/v1/%(tenant_id)s      | http://192.168.0.17:8776/v1/%(tenant_id)s |
| 69bf61249b384b75adc2b864a5f006e3 | RegionOne | http://192.168.0.17:9292/v1                    | http://192.168.0.17:9292/v1                    | http://192.168.0.17:9292/v1               |
| 8d34bbe8ffd84feabb0dba4ed522516d | RegionOne | http://192.168.0.17:8773/services/Cloud        | http://192.168.0.17:8773/services/Cloud        | http://192.168.0.17:8773/services/Admin   |
| 98f0d799541c4ae9ac37176a473dbe30 | RegionOne | http://192.168.0.17:5000/v2.0                  | http://192.168.0.17:5000/v2.0                  | http://192.168.0.17:35357/v2.0            |
| b7b2384fdbc1488293c1d38c0e7465e1 | RegionOne | http://192.168.0.17:8774/v2/%(tenant_id)s      | http://192.168.0.17:8774/v2/%(tenant_id)s      | http://192.168.0.17:8774/v2/%(tenant_id)s |
| d7c721763cec4827aecfff71d75b1020 | RegionOne | http://192.168.0.21:8080/v1/AUTH_%(tenant_id)s | http://192.168.0.21:8080/v1/AUTH_%(tenant_id)s | http://192.168.0.21:8080/v1               |
+----------------------------------+-----------+------------------------------------------------+------------------------------------------------+-------------------------------------------+
2.6 设置环境变量 /etc/profile 添加
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=zhizheng
export OS_AUTH_URL=http://192.168.0.17:5000/v2.0/
导出环境变量
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=zhizheng
export OS_AUTH_URL=http://192.168.0.17:5000/v2.0/
检查
root@cloudtest03:/var/log/swift# export |grep OS_
root@cloudtest03:/var/log/swift# export OS_TENANT_NAME=admin
root@cloudtest03:/var/log/swift# export OS_USERNAME=admin
root@cloudtest03:/var/log/swift# export OS_PASSWORD=zhizheng
root@cloudtest03:/var/log/swift# export OS_AUTH_URL=http://192.168.0.17:5000/v2.0/
2013-03-08 17:13:27 pytuestc 阅读数 1190
安装环境:ubuntu 11.10 desktop版本
参考文献:http://docs.openstack.org/developer/swift/development_saio.html#loopback-section
                 http://limu713.blog.163.com/blog/static/150869042011645655986/
                 http://wenku.baidu.com/view/aa04a27401f69e314332940d.html

                 http://www.cnblogs.com/yuxc/archive/2011/09/24/2188295.html

NOTE:step1--5 均需以root身份进行相关操作。当前用户修改root用户的命令可采取sudo passwd root命令

step1.  安装依赖软件:
            1.apt-get install python-software-properties(安装源仓库添加工具包)
            2.add-apt-repository ppa:swift-core/release(添加swift仓库
add-apt-repository ppa:swift-core/ppa不知道这两者之间有什么区别,我选择了前者)
            3.apt-get update(更新源列表,最好先把源改为最佳源,我用的是163的源。参考文章linux常见问题集)

            4.apt-get install curl gcc git-core memcached python-coverage python-devpython-nose python-setuptools python-simplejson python-xattr sqlite3xfsprogs python-eventlet python-greenlet python-pastedeploypython-netifaces python-pip

            5.pip install mock(note:
pip is a tool for installing and managing Python packages

step2:创建swift用户

sudo useradd -mk /home/swift -s /bin/bash swift

sudo password swift
       groupadd swift
 
      usermod -a -G swift swift(由于我创建的swift组里面仅仅包含swift用户,而swift用户也仅仅属于swift组,所以我没有添加-a选项)
        note:groupadd swift ; useradd swift -g swift 也是可行的。

 

编辑/etc/sudoers,添加以下一行

# User alias specification

swift   ALL=(ALL) NOPASSWD:ALL
note:在这一步的时候我出现了不能添加的问题,这是由于sudoers只是可读文件,不具有写权限。这个也很简单,直接用chmod命令修改即可添加,添加完成后还得修改为回原来的只读属性。我是后来在swift用户下运行sudo XX XX命令的时候提示出错的,按照提示错处再次通过chmod命令修改文件属性即可解决该问题。



step3. 建立存储区域
note:值得注意的是这里有两种方式建立存储区域,可以使用单独的分区或者环路设备来作为存储区域。之前采用了单独分区结果一直出错,特别是在分出一个区来格式化为xfs格式的时候出现了一系列问题。究其根本是对于linux文件系统的不熟悉与linux这种命令行操作方式的不熟悉导致的。虽然经过痛苦的出错纠错后成功了解决了这个问题。却在后面tempauth认证中出错了。最后忍痛直接重新开始做,采用了环路设备来存储,结果得到顺利进行下去了。与此同时为了后面需要用到新建用户来使用swift,自己也安装网上创建了swift:swift,当然你也可以创建其他用户名和用户组,

        dd if=/dev/zero of=/srv/swift-disk bs=1024 count=0 seek=1000000

       mkfs.xfs -i size=1024 /srv/swift-disk
       Edit /etc/fstab and add   /srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0
       
mkdir /mnt/sdb1
       mount  /mnt/sdb1

mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4

chown -R swift:swift /mnt/sdb1/*

mkdir /srv

for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done

mkdir -p /etc/swift/object-server /etc/swift/container-server /etc/swift/account-server

/srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/swift

chown -R swift:swift /etc/swift /srv/[1-4]/ /var/run/swift 

//注意不要忘记/srv/[1-4]/后面的这个斜杠

//请务必验证/srv下各个目录的属主正确性,以及链接的正确性

        最后,把下面两行加入到/etc/rc.local文件的exit 0之前。

mkdir /var/run/swift

chown –R swift:swift /var/run/swift

step4. 配置rsync(配置文件见附件

编辑/etc/default/rsync:

RSYNC_ENABLE设置为true

重启服务:

service rsync restart



step5.(可选)创建单独的日志文件
       
Create /etc/rsyslog.d/10-swift.conf:(见附件
       
修改/etc/rsyslog.conf:

$PrivDropToGroup adm

 

mkdir -p /var/log/swift/hourly

chown -R syslog.adm /var/log/swif
       chmod -R g+w /var/log/swift
        service rsyslog restar


step6.下载swift源码和设置测试环境(step1---5是root权限下进行的,下面的将以swift用户进行操作
   

su - swift

mkdir ~/bin
       //笨笨熊的办法是采用bzr进行版本下载的。

    bzr init-repo swift(建立共享仓库swift)

cd ~/swift; bzr branch lp:swift trunk(建立swift的拷贝,并下载code。(branch alias get and clone))

cd ~/swift/trunk; sudo python setup.py develop
      但是在进行code下载的时候出现了错误,由于有其他办法所以也就没去深究解决之。下面是我采用直接从openstack里clone出源码//

      git clone  https://github.com/openstack/swift.git
        cd  ~/swift;

        sudo python setup.py develop

git clone https://github.com/openstack/python-swiftclient.git
cd ~/python-swiftclient; sudo python setup.py develop

编辑~/.bashrc,在最后加入:

export SWIFT_TEST_CONFIG_FILE=/etc/swift/func_test.conf

export PATH=${PATH}:~/bin

 

. ~/.bashrc
note:在进行编辑.bashrc文件的时候发现swift用户没有这个文件。使用find -name .bashrc 找到了三个文件,其中root用户和开机创建的用户有一个,对比两个文件发现文件是一样的。于是直接复制里面的内容在swift的/home/swift目录下创建.bashrc文件并将上面的两句加入进文件最后面。由于创建时是root权限,因此创建完成后还需要使用chown命令将之修改为swift:swift。然后保存。



step7.配置各个节点
note:所有文件均采用touch XX先行创建,然后再用vi编辑。当然也可以直接用vi编辑,为了确保编辑正确我还用cat命令进行了显示核查。配置文件见附件

Create /etc/swift/proxy-server.conf:
Create /etc/swift/swift.conf:
/etc/swift/account-server/1.conf:
/etc/swift/account-server/2.conf:
/etc/swift/account-server/3.conf:
/etc/swift/account-server/4.conf:
/etc/swift/container-server/1.conf:
/etc/swift/container-server/2.conf:
/etc/swift/container-server/3.conf:
/etc/swift/container-server/4.conf:
/etc/swift/object-server/1.conf:
/etc/swift/object-server/2.conf:
/etc/swift/object-server/3.conf:
/etc/swift/object-server/4.conf:


step8.创建运行swift的脚本(见附件

Create ~/bin/resetswift.
Create ~/bin/remakerings:
Create ~/bin/startmain:
Create ~/bin/startrest:

step9.脚本测试
chmod +x ~/bin/*

重新产生rings
 
remakerings

单元测试
 
cp ~/swift/test/sample.conf /etc/swift/test.conf
cd ~/swift; ./.unittests

启动startmain
 
startmain


获取一个 X-Storage-Url 和 X-Auth-Token:
curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0

检查swift工作:
 
swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat

上传/下载文件测试
以下内容仅仅作为参考,实际操作的时候需要用实际得到的来替换例子里面相对应的内容。

获得test用户的Storage_Auth_Token和URL
       # curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0

得到以下回复信息:

* About to connect() to 127.0.0.1 port 8080 (#0)

*   Trying 127.0.0.1... connected

* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)

> GET /auth/v1.0 HTTP/1.1

> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15

> Host: 127.0.0.1:8080

> Accept: */*

> X-Storage-User: test:tester

> X-Storage-Pass: testing

< HTTP/1.1 200 OK

< X-Storage-Url: http://127.0.0.1:8080/v1/AUTH_test

< X-Storage-Token: AUTH_tk6474e5ee0cb04832b9d2a168e1a164d8

< X-Auth-Token: AUTH_tk6474e5ee0cb04832b9d2a168e1a164d8

< Content-Length: 0

< Date: Mon, 04 Jul 2011 01:36:57 GMT

* Connection #0 to host 127.0.0.1 left intact

Closing connection #0


创建container

创建一个名称为ljl1的container(目录)

 # curl -X PUT -D -  -H "X-Auth_Token:AUTH_tk6474e5ee0cb04832b9d2a168e1a164d8" http://127.0.0.1:8080/v1/AUTH_test/ljl1

//正确情况下,应该得到以下信息:

HTTP/1.1 201 Created

Content-Length: 18

Content-Type: text/html; charset=UTF-8

Date: Mon, 04 Jul 2011 01:39:38 GMT

 

查看test用户的container列表,发现只有一个目录:ljl1:


# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing list

ljl1


上传Object(文件)

# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing upload ljl1 ./cvs/CVSROOT/config            //上传config文件到ljl1目录中

cvs/CVSROOT/config

# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing list ljl1   //查看ljl1目录内的信息

bin/startmain    

cvs/CVSROOT/config


下载Object(文件)

swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing download  ljl1

 
note:

 /var/log/syslog 中记载了client实时的操作,并记录了运行错误,可以作为查错的参考。

由于不能直接传附件,只好直接将内容显示如下:

/etc/rsyncd.conf


uid = swift

gid = swift

log file = /var/log/rsyncd.log

pid file = /var/run/rsyncd.pid

address = 127.0.0.1

[account6012]

max connections = 25

path = /srv/1/node/

read only = false

lock file = /var/lock/account6012.lock

[account6022]

max connections = 25

path = /srv/2/node/

read only = false

lock file = /var/lock/account6022.lock

[account6032]

max connections = 25

path = /srv/3/node/

read only = false

lock file = /var/lock/account6032.lock

[account6042]

max connections = 25

path = /srv/4/node/

read only = false

lock file = /var/lock/account6042.lock

[container6011]

max connections = 25

path = /srv/1/node/

read only = false

lock file = /var/lock/container6011.lock

[container6021]

max connections = 25

path = /srv/2/node/

read only = false

lock file = /var/lock/container6021.lock

[container6031]

max connections = 25

path = /srv/3/node/

read only = false

lock file = /var/lock/container6031.lock

[container6041]

max connections = 25

path = /srv/4/node/

read only = false

lock file = /var/lock/container6041.lock

[object6010]

max connections = 25

path = /srv/1/node/

read only = false

lock file = /var/lock/object6010.lock

[object6020]

max connections = 25

path = /srv/2/node/

read only = false

lock file = /var/lock/object6020.lock

[object6030]

max connections = 25

path = /srv/3/node/

read only = false

lock file = /var/lock/object6030.lock

[object6040]

max connections = 25

path = /srv/4/node/

read only = false

lock file = /var/lock/object6040.lock





/etc/rsyslog.d/10-swift.conf
# Uncomment the following to have a log containing all logs together

#local1,local2,local3,local4,local5.* /var/log/swift/all.log

# Uncomment the following to have hourly proxy logs for stats processing

#$template HourlyProxyLog,"/var/log/swift/hourly/%$YEAR%%$MONTH%%$DAY%%

$HOUR%"

#local1.*;local1.!notice ?HourlyProxyLog

local1.*;local1.!notice /var/log/swift/proxy.log

local1.notice /var/log/swift/proxy.error

local1.* ~

local2.*;local2.!notice /var/log/swift/storage1.log

local2.notice /var/log/swift/storage1.error

local2.* ~

local3.*;local3.!notice /var/log/swift/storage2.log

local3.notice /var/log/swift/storage2.error

local3.* ~

local4.*;local4.!notice /var/log/swift/storage3.log

local4.notice /var/log/swift/storage3.error

local4.* ~

local5.*;local5.!notice /var/log/swift/storage4.log

local5.notice /var/log/swift/storage4.error

local5.* ~







 




/etc/swift/proxy-server.conf

[DEFAULT]
bind_port = 8080
user = swift
log_facility = LOG_LOCAL1
eventlet_debug = true

[pipeline:main]
pipeline = healthcheck cache tempauth proxy-logging 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

[filter:proxy-logging]
use = egg:swift#proxy_logging








/etc/swift/swift.conf

[swift-hash]
# random unique string that can never change (DO NOT LOSE)
swift_hash_path_suffix = changeme





account-server(1--4)
NO1:


[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6012
user = swift
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

[filter:recon]
use = egg:swift#recon

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]


NO2:


[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6022
user = swift
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

[filter:recon]
use = egg:swift#recon

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]


NO3:


[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6032
user = swift
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

[filter:recon]
use = egg:swift#recon

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]

NO4:


[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6042
user = swift
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

[filter:recon]
use = egg:swift#recon

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]







container-server(1--4)
NO1:


[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6011
user = swift
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

[filter:recon]
use = egg:swift#recon

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]


NO2:


[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6021
user =swift
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

[filter:recon]
use = egg:swift#recon

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]


NO3:

[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6031
user = swift
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

[filter:recon]
use = egg:swift#recon

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]


NO4:

[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6041
user = swift
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

[filter:recon]
use = egg:swift#recon

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]








object-server(1--4)
NO1:

[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6010
user = swift
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]


NO2:


[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6020
user = swift
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]


NO3:

[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6030
user = swift
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]


NO4:

[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6040
user = swift
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]








resetswift:


#!/bin/bash

swift-init all stop
find /var/log/swift -type f -exec rm -f {} \;
sudo umount /mnt/sdb1
sudo mkfs.xfs -f -i size=1024 /srv/swift-disk
sudo mount /mnt/sdb1
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
sudo chown swift:swift /mnt/sdb1/*
mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4
sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog
find /var/cache/swift* -type f -name *.recon -exec rm -f {} \;
sudo service rsyslog restart
sudo service memcached restart







remakerings:

#!/bin/bash

cd /etc/swift

rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz

swift-ring-builder object.builder create 18 3 1
swift-ring-builder object.builder add z1-127.0.0.1:6010/sdb1 1
swift-ring-builder object.builder add z2-127.0.0.1:6020/sdb2 1
swift-ring-builder object.builder add z3-127.0.0.1:6030/sdb3 1
swift-ring-builder object.builder add z4-127.0.0.1:6040/sdb4 1
swift-ring-builder object.builder rebalance
swift-ring-builder container.builder create 18 3 1
swift-ring-builder container.builder add z1-127.0.0.1:6011/sdb1 1
swift-ring-builder container.builder add z2-127.0.0.1:6021/sdb2 1
swift-ring-builder container.builder add z3-127.0.0.1:6031/sdb3 1
swift-ring-builder container.builder add z4-127.0.0.1:6041/sdb4 1
swift-ring-builder container.builder rebalance
swift-ring-builder account.builder create 18 3 1
swift-ring-builder account.builder add z1-127.0.0.1:6012/sdb1 1
swift-ring-builder account.builder add z2-127.0.0.1:6022/sdb2 1
swift-ring-builder account.builder add z3-127.0.0.1:6032/sdb3 1
swift-ring-builder account.builder add z4-127.0.0.1:6042/sdb4 1
swift-ring-builder account.builder rebalance


startmain:
#!/bin/bash

swift-init main start


startrest:
#!/bin/bash

swift-init rest start



Linux14.04 下安装Swift

阅读数 1345

安装OpenStack Swift

阅读数 599

OpenStack swift安装

阅读数 1500

没有更多推荐了,返回首页