目录
(1) 主机
表1 主机
主机 | 架构 | IP | 备注 |
controller | 控制节点 | 192.168.204.210 | 已部署 |
compute01 | 计算节点1 | 192.168.204.211? | 已部署 |
compute02 | 计算节点2 | 192.168.204.212 | 已部署 |
storage01 | 存储节点1 | 192.168.204.221 |
(2)官网
OpenStack Docs: OpenStack Installation Guide for Red Hat Enterprise Linux and CentOS
(3)网络
?①存储节点1? ping?控制节点
?
②存储节点1 ping 计算节点1 与?计算节点2
?
(4) 时间同步
①?存储节点1
[root@storage01 ~]# yum install -y chrony
?
[root@storage01 ~]# vim /etc/chrony.conf
[root@storage01 ~]# systemctl restart chronyd.service && systemctl enable chronyd.service
??
?③测试
[root@controller ~]# date
[root@compute01 ~]# date
[root@compute02 ~]# date
[root@storage01 ~]# date
?
?
?
?
(5) 控制节点查看(目前已部署controller、compute01与compute02)
# neutron agent-list
(1)创建数据库
①用数据库连接客户端 (生产环境需要密码)
$ mysql -u root -p
② 创建?cinder?数据库
CREATE DATABASE cinder;
③ 允许?cinder?数据库合适的访问权限(用合适的密码替换?CINDER_DBPASS)
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY 'CINDER_DBPASS';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY 'CINDER_DBPASS';
?
(2)创建一个?cinder?用户
$ openstack user create --domain default --password-prompt cinder
?(3)添加?admin?角色到?cinder?用户上
$ openstack role add --project service --user cinder admin
?(4)创建?cinder?和?cinderv2?服务实体
$ openstack service create --name cinder \
--description "OpenStack Block Storage" volume
$ openstack service create --name cinderv2 \
--description "OpenStack Block Storage" volumev2
?
(5)查看
# openstack service list |grep cinder
?(6)创建块设备存储服务的 API 入口点
$ openstack endpoint create --region RegionOne \
volume public http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volume internal http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volume admin http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volumev2 public http://controller:8776/v2/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volumev2 admin http://controller:8776/v2/%\(tenant_id\)s
??
(7)查看
?
# openstack endpoint list |grep cinder
?
?
(8)?安装软件包
# yum install openstack-cinder
??
(9)?编辑?/etc/cinder/cinder.conf
① 在 “[DEFAULT]” 和 “[oslo_messaging_rabbit]”部分,配置 “RabbitMQ” 消息队列访问
[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
②在 “[DEFAULT]” 和 “[keystone_authtoken]” 部分,配置认证服务访问
[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS
③ 在?[DEFAULT?部分,配置my_ip来使用控制节点的管理接口的IP 地址
[DEFAULT]
...
my_ip = 192.168.204.210
④ 在?[oslo_concurrency]?部分,配置锁路径
[oslo_concurrency]
...
lock_path = /var/lib/cinder/tmp
⑤ 备份复制
?
?
(10)?初始化块设备服务的数据库(忽略输出中任何不推荐使用的信息)
# su -s /bin/sh -c "cinder-manage db sync" cinder
????
(11)配置计算节点以使用块设备存储
编辑文件?/etc/nova/nova.conf?
[cinder]
os_region_name = RegionOne
?
?
(12)重启服务
①重启计算API 服务
# systemctl restart openstack-nova-api.service
②启动块设备存储服务,并将其配置为开机自启
# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
?
(13)登录系统
?
(14)已新增卷的模块
?
(15)查看卷?
(16)查看服务列表
# openstack service list
?
(1)安装 LVM 包
# yum install lvm2
??
(2)启动LVM的metadata服务并且设置该服务随系统启动
# systemctl enable lvm2-lvmetad.service
# systemctl start lvm2-lvmetad.service
?
(3)查看分区情况
# fdisk -l
(4)查看挂载情况
# df -Th
(5)创建LVM 物理卷
①?创建LVM 物理卷?/dev/sdc?
# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
② 创建LVM 物理卷?/dev/sdd?
# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created
③查看
# pvs
(7)创建 LVM 卷组
① ?创建 LVM 卷组?cinder-ssd
# vgcreate cinder-ssd /dev/sdb
Volume group "cinder-ssd" successfully created
② 创建 LVM 卷组?cinder-data
# vgcreate cinder-ssd /dev/sdc
Volume group "cinder-data" successfully created
③ 查看
# vgs
(8)重新配置LVM,让它只扫描包含指定卷组的设备,编辑/etc/lvm/lvm.conf文件
①在devices部分,添加一个过滤器,只接受/dev/sdb 与/dev/sdc 设备,拒绝其他所有设备
devices {
...
filter = [ "a/sdb/", "a/sdc/","r/.*/"]
(9)?安装软件包
# yum install openstack-cinder targetcli python-keystone
(10)?编辑?/etc/cinder/cinder.conf
①在?[database]?部分,配置数据库访问
[database]
...
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
②在 “[DEFAULT]” 和 “[oslo_messaging_rabbit]”部分,配置 “RabbitMQ” 消息队列访问
[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
③ 在 “[DEFAULT]” 和 “[keystone_authtoken]” 部分,配置认证服务访问
[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS
④ 在?[DEFAULT]?部分,配置?my_ip?选项
[DEFAULT]
...
my_ip = 192.168.204.212
?⑤ 在[ssd]部分,配置LVM后端以LVM驱动结束,卷组cinder-ssd?,iSCSI 协议和正确的 iSCSI服务
[ssd]
...
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-ssd
iscsi_protocol = iscsi
iscsi_helper = lioadm
volume_backend_name = ssd
?⑥?在[sata]部分,配置LVM后端以LVM驱动结束,卷组cinder-data ,iSCSI 协议和正确的 iSCSI服务
[ssd]
...
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-data
iscsi_helper = lioadm
volume_backend_name = sata
?⑦在?[DEFAULT]?部分,启用 LVM 后端
[DEFAULT]
...
enabled_backends = ssd,sata
⑧在?[DEFAULT]?区域,配置镜像服务 API 的位置
[DEFAULT]
...
glance_api_servers = http://controller:9292
在?[oslo_concurrency]?部分,配置锁路径
[oslo_concurrency]
...
lock_path = /var/lib/cinder/tmp
⑨备份复制
①启动块存储卷服务及其依赖的服务,并将其配置为随系统启动
# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service
(12)控制节点查看服务列表
# openstack service list
(1)登录系统
(2)查看卷
(3)创建卷
(4)完成
(5)控制节点查看
# cinder list
(6)存储节点查看
# lvs
(7) 扩展卷
(8)修改为2G?
(9)扩展中
(10)完成
(11)控制节点查看
# cinder list
(12)存储节点查看
# lvs
(13)删除卷
(14)查看
(15)新增存储类型ssd与sata
(16) 关联后端存储
(17)查看卷
(18)创建ssd类型卷
(19)创建中
(20)完成
(21)创建sata类型卷
(22) 创建中
(23)完成
(24)控制节点查看
# cinder list
(25)存储节点查看
# lvs