安装cinder

在控制节点上安装

备注:安装cinder时,nova-compute创建虚拟机时会默认使用cinder指定的存储方式,所以,如果你还要使用本地存储的话,请先参考我这边文章进行设置:

配置nova-compute在不同的计算节点上使用不同的存储后端

1.准备数据库和账号

MYSQL_ROOT_PASSWD='m4r!adbOP'
CINDER_PASSWD='cinder1234!'
controllerHost='controller'
RABBIT_PASSWD='0penstackRMQ'
mysql -uroot -p${MYSQL_ROOT_PASSWD} << EOF
     DROP DATABASE IF EXISTS cinder;
     CREATE DATABASE cinder;
     GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '${CINDER_PASSWD}';
     GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '${CINDER_PASSWD}';
EOF

2.创建cinder用户并授权

source ~/admin-openrc
openstack user create --domain default --password ${CINDER_PASSWD} cinder
openstack role add --project service --user cinder admin

3.创建服务实体和端点

openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack endpoint create --region RegionOne volumev2 public http://${controllerHost}:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://${controllerHost}:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://${controllerHost}:8776/v2/%\(project_id\)s
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
openstack endpoint create --region RegionOne volumev3 public http://${controllerHost}:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://${controllerHost}:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://${controllerHost}:8776/v3/%\(project_id\)s

4.安装cinder组件

yum -y install openstack-cinder

5.配置cinder访问数据库

openstack-config --set  /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:${CINDER_PASSWD}@${controllerHost}/cinder

6.配置cinder访问rabbitmq消息队列

openstack-config --set  /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:${RABBIT_PASSWD}@${controllerHost}:5672

7.配置cinder访问memcached服务器池

openstack-config --set /etc/cinder/cinder.conf cache backend  oslo_cache.memcache_pool
openstack-config --set /etc/cinder/cinder.conf cache enabled  true
openstack-config --set /etc/cinder/cinder.conf cache memcache_servers  ${controllerHost}:11211

8.配置cinder访问keystone服务

openstack-config --set  /etc/cinder/cinder.conf DEFAULT auth_strategy  keystone
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  auth_uri  http://${controllerHost}:5000
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  auth_url  http://${controllerHost}:5000
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  auth_type password
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  project_domain_id  default
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  user_domain_id  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_PASSWD}

9.配置cinder服务监听IP

openstack-config --set  /etc/cinder/cinder.conf DEFAULT my_ip  0.0.0.0
openstack-config --set  /etc/cinder/cinder.conf DEFAULT osapi_volume_listen  \$my_ip
openstack-config --set  /etc/cinder/cinder.conf DEFAULT osapi_volume_listen_port  8776

10.配置锁路径

openstack-config --set  /etc/cinder/cinder.conf oslo_concurrency lock_path  /var/lib/cinder/tmp

11.同步数据库

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

12.启动cinder服务

systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl status openstack-cinder-api.service openstack-cinder-scheduler.service

posted @ 2019-07-19 18:28  小白的日常  阅读(355)  评论(0编辑  收藏  举报