openstack部署cinder

controller

一、创建cinder数据库并设置权限

  mysql -u root -p

    CREATE DATABASE cinder;

    GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \ IDENTIFIED BY 'CINDER_DBPASS';

    GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \ IDENTIFIED BY 'CINDER_DBPASS';

二、宣告环境变量并创建用户、角色、服务和服务端点。

  source openrc

  openstack user create --domain default --password=cinder cinder

  openstack role add --project service --user cinder admin

  openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2

  openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

  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/v2/%\(project_id\)s

  openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v2/%\(project_id\)s

  openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v2/%\(project_id\)s

三、安装cinder并编辑配置文件

  yum install openstack-cinder

  vim /etc/cinder/cinder.conf

[DEFAULT]
my_ip = 192.168.42.120
#glance_api_servers = http://controller:9292
auth_strategy = keystone
#enabled_backends = lvm
transport_url = rabbit://openstack:admin@controller [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder [fc-zone-manager] [healthcheck] [key_manager] [keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:
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-vg
#volumes_dir = $state_path/volumes
#iscsi_protocol = iscsi
#iscsi_helper = lioadm
#iscsi_ip_address = 172.16.254.63

四、同步数据库

  su -s /bin/sh -c "cinder-manage db sync" cinder

五、编辑nova配置文件

  解开cinder的注释

六、重启服务

  systemctl restart openstack-nova-api.service

  systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service

  systemctl enable openstack-cinder-api.service openstack-cinder-scheduler,service

storage

给三个节点都添加一块SATA类型的硬盘

一、安装lvm2并启动

  yum install lvm2

  systemctl restart lvm2-lvmetad.service

  systemctl enable lvm2-lvmetad.service

二、创建物理卷和卷组,编辑lvm配置文件

  pvcreate /dev/sdb

  vdcreate cinder-volumes /dev/sdb

  vim /etc/lvm/lvm.conf(添加到末尾)

    devices { ... filter = [ "a/sdb/", "r/.*/"]

三、安装cinder,target,keystone  

  yum install openstack-cinser targetcli python-keystone

[DEFAULT]
my_ip = 192.168.42.122
glance_api_servers = http://controller:9292
auth_strategy = keystone
enabled_backends = lvm
transport_url = rabbit://openstack:admin@controller [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder [fc-zone-manager] [healthcheck] [key_manager] [keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:
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-vg
#volumes_dir = $state_path/volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
#iscsi_ip_address = 172.16.254.63

vim /etc/cinder/cinder.conf

四、重启服务

  systemctl restart openstack-cinder-volume.service target.service

  systemctl enable openstack-cinder-volume.service target.service

controller

宣告环境变量,并列出用于验证每个进程成功启动的服务组件:

  source openrc

  openstack volume service list

以上块存储部署完毕。

上一篇:React Native 开发工具篇


下一篇:Python中模块(Module)和包(Package)的区别