11 Openstack-Ussuri-Cinder控制节点部署-ubuntu1804

cinder具体功能如下:
1 提供 REST API 使用户能够查询和管理 volume、volume snapshot 以及 volume type
2 提供 scheduler 调度 volume 创建请求,合理优化存储资源的分配
3 通过 driver 架构支持多种 back-end(后端)存储方式,包括 LVM,NFS,Ceph 和其他诸如 EMC、IBM 等商业存储产品和方案

11.1 配置cinder数据库

#使用root登陆数据库:

mysql -u root -p

#创建cinder数据库:

CREATE DATABASE cinder;

#授予对cinder数据库的访问权限,刷新退出数据库:

GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
  IDENTIFIED BY 'cinder.123';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
  IDENTIFIED BY 'cinder.123';
flush privileges;
exit

11.2 加载管理凭证

source adminrc.sh

11.3 创建cinder相关服务凭证

#创建cinder服务用户,并设置密码为cinder.123

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

#输出

User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 237763c262db4c039491b916f4243b97 |
| name                | cinder                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

#赋予cinder服务用户服务管理员权限及角色,无输出

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

#创建cinder服务

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

#输出

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | f1173afb33a741ddb3a6540b3a8e70f6 |
| name        | cinderv2                         |
| type        | volumev2                         |
+-------------+----------------------------------+
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

#输出

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | bf7d430353f84346b27d26a3117a52e7 |
| name        | cinderv3                         |
| type        | volumev3                         |
+-------------+----------------------------------+

11.4 创建compute API endpoints

#public v2

openstack endpoint create --region RegionOne \
  volumev2 public http://controller160:8776/v2/%\(project_id\)s

#输出

+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 19a798cd4d894b2bb1d02d740985d624            |
| interface    | public                                      |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | f1173afb33a741ddb3a6540b3a8e70f6            |
| service_name | cinderv2                                    |
| service_type | volumev2                                    |
| url          | http://controller160:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+

#internal v2

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

#输出

+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 06c7f825a50640dfb3e23332c5fb13e0            |
| interface    | internal                                    |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | f1173afb33a741ddb3a6540b3a8e70f6            |
| service_name | cinderv2                                    |
| service_type | volumev2                                    |
| url          | http://controller160:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+

#admin v2

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

#输出

+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 7bbf883d9489400e9d927df7571a59ca            |
| interface    | admin                                       |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | f1173afb33a741ddb3a6540b3a8e70f6            |
| service_name | cinderv2                                    |
| service_type | volumev2                                    |
| url          | http://controller160:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+


#public v3

openstack endpoint create --region RegionOne \
  volumev3 public http://controller160:8776/v3/%\(project_id\)s

#输出

+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 1a5f46b752944073a7a6bda9eda2839d            |
| interface    | public                                      |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | bf7d430353f84346b27d26a3117a52e7            |
| service_name | cinderv3                                    |
| service_type | volumev3                                    |
| url          | http://controller160:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+

#internal v3

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

#输出

+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 9db734e109e94f2fa6468921e797303b            |
| interface    | internal                                    |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | bf7d430353f84346b27d26a3117a52e7            |
| service_name | cinderv3                                    |
| service_type | volumev3                                    |
| url          | http://controller160:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+

#admin v3

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

#输出

+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | bc7ead53997a43bca282c6ac1a0a24c9            |
| interface    | admin                                       |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | bf7d430353f84346b27d26a3117a52e7            |
| service_name | cinderv3                                    |
| service_type | volumev3                                    |
| url          | http://controller160:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+

11.5 部署与配置cinder - controller160

#安装包

apt install cinder-api cinder-scheduler -y

#备份cinder配置

cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
egrep -v "^$|^#" /etc/cinder/cinder.conf.bak >/etc/cinder/cinder.conf

#配置cinder配置文件,在对应项底下增加以下字段
#vim /etc/cinder/cinder.conf


