标签:开机自启动 syn 使用命令 列表 vmw strong res storage lvm卷
块存储服务通常包含下列组件:
# 创建相关数据库,授权访问用户
# 连接数据库 mysql -u root -p # 创建数据库并授权 CREATE DATABASE cinder; GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘ IDENTIFIED BY ‘cinder‘; GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘ IDENTIFIED BY ‘cinder‘; flush privileges;
# 在keystone上创建cinder用户
cd /server/tools source keystone-admin-pass.sh openstack user create --domain default --password=cinder cinder openstack user list
# 在keystone上将cinder用户配置为admin角色并添加进service项目,以下命令无输出
openstack role add --project service --user cinder admin
# 创建cinder服务的实体
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3 openstack service list
# 创建cinder服务的API端点(endpoint)
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 openstack endpoint list
yum install openstack-cinder -y
openstack-config --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:cinder@controller/cinder openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:openstack@controller openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://controller:5000 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://controller:5000 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers controller:11211 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name default openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name default openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password cinder openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.182.143 openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/nova/tmp
# 检查生效的cinder配置
egrep -v "^#|^$" /etc/cinder/cinder.conf grep ‘^[a-z]‘ /etc/cinder/cinder.conf
su -s /bin/sh -c "cinder-manage db sync" cinder
# 验证数据库
mysql -h192.168.182.143 -ucinder -pcinder -e "use cinder;show tables;"
# 配置nova调用cinder服务
openstack-config --set /etc/nova/nova.conf cinder os_region_name RegionOne
# 检查生效的nova配置
grep ‘^[a-z]‘ /etc/nova/nova.conf |grep os_region_name
systemctl restart openstack-nova-api.service
systemctl status openstack-nova-api.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service systemctl status openstack-cinder-api.service openstack-cinder-scheduler.service systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service systemctl list-unit-files |grep openstack-cinder |grep enabled
# 至此,控制端的cinder服务安装完毕,在dashboard上面可以看到项目目录中多了一个卷服务
# 接下来安装块存储节点服务器storage node
# 存储节点建议单独部署服务器(最好是物理机),测试时也可以部署在控制节点或者计算节点
# 在本文,存储节点使用LVM逻辑卷提供服务,需要提供一块空的磁盘用以创建LVM逻辑卷
# 我这里在VMware虚拟机增加一块20GB的磁盘
yum install lvm2 device-mapper-persistent-data -y
systemctl start lvm2-lvmetad.service systemctl status lvm2-lvmetad.service systemctl enable lvm2-lvmetad.service systemctl list-unit-files |grep lvm2-lvmetad |grep enabled
# 检查磁盘状态
fdisk -l
# 创建LVM 物理卷 /dev/sdb
pvcreate /dev/sdb
# 创建 LVM 卷组 cinder-volumes,块存储服务会在这个卷组中创建逻辑卷
vgcreate cinder-volumes /dev/sdb
# 默认只会有openstack实例访问块存储卷组,不过,底层的操作系统也会管理这些设备并尝试将逻辑卷与系统关联。
# 默认情况下LVM卷扫描工具会扫描整个/dev目录,查找所有包含lvm卷的块存储设备。如果其他项目在某个磁盘设备sda,sdc等上使用了lvm卷,那么扫描工具检测到这些卷时会尝试缓存这些lvm卷,可能导致底层操作系统或者其他服务无法正常调用他们的lvm卷组,从而产生各种问题,需要手动配置LVM,让LVM卷扫描工具只扫描包含"cinder-volume"卷组的设备/dev/sdb,我这边磁盘分区都是格式化的手工分区,目前不存在这个问题,以下是配置演示
vim /etc/lvm/lvm.conf ----------------------------- devices { filter = [ "a/sdb/", "r/.*/"] } -----------------------------
# 配置规则:
# 每个过滤器组中的元素都以a开头accept接受,或以 r 开头reject拒绝,后面连接设备名称的正则表达式规则。
# 过滤器组必须以"r/.*/"结束,过滤所有保留设备。
# 可以使用命令:vgs -vvvv来测试过滤器。
# 注意:
# 如果存储节点的操作系统磁盘/dev/sda使用的是LVM卷组,也需要将该设备添加到过滤器中,例如: filter = [ "a/sda/", "a/sdb/", "r/.*/"] # 如果计算节点的操作系统磁盘/dev/sda使用的是LVM卷组,也需要修改这些节点的/etc/lvm/lvm.conf,在过滤器中增加该类型的磁盘设备,例如: filter = [ "a/sda/", "r/.*/"]
yum install openstack-cinder targetcli python-keystone -y
openstack-config --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:cinder@controller/cinder openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:openstack@controller openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone openstack-config --set /etc/cinder/cinder.conf keystone_authtoken www_authenticate_uri http://controller:5000 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://controller:5000 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers controller:11211 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name default openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name default openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password cinder openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.182.143 openstack-config --set /etc/cinder/cinder.conf lvm volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver openstack-config --set /etc/cinder/cinder.conf lvm volume_group cinder-volumes openstack-config --set /etc/cinder/cinder.conf lvm iscsi_protocol iscsi openstack-config --set /etc/cinder/cinder.conf lvm iscsi_helper lioadm openstack-config --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm openstack-config --set /etc/cinder/cinder.conf DEFAULT glance_api_servers http://controller:9292 openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/cinder/tmp
# 如果存储节点是双网卡,选项my_ip需要配置存储节点的管理IP,否则配置本机IP
# 检查生效的cinder配置
egrep -v "^#|^$" /etc/cinder/cinder.conf grep ‘^[a-z]‘ /etc/cinder/cinder.conf
systemctl start openstack-cinder-volume.service target.service systemctl status openstack-cinder-volume.service target.service systemctl enable openstack-cinder-volume.service target.service systemctl list-unit-files |grep openstack-cinder |grep enabled systemctl list-unit-files |grep target.service |grep enabled
# 至此,在存储节点安装cinder服务就完成了
cd /server/tools/
source keystone-admin-pass.sh
openstack volume service list
1)云磁盘可以进行磁盘迁移,扩容,缩容等操作,但不建议在生产环境进行尝试,测试环境可以尝试,但也要注意备份数据
2)涉及重要数据的话尽量还是不使用云磁盘,而采用本地磁盘存储数据,如果出现问题至少各个磁盘数据是分开的,磁盘文件还在
3)总的来说,使用openstack部署企业私有云,生产环境用本地磁盘就好,测试环境可以以尝试使用云磁盘
~~~cinder安装配置完成~~~
CentOS7安装OpenStack-09.安装Cinder存储服务组件
标签:开机自启动 syn 使用命令 列表 vmw strong res storage lvm卷
原文地址:https://www.cnblogs.com/liugp/p/12491499.html