当前位置: 首页 > 工具软件 > Cinder > 使用案例 >

Cinder部署

谢雅珺
2023-12-01

控制节点

登录mariadb,创建cinder的用户和数据库

创建db
	create database cinder;
创建用户cinder并给与它cinder库的所有权限
	grant all privileges on cinder.* to 'cinder'@'%' identified by 'cinder';

退出mariadb,在OpenStack平台中搭建环境

登录OpenStack
	source openrc
创建用户cinder
	openstack user create --domain default --password=cinder cinder
将cinder添加到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
创建endpoint
	openstack endpoint create --region RegionOne volumev2 public http://controller1:8776/v2/%\(project_id\)s
	openstack endpoint create --region RegionOne volumev2 internal http://controller1:8776/v2/%\(project_id\)s
	openstack endpoint create --region RegionOne volumev2 admin http://controller1:8776/v2/%\(project_id\)s
	openstack endpoint create --region RegionOne volumev3 public http://controller1:8776/v3/%\(project_id\)s
	openstack endpoint create --region RegionOne volumev3 internal http://controller1:8776/v3/%\(project_id\)s
	openstack endpoint create --region RegionOne volumev3 admin http://controller1:8776/v3/%\(project_id\)s

检查搭建是否成功

检查用户是否创建
	openstack user list
	+----------------------------------+-----------+
	| ID                               | Name      |
	+----------------------------------+-----------+
	| f24fbfcd071743d29b152551032c1bab | cinder    |
	+----------------------------------+-----------+
检查服务是否创建	
	openstack service list
	+----------------------------------+-----------+-----------+
	| ID                               | Name      | Type      |
	+----------------------------------+-----------+-----------+
	| 1870ed549cfd45c9bc700df677e66717 | cinderv2  | volumev2  |
	| eec270db9d9e4640ac0c93d101b356ff | cinderv3  | volumev3  |
	+----------------------------------+-----------+-----------+
检查endpoint
	openstack endpoint list
	+-------------------+-----------+--------------+--------------+---------+-----------+--------------------+
	| ID                | Region    | Service Name | Service Type | Enabled | Interface | URL                |
	+-------------------+-----------+--------------+--------------+---------+-----------+--------------------+
	| 02f953c703ca4c46a | RegionOne | cinderv3     | volumev3     | True    | public    | http://controller1 |
	| 28cde2372413ae6   |           |              |              |         |           | :8776/v3/%(project |
	|                   |           |              |              |         |           | _id)s              |
	| 9943ed2fae2549f79 | RegionOne | cinderv2     | volumev2     | True    | internal  | http://controller1 |
	| 27e204997f7bfa4   |           |              |              |         |           | :8776/v2/%(project |
	|                   |           |              |              |         |           | _id)s              |
	| acc14cf987404937b | RegionOne | cinderv3     | volumev3     | True    | internal  | http://controller1 |
	| 73966a868ebbdea   |           |              |              |         |           | :8776/v3/%(project |
	|                   |           |              |              |         |           | _id)s              |
	| b00c5f0962d343209 | RegionOne | cinderv2     | volumev2     | True    | admin     | http://controller1 |
	| 29d2a5f2e2d591e   |           |              |              |         |           | :8776/v2/%(project |
	|                   |           |              |              |         |           | _id)s              |
	| bf9faa3b3760469bb | RegionOne | cinderv2     | volumev2     | True    | public    | http://controller1 |
	| 87d0a516311b55c   |           |              |              |         |           | :8776/v2/%(project |
	|                   |           |              |              |         |           | _id)s              |
	| f4dfe17234e9487e9 | RegionOne | cinderv3     | volumev3     | True    | admin     | http://controller1 |
	| 5a3761843246376   |           |              |              |         |           | :8776/v3/%(project |
	|                   |           |              |              |         |           | _id)s              |

安装配置cinder

安装
	 yum -y install openstack-cinder
修改配置文件
	vim /etc/cinder/cinder.conf
	vim /etc/nova/nova.conf
		[cinder]
		os_region_name = RegionOne	
重启Nova服务
	systemctl restart openstack-nova-api
启动cinder服务
	systemctl enable openstack-cinder-api openstack-cinder-scheduler
	systemctl restart openstack-cinder-api openstack-cinder-scheduler

存储节点

安装lvm软件包
	yum -y install lvm2
启动
	systemctl enable lvm2-lvmetad
	systemctl restart lvm2-lvmetad

为存储节点添加一块新硬盘

创建物理卷
	pvcreate /dev/sdb
创建卷组
	vgcreate cinder-volumes /dev/sdb
编辑配置文件
	vim /etc/lvm/lvm.conf
		devices {
		...
		filter = [ "a/sdb/", "r/.*/"]		

	yum -y install openstack-cinder targetcli python-keystone
修改配置文件
	vim /etc/cinder/cinder.conf
启动cinder服务
	systemctl enable openstack-cinder-volume target
	systemctl restart openstack-cinder-volume target

配置文件

控制节点的/etc/cinder/cinder.conf

[DEFAULT]
my_ip = 192.168.88.111
glance_api_servers = http://controller1:9292
auth_strategy = keystone
transport_url = rabbit://openstack:openstack@controller1
 
[backend]
 
[barbican]
 
[brcd_fabric_example]
 
[cisco_fabric_example]
 
[coordination]
 
[cors]
 
[cors.subdomain]
 
[database]
connection = mysql+pymysql://cinder:cinder@controller1/cinder
 
[fc-zone-manager]
 
[healthcheck]
 
[key_manager]
 
[keystone_authtoken]
auth_uri = http://controller1:5000
auth_url = http://controller1:35357
memcached_servers = controller1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
 
[matchmaker_redis]
 
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
 
[oslo_messaging_amqp]
 
[oslo_messaging_kafka]
 
[oslo_messaging_notifications]
 
[oslo_messaging_rabbit]
 
[oslo_messaging_zmq]
 
[oslo_middleware]
 
[oslo_policy]
 
[oslo_reports]
 
[oslo_versionedobjects]
 
[profiler]
 
[ssl]
 
[lvm]

存储节点的/etc/cinder/cinder.conf

[DEFAULT]
my_ip = 192.168.88.111
glance_api_servers = http://controller1:9292
auth_strategy = keystone
enabled_backends = lvm
transport_url = rabbit://openstack:openstack@controller1
 
[backend]
 
[barbican]
 
[brcd_fabric_example]
 
[cisco_fabric_example]
 
[coordination]
 
[cors]
 
[cors.subdomain]
 
[database]

[fc-zone-manager]
 
[healthcheck]
 
[key_manager]
 
[keystone_authtoken]
auth_uri = http://controller1:5000
auth_url = http://controller1:35357
memcached_servers = controller1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
 
[matchmaker_redis]
 
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
 
[oslo_messaging_amqp]
 
[oslo_messaging_kafka]
 
[oslo_messaging_notifications]
 
[oslo_messaging_rabbit]
 
[oslo_messaging_zmq]
 
[oslo_middleware]
 
[oslo_policy]
 
[oslo_reports]
 
[oslo_versionedobjects]
 
[profiler]
 
[ssl]
 
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm

 类似资料: