Welcome to Elvin's blog

cinder存储节点 后端采用lvm、nfs安装配置

#cinder存储节点

openstack pike 部署 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html

#cinder存储节点
#cinder后端采用lvm、nfs安装配置

#cinder块存储
#需要准备存储节点,可以使用LVM、NFS、分布式存储等
#本次安装以LVM、NFS为例
######################################################

#基本配置
# hostname cinder1
# IP 192.168.58.24
# hostnamectl set-hostname cinder1
#hosts设置
echo '
10.2.1.10       controller #vip
192.168.58.21   controller1
192.168.58.22   controller2
192.168.58.23   controller3
192.168.58.24   cinder1
192.168.58.31   computer01
192.168.58.32   computer02
'>>/etc/hosts

##############
#添加硬盘……
#fdisk快速分区,新建2个30G分区
echo -e 'n\np\n1\n\n+30G\nw' | fdisk /dev/sdb
echo -e 'n\np\n2\n\n+30G\nw' | fdisk /dev/sdb
#格式化
mkfs.ext4 /dev/sdb1
mkfs.ext4 /dev/sdb2

mkdir -p /date
mount -t ext4 /dev/sdb1 /date
df -h|grep /dev/sdb1
#开机挂载磁盘
echo "mount -t ext4 /dev/sdb1 /date" >>/etc/rc.d/rc.local
tail -1 /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

##############
#安装配置LVM,作为后端存储使用
yum install -y lvm2
systemctl enable lvm2-lvmetad.service
systemctl start lvm2-lvmetad.service
#创建LVM物理卷pv与卷组vg
pvcreate /dev/sdb2
vgcreate cinder_lvm01 /dev/sdb2
vgdisplay #查看vg

##############
#安装配置NFS服务,作为后端存储使用
yum install nfs-utils rpcbind -y
mkdir -p /date/{cinder_nfs1,cinder_nfs2}
chown cinder:cinder /date/cinder_nfs1
chmod 777 /date/cinder_nfs1
#echo "/date/cinder_nfs1 *(rw,no_root_squash,sync)">/etc/exports
echo "/date/cinder_nfs1 *(rw,root_squash,sync,anonuid=165,anongid=165)">/etc/exports
exportfs -r
systemctl enable rpcbind nfs-server
systemctl restart rpcbind nfs-server
showmount -e localhost

######################################################

#安装配置Cinder
yum install -y openstack-cinder targetcli python-keystone lvm2
cp /etc/cinder/cinder.conf{,.bak}
cp /etc/lvm/lvm.conf{,.bak}

#配置LVM过滤,只接收上面配置的lvm设备/dev/sdb2
#在devices {  }部分添加 filter = [ "a/sdb2/", "r/.*/"]
sed -i '141a filter = [ "a/sdb2/", "r/.*/"]' /etc/lvm/lvm.conf  #在141行后添加

#NFS
echo '192.168.58.24:/date/cinder_nfs1'>/etc/cinder/nfs_shares
chmod 640 /etc/cinder/nfs_shares
chown root:cinder /etc/cinder/nfs_shares

#Cinder配置
echo '
[DEFAULT]
auth_strategy = keystone
log_dir = /var/log/cinder
state_path = /var/lib/cinder
glance_api_servers = http://controller:9292
transport_url = rabbit://openstack:openstack@controller
enabled_backends = lvm,nfs

[database]
connection = mysql+pymysql://cinder:cinder@controller/cinder

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller1:11211,controller2:11211,controller3:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder

[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
iscsi_helper = lioadm
iscsi_protocol = iscsi
volume_group = cinder_lvm01
iscsi_ip_address = 192.168.58.24
volumes_dir = $state_path/volumes
volume_backend_name = lvm01

[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt
volume_backend_name = nfs01
'>/etc/cinder/cinder.conf
chmod 640 /etc/cinder/cinder.conf 
chgrp cinder /etc/cinder/cinder.conf 

#启动Cinder卷服务
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service

 

posted @ 2017-10-26 20:25  blog-elvin-vip  阅读(1580)  评论(0编辑  收藏  举报