整个OpenStack是由控制节点,计算节点,网络节点,存储节点四大部分组成。上篇博文详细讲述了控制节点服务controller中的horizon组件,本篇博文将详解存储节点cinder的部署。分为两部分:控制节点和存储节点
OpenStack存储节点架构
存储节点包含Cinder,Swift等服务
- Cinder:块存储服务,提供相应的块存储,简单来说,就是虚拟出一块磁盘,可以挂载到相应的虚拟机之上,不受文件系统等因素影响,对虚拟机来说,这个操作就像是新加了一块硬盘,可以完成对磁盘的任何操作,包括挂载,卸载,格式化,转换文件系统等等操作,大多应用于虚拟机空间不足的情况下的空间扩容等等
- Swift:对象存储服务,提供相应的对象存储,简单来说,就是虚拟出一块磁盘空间,可以在这个空间当中存放文件,也仅仅只能存放文件,不能进行格式化,转换文件系统,大多应用于云磁盘/文件
存储节点包含最少两个网络接口
eth0:与控制节点进行通信,接受控制节点任务,受控制节点统一调配
eth1:与计算/网络节点进行通信,完成控制节点下发的各类任务
实验环境
主 机 | 系 统 | IP地址 | 角 色 |
controller | CentOS7 | 192.168.37.128 | keystone、nova、glance、neutron、horizon、cinder、ntp、mariadb、rabbitmq、memcached、etcd、apache |
compute | CentOS7 | 192.168.37.130 | nova、neutron、ntp |
cinder | CentOS7 | 192.168.37.131 | cinder、ntp |
实验过程
++安装和配置Cinder节点++
1、添加、新建一块磁盘sdb
fdisk /dev/sdb
2、创建LVM物理逻辑卷/dev/sdb1
pvcreate /dev/sdb1
3、创建cinder-volumes逻辑卷组
vgcreate cinder-volumes /dev/sdb1
4、yum安装cinder软件包
yum install openstack-cinder targetcli python-keystone -y
5、编辑配置文件
vim /etc/cinder/cinder.conf
[DEFAULT]
#1302
transport_url = rabbit://openstack:123456@controller
#399
auth_strategy = keystone
#291
my_ip = 192.168.175.155
#403
enabled_backends = lvm #支持格式
#296
glance_api_servers = http://controller:9292
[database]
#3586
connection = mysql+pymysql://cinder:123456@controller/cinder
[keystone_authtoken]
#3850
auth_uri = http://controller:5000
auth_url = http://controller:35357
#3901
memcached_servers = controller:11211
#4008
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = 123456
[oslo_concurrency]
#4125
lock_path = /var/lib/cinder/tmp
#末尾添加[lvm] 模块,使用LVM驱动程序,cinder-volumes卷组,iSCSI协议和相应的iSCSI服务配置LVM后端。
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
6、开启cinder服务,设置开机自启动
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service
++安装和配置controller节点++
1、配置数据库
mysql -u root -p
create database cinder;
grant all privileges on cinder. to 'cinder'@'localhost' identified by '123456';
grant all privileges on cinder. to 'cinder'@'%' identified by '123456';
2、创建用户cinder
source ~/admin-openrc
openstack user create --domain default --password-prompt cinder
密码:123456
3、添加角色
openstack role add --project service --user cinder admin
4、创建cinderv2和cinderv3服务实体
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
5、创建块存储服务API
openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s
6、安装cinder软件包
yum install openstack-cinder -y
7、编辑配置文件
vim /etc/cinder/cinder.conf
[database]
#3586
connection = mysql+pymysql://cinder:123456@controller/cinder
[DEFAULT]
#1302
transport_url = rabbit://openstack:123456@controller
#399
auth_strategy = keystone
#291
my_ip = 192.168.175.145
[keystone_authtoken]
#3850
auth_uri = http://controller:5000
auth_url = http://controller:35357
#3901
memcached_servers = controller:11211
#4008
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = 123456
[oslo_concurrency]
#4126
lock_path = /var/lib/cinder/tmp
8、同步数据库
su -s /bin/sh -c "cinder-manage db sync" cinder
9、编辑nova配置文件
vim /etc/nova/nova.conf
[cinder]
#4237
os_region_name = RegionOne
10、重启openstack-nova-api服务,开启cinder服务
systemctl restart openstack-nova-api.service
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
11、查看用户cinder
12、查看服务实体
到此为止,cinder组件部分已部署完整,谢谢阅读!
转载于:https://blog.51cto.com/13784264/2312609