13,存储节点安装Swift


存储节点使用LVM提供服务

13.1 swift存储节点准备

  1. 系统版本选择:CentOS Linux release 7.6.1810 (Core)
  2. 配置swift主机名
hostnamectl --static set-hostname swift
  1. 配置域名解析
echo "192.168.204.10 controller" >>/etc/hosts
echo "192.168.204.11 nova" >>/etc/hosts
echo "192.168.204.12 cinder" >>/etc/hosts
echo "192.168.204.13 swift" >>/etc/hosts
cat /etc/hosts

13.2 关闭防火墙和selinux

13.2.1 关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service 

13.2.2 关闭selinux

setenforce 0
getenforce
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
grep SELINUX=disabled /etc/sysconfig/selinux

13.3 时间同步

13.3.1 安装chrony

yum install -y chrony

13.3.2 编辑chrony配置文件

vim /etc/chrony.conf

---
server 192.168.204.10 iburst

13.3.3 设置时区

timedatectl set-timezone Asia/Shanghai
chronyc sources
timedatectl status

13.3.4 启动并且配置自启动

systemctl restart chronyd.service
systemctl enable chronyd.service

13.4 配置yum源

使用互联网安装openstack需要配置epel与阿里源(如公司不允许服务器连接互联网可在内网自建yum源,把epel与阿里源同步到内网)

13.4.1 安装epel与阿里yum源

wget -O /etc/yum.repos.d/aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

13.4.2 安装Rocky

yum install centos-release-openstack-rocky -y
yum clean all
yum makecache
yum update -y

13.5 安装相关软件

yum install xfsprogs rsync python-openstackclient openstack-selinux openstack-utils -y

13.6 安装准备

13.6.1 使用XFS格式化/dev/sdb/dev/sdc设备:

[root@swift ~]# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   200G  0 disk 
├─sda1   8:1    0   500M  0 part /boot
├─sda2   8:2    0     8G  0 part [SWAP]
└─sda3   8:3    0 191.5G  0 part /
sdb      8:16   0   500G  0 disk 
sdc      8:32   0   500G  0 disk 
sr0     11:0    1  1024M  0 rom  
---
mkfs.xfs /dev/sdb
mkfs.xfs /dev/sdc

13.6.2 创建挂载点目录结构

mkdir -p /srv/node/sdb
mkdir -p /srv/node/sdc

13.6.3 编辑/etc/fstab文件并添加以下内容

/dev/sdb /srv/node/sdb xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
/dev/sdc /srv/node/sdc xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
init 6

13.6.4 创建并编辑/etc/rsyncd.conf

vim /etc/rsyncd.conf
---
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 192.168.204.13

[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
lock file = /var/lock/container.lock

[object]
max connections = 2
path = /srv/node/
read only = False
lock file = /var/lock/object.lock
---
:x

13.6.5 启动并且配置自启动

systemctl enable rsyncd.service
systemctl start rsyncd.service
systemctl status rsyncd.service

13.7 安装配置swift

13.7.1 安装swift

yum install openstack-swift-account openstack-swift-container openstack-swift-object -y

13.7.2 配置swift

13.7.2.1 从对象存储的仓库源中获取代理服务的配置文件

curl -o /etc/swift/account-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/account-server.conf-sample?h=stable/rocky
curl -o /etc/swift/container-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/container-server.conf-sample?h=stable/rocky
curl -o /etc/swift/object-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/object-server.conf-sample?h=stable/rocky

13.7.2.2 配置swift

13.7.2.2.1 配置account-server.conf
openstack-config --set /etc/swift/account-server.conf DEFAULT bind_ip 192.168.204.13
openstack-config --set /etc/swift/account-server.conf DEFAULT bind_port 6002
openstack-config --set /etc/swift/account-server.conf DEFAULT user swift
openstack-config --set /etc/swift/account-server.conf DEFAULT swift_dir /etc/swift
openstack-config --set /etc/swift/account-server.conf DEFAULT devices /srv/node
openstack-config --set /etc/swift/account-server.conf DEFAULT mount_check True
openstack-config --set /etc/swift/account-server.conf pipeline:main pipeline "healthcheck recon account-server"
openstack-config --set /etc/swift/account-server.conf filter:recon use egg:swift#recon
openstack-config --set /etc/swift/account-server.conf filter:recon recon_cache_path /var/cache/swift
13.7.2.2.2 配置container-server.conf
openstack-config --set /etc/swift/container-server.conf DEFAULT bind_ip 192.168.204.13
openstack-config --set /etc/swift/container-server.conf DEFAULT bind_port 6001
openstack-config --set /etc/swift/container-server.conf DEFAULT user swift
openstack-config --set /etc/swift/container-server.conf DEFAULT swift_dir /etc/swift
openstack-config --set /etc/swift/container-server.conf DEFAULT devices /srv/node
openstack-config --set /etc/swift/container-server.conf DEFAULT mount_check True
openstack-config --set /etc/swift/container-server.conf pipeline:main pipeline "healthcheck recon container-server"
openstack-config --set /etc/swift/container-server.conf filter:recon use egg:swift#recon
openstack-config --set /etc/swift/container-server.conf filter:recon recon_cache_path /var/cache/swift
13.7.2.2.3 配置object-server.conf
openstack-config --set /etc/swift/object-server.conf DEFAULT bind_ip 192.168.204.13
openstack-config --set /etc/swift/object-server.conf DEFAULT bind_port 6000
openstack-config --set /etc/swift/object-server.conf DEFAULT user swift
openstack-config --set /etc/swift/object-server.conf DEFAULT swift_dir /etc/swift
openstack-config --set /etc/swift/object-server.conf DEFAULT devices /srv/node
openstack-config --set /etc/swift/object-server.conf DEFAULT mount_check True
openstack-config --set /etc/swift/object-server.conf pipeline:main pipeline "healthcheck recon object-server"
openstack-config --set /etc/swift/object-server.conf filter:recon use egg:swift#recon
openstack-config --set /etc/swift/object-server.conf filter:recon recon_cache_path /var/cache/swift
openstack-config --set /etc/swift/object-server.conf filter:recon recon_lock_path /var/lock

13.7.3 挂载点目录结构所有权

chown -R swift:swift /srv/node

13.7.4 创建 “recon” 目录和确保它有合适的所有权

mkdir -p /var/cache/swift
chown -R root:swift /var/cache/swift
chmod -R 775 /var/cache/swift
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值