[DEFAULT]
# ...
my_ip = 172.16.1.160
transport_url = rabbit://rabbitmq:rabbitmq.123@controller160:5672/
auth_strategy = keystone
[database]
# ...
connection = mysql+pymysql://cinder:cinder.123@controller160/cinder

[keystone_authtoken]
# ...
www_authenticate_uri = http://controller160:5000
auth_url = http://controller160:5000
memcached_servers = controller160:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = cinder
password = cinder.123

[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp

#添加nova配置,使用cinder服务
#vim /etc/nova/nova.conf

[cinder]
os_region_name = RegionOne

#填充cinder数据库

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

#输出

2020-05-22 11:23:06.210 16097 INFO migrate.versioning.api [-] 122 -> 123...
2020-05-22 11:23:41.081 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:41.082 16097 INFO migrate.versioning.api [-] 123 -> 124...
2020-05-22 11:23:41.164 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:41.165 16097 INFO migrate.versioning.api [-] 124 -> 125...
2020-05-22 11:23:41.256 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:41.256 16097 INFO migrate.versioning.api [-] 125 -> 126...
2020-05-22 11:23:41.289 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:41.289 16097 INFO migrate.versioning.api [-] 126 -> 127...
2020-05-22 11:23:41.683 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:41.684 16097 INFO migrate.versioning.api [-] 127 -> 128...
2020-05-22 11:23:43.620 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:43.621 16097 INFO migrate.versioning.api [-] 128 -> 129...
2020-05-22 11:23:43.669 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:43.670 16097 INFO migrate.versioning.api [-] 129 -> 130...
2020-05-22 11:23:43.720 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:43.721 16097 INFO migrate.versioning.api [-] 130 -> 131...
2020-05-22 11:23:43.770 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:43.770 16097 INFO migrate.versioning.api [-] 131 -> 132...
2020-05-22 11:23:43.844 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:43.845 16097 INFO migrate.versioning.api [-] 132 -> 133...
2020-05-22 11:23:43.869 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:43.870 16097 INFO migrate.versioning.api [-] 133 -> 134...
2020-05-22 11:23:43.961 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:43.961 16097 INFO migrate.versioning.api [-] 134 -> 135...
2020-05-22 11:23:44.051 16097 INFO migrate.versioning.api [-] done
2020-05-22 11:23:44.051 16097 INFO migrate.versioning.api [-] 135 -> 136...
2020-05-22 11:23:46.008 16097 INFO migrate.versioning.api [-] done

#验证cinder数据库是否正常写入:

mysql -h controller160 -ucinder -pcinder.123 -e "use cinder;show tables;"

#重启nova服务

systemctl restart nova-api

#重启cinder服务,并配置开机启动:

systemctl enable cinder-scheduler
systemctl restart cinder-scheduler
systemctl status cinder-scheduler

#重启apache2

service apache2 restart

11.6 cinder服务验证

#加载管理凭证

source adminrc.sh

#查看服务列表

openstack service list

#输出

+----------------------------------+-----------+-----------+
| ID                               | Name      | Type      |
+----------------------------------+-----------+-----------+
| 0d9cdd8f207147bf93b573203c8e78a3 | placement | placement |
| 0e20d3c0a35e486bb2aed2bf3cc17c00 | neutron   | network   |
| 6ad962f2c8834b1cbaac24c5c952bbe7 | glance    | image     |
| 99b513bed6da45ae814b3d99a10e87e5 | keystone  | identity  |
| bf7d430353f84346b27d26a3117a52e7 | cinderv3  | volumev3  |
| f1173afb33a741ddb3a6540b3a8e70f6 | cinderv2  | volumev2  |
| fc0fb7e04b4443cd95be23d91bd0fc51 | nova      | compute   |
+----------------------------------+-----------+-----------+

至此,cinder服务已部署完毕,如有问题请联系我改正,感激不尽!

11.x 部署过程遇到的问题汇总

eg1.
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 书香水墨 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读