【存储】nas模拟裸磁盘挂载swift
1.利用nfs设置Linux系统之间的文件共享
2.安装yum install -y nfs-utils rpcbind
2.1服务端客户端都进行安装
3.配置文件修改:/etc/exports
3.1启动服务(顺序不能打乱) /bin/systemctl start rpcbind.service /bin/systemctl start nfs.service
3.2否则出现
4.showmount –e查看一下,看看共享的目录情况(记得创建相应的目录)
4.1查看其他机器的共享情况
5.挂载
mount -t nfs 172.16.254.132:/srv/node/vdd
6.构建ring(脚本)
#!/bin/bash
set -e
echo_green() {
echo -n -e "\033[32m$1\033[0m"
}
echo_green_enter() {
echo -e "\033[32m$1\033[0m"
}
##Usage
usage() {
local command=`basename $0`
echo "NAME
${command} -- Create initial rings
SYNOPSIS
${command} [IPS] [DEVICES]
USAGE:
$0 192.168.1.2 sdb1
$0 192.168.1.2,192.168.1.3 sdb1,sdc1"
exit 1
}
if [ $# -ne 2 ]
then
usage
fi
IPS=$1
IP=$(echo ${IPS}|sed 's/,/ /g')
DEVICES=$2
DEVICE=$(echo ${DEVICES}|sed 's/,/ /g')
#device_array=($DEVICE)
#device_1=${device_array[0]}
#device_2=${device_array[1]}
cd /etc/swift
swift-ring-builder account.builder create 10 3 1
for i in $IP
do
for device in $DEVICE
do
swift-ring-builder account.builder add r1z1-${i}:6002/${device} 5
done
done
swift-ring-builder account.builder
swift-ring-builder account.builder rebalance
swift-ring-builder container.builder create 10 3 1
for i in $IP
do
for device in $DEVICE
do
swift-ring-builder container.builder add r1z1-${i}:6001/${device} 5
done
done
swift-ring-builder container.builder
swift-ring-builder container.builder rebalance
swift-ring-builder object.builder create 10 3 1
for i in $IP
do
for device in $DEVICE
do
swift-ring-builder object.builder add r1z1-${i}:6000/${device} 5
done
done
swift-ring-builder object.builder
swift-ring-builder object.builder rebalance
echo_green_enter "Create initial rings successful"