参考陈沙克博客:http://www.chenshake.com/swift-single-version/
我是装系统时分了个lvm /dev/sda7
安装软件
apt-get -y install swift swift-proxy swift-account swift-container swift-object \
xfsprogs curl python-pastedeploy
分区
我安装系统的时候,有一个专门的分区给swift使用。分区前,先umount
umount /dev/sda7
格式化分区
mkfs.xfs -f -i size=1024 /dev/sda7
创建挂载点
mkdir /mnt/swift_backend
修改/etc/fstab, 原来是采用uuid,注释掉,加上
/dev/sda7 /mnt/swift_backend xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
检查修改是否正确
mount -a
如果fstab有错误,会进行提示。没错误,就会把目录挂载上。
目录设置
pushd /mnt/swift_backend
mkdir node1 node2 node3 node4
popd
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 \
/srv/node1/device \
/srv/node2/device \
/srv/node3/device \
/srv/node4/device
mkdir /run/swift
chown -L -R swift.swift /etc/swift /srv/node[1-4]/ /run/swift
为了在系统启动时启动Swift服务,需要把如下两行命令写入 /etc/rc.local里,
位置在“exit 0;”之前:
sudo mkdir /run/swift
sudo chown swift.swift /run/swift
配置rsync
编辑 /etc/default/rsync文件
sed -i 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' /etc/default/rsync
创建 /etc/rsyncd.conf
cat > /etc/rsyncd.conf <<EOF
# 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
我是装系统时分了个lvm /dev/sda7
安装软件
apt-get -y install swift swift-proxy swift-account swift-container swift-object \
xfsprogs curl python-pastedeploy
分区
我安装系统的时候,有一个专门的分区给swift使用。分区前,先umount
umount /dev/sda7
格式化分区
mkfs.xfs -f -i size=1024 /dev/sda7
创建挂载点
mkdir /mnt/swift_backend
修改/etc/fstab, 原来是采用uuid,注释掉,加上
/dev/sda7 /mnt/swift_backend xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
检查修改是否正确
mount -a
如果fstab有错误,会进行提示。没错误,就会把目录挂载上。
目录设置
pushd /mnt/swift_backend
mkdir node1 node2 node3 node4
popd
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 \
/srv/node1/device \
/srv/node2/device \
/srv/node3/device \
/srv/node4/device
mkdir /run/swift
chown -L -R swift.swift /etc/swift /srv/node[1-4]/ /run/swift
为了在系统启动时启动Swift服务,需要把如下两行命令写入 /etc/rc.local里,
位置在“exit 0;”之前:
sudo mkdir /run/swift
sudo chown swift.swift /run/swift
配置rsync
编辑 /etc/default/rsync文件
sed -i 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' /etc/default/rsync
创建 /etc/rsyncd.conf
cat > /etc/rsyncd.conf <<EOF
# 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