cinder手动安装
程序员文章站
2022-05-11 15:42:29
...
一 创建一个新的虚拟机作为存储节点
1 部署图
二 控制节点
1 安装cinder
[[email protected] ~]# yum install openstack-cinder -y
2 修改hosts
[[email protected] ~]# cat /etc/hosts
127.0.0.1 localhost
::1 localhost
10.20.0.10 controller0
10.20.0.20 network0
10.20.0.30 compute0
10.20.0.40 cinder0
3 配置cinder数据库连接
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf database connection mysql://cinder:[email protected]/cinder
4 初始化数据库
[[email protected] ~]# openstack-db --init --service cinder --password openstack
Please enter the password for the 'root' MySQL user:
Verified connectivity to MySQL.
Creating 'cinder' database.
Updating 'cinder' database password in /etc/cinder/cinder.conf
Initializing the cinder database, please wait...
Complete!
5 在keystone中创建cinder系统用户
[[email protected] ~]# keystone user-create --name=cinder --pass=cinder [email protected]
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | [email protected] |
| enabled | True |
| id | 3226dd887b8b46f78f43bc64abb729c3 |
| name | cinder |
| username | cinder |
+----------+----------------------------------+
[[email protected] ~]# keystone user-role-add --user=cinder --tenant=service --role=admin
6 在keystone中注册一个cinder的service
[[email protected] ~]# keystone service-create --name=cinder --type=volume --description="OpenStack Block Storage"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 6897f2a2184049fa87d75252b1d27e1b |
| name | cinder |
| type | volume |
+-------------+----------------------------------+
7 创建一个cinder的endpoint
[[email protected] ~]# keystone endpoint-create \
> --service-id=$(keystone service-list | awk '/ volume / {print $2}') \
> --publicurl=http://controller0:8776/v1/%\(tenant_id\)s \
> --internalurl=http://controller0:8776/v1/%\(tenant_id\)s \
> --adminurl=http://controller0:8776/v1/%\(tenant_id\)s
+-------------+------------------------------------------+
| Property | Value |
+-------------+------------------------------------------+
| adminurl | http://controller0:8776/v1/%(tenant_id)s |
| id | cd1438ca50d64830a9c7f4e525868fda |
| internalurl | http://controller0:8776/v1/%(tenant_id)s |
| publicurl | http://controller0:8776/v1/%(tenant_id)s |
| region | regionOne |
| service_id | 6897f2a2184049fa87d75252b1d27e1b |
+-------------+------------------------------------------+
8 在keystone注册一个cinderv2的service
[[email protected] ~]# keystone service-create --name=cinderv2 --type=volumev2 --description="OpenStack Block Storage v2"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage v2 |
| enabled | True |
| id | 6f5366553f714fe380fbbf26af143691 |
| name | cinderv2 |
| type | volumev2 |
+-------------+----------------------------------+
9 创建一个cinderv2的endpoint
[[email protected] ~]# keystone endpoint-create \
> --service-id=$(keystone service-list | awk '/ volumev2 / {print $2}') \
> --publicurl=http://controller0:8776/v2/%\(tenant_id\)s \
> --internalurl=http://controller0:8776/v2/%\(tenant_id\)s \
> --adminurl=http://controller0:8776/v2/%\(tenant_id\)s
+-------------+------------------------------------------+
| Property | Value |
+-------------+------------------------------------------+
| adminurl | http://controller0:8776/v2/%(tenant_id)s |
| id | c50ee75db3304e85b77cb1420bef52ff |
| internalurl | http://controller0:8776/v2/%(tenant_id)s |
| publicurl | http://controller0:8776/v2/%(tenant_id)s |
| region | regionOne |
| service_id | 6f5366553f714fe380fbbf26af143691 |
+-------------+------------------------------------------+
10 配置cinder keystone认证
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
troller0
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password cinder[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://controller0:5000
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_host controller0
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_protocol http
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_port 35357
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password cinder
11 配置qpid
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_hostname controller0
12 启动cinder controller相关服务
[[email protected] ~]# service openstack-cinder-api start
Starting openstack-cinder-api: [ OK ]
[[email protected] ~]# service openstack-cinder-scheduler start
Starting openstack-cinder-scheduler: [ OK ]
[[email protected] ~]# chkconfig openstack-cinder-api on
[[email protected] ~]# chkconfig openstack-cinder-scheduler on
13 检查启动日志,是否启动正常
[[email protected] ~]# vi /var/log/cinder/api.log
[[email protected] ~]# vi /var/log/cinder/cinder-manage.log
[[email protected] ~]# vi /var/log/cinder/scheduler.log
三 存储节点
1 创建一个存储节点
内存:1G
新增硬盘:8G
CPU:1核
2 修改IP地址
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=10.20.0.40
NETMASK=255.255.255.0
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=172.16.0.40
NETMASK=255.255.255.0
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.4.40
NETMASK=255.255.255.0
3 修改hosts
[[email protected] ~]# cat /etc/hosts
127.0.0.1 localhost
::1 localhost
10.20.0.10 controller0
10.20.0.20 network0
10.20.0.30 compute0
10.20.0.40 cinder0
4 修改主机名
[[email protected] ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=cinder0
5 安装cinder相关包
yum install -y openstack-cinder scsi-target-utils
6 创建LVM physical and logic卷,作为cinder块存储的实现
[[email protected] ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
[[email protected] ~]# vgcreate cinder-volumes /dev/sdb
Volume group "cinder-volumes" successfully created
7 添加一个过滤器保证虚拟机能扫描到LVM
vi /etc/lvm/lvm.conf
devices {
...
filter = [ "a/sda1/", "a/sdb/", "r/.*/"]
...
}
8 配置keytone认证
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
er
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password cinder[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://controller0:5000
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_host controller0
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtokenauth_protocol http
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_port 35357
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password cinder
9 配置qpid
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_hostname controller0
10 配置数据库连接
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf database connection mysql://cinder:[email protected]/cinder
11 配置glance server
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT glance_host controller0
12 配置cinder-volume 的 my_ip , 这个ip决定了存储数据跑在哪网卡上
[[email protected] ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.4.40
13 配置 iSCSI target 服务发现 Block Storage volumes
vi /etc/tgt/targets.conf
include /etc/cinder/volumes/*
14 启动cinder-volume服务
[[email protected] volumes]# service openstack-cinder-volume start
Starting openstack-cinder-volume: [ OK ]
[[email protected] volumes]# service tgtd start
Starting SCSI target daemon: [ OK ]
[[email protected] volumes]# chkconfig openstack-cinder-volume on
[[email protected] volumes]# chkconfig tgtd on
四 检测是否安装成功
[[email protected] ~]# cinder-manage service list
Binary Host Zone Status State Updated At
cinder-scheduler controller0 nova enabled :-) 2018-03-17 10:54:40
cinder-volume cinder0 nova enabled :-) 2018-03-17 10:54:36
五 在dashboard上创建一个云盘
1 创建一个云硬盘
2 创建成功
六 注意
删除云硬盘前先要detach
上一篇: Cinder iSACI演示
下一篇: Cinder API源码分析
推荐阅读
-
压缩包安装MySQL步骤教程
-
eclipse中Code Recommends插件下载安装失败的三种解决办法
-
Django在win10下的安装并创建工程
-
安装完torch geometric,import torch_geometric然后报错:OSError: [WinError 127] 找不到指定的模块
-
条码机怎么安装?条码机详细的安装与使用的教程
-
HP惠普X系列打印机打印自定义纸张需要手动按OK怎么办?
-
HP惠普MFP一体机怎么安装驱动?
-
惠普打印机断开电脑后需要重新安装驱动该怎么办?
-
Tipard Video Converter Ultimate安装及激活图文教程(附注册表下载)
-
惠普1010打印机怎么安装使用?