OpenStack-Cinder 相关(端口8776)
1.安装Cinder服务(控制节点):
172.16.1.240 openstack-ser 控制节点
172.16.1.241 存储节点
yum install openstack-cinder python-cinderclient
2.创建Cinder数据库:
mysql> CREATE DATABASE cinder;
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY '123123';
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY '123123';
3.修改配置文件:
vim /etc/cinder/cinder.conf
[DEFAULT]
my_ip = 172.16.1.240
glance_host = openstack-ser
auth_strategy = keystone
rpc_backend = rabbit
[database]
connection = mysql://cinder:123123@openstack-ser/cinder
[keystone_authtoken]
auth_uri = http://openstack-ser:5000
auth_url = http://openstack-ser:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = cinder
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_rabbit]
rabbit_host = openstack-ser
rabbit_userid = openstack
rabbit_password = 123123
需要修改nova配置文件开启了Cinder
vim /etc/nova/nova.con
[cinder]
os_region_name = RegionOne
4.同步数据库:
su -s /bin/sh -c "cinder-manage db sync" cinder
5.创建Cinder的项目,角色,用户:
openstack user create --domain default --password=cinder cinder
openstack role add --project service --user cinder admin
6.启动服务:
systemctl restart openstack-nova-api.service #前面修改了nova配置文件要重启下nova-api
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
7.注册Cinder的三种API:
PS: Cinder有v1和v2两个版本的API,都需要注册
openstack service create --name cinder --description "OpenStack Block Storage" volume
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack endpoint create --region RegionOne \
volume public http://openstack-ser:8776/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
volume internal http://openstack-ser:8776/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
volume admin http://openstack-ser:8776/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
volumev2 public http://openstack-ser:8776/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
volumev2 internal http://openstack-ser:8776/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
volumev2 admin http://openstack-ser:8776/v2/%\(tenant_id\)s
8.安装Cinder服务(存储节点):
yum install openstack-cinder targetcli python-keystone
#我们这里使用iSCSI网络存储
9.需要在存储节点的硬盘上面创建LVM:
# pvcreate /dev/sdb
# vgcreate cinder-volumes /dev/sdb #vg的名称不要乱改
vim /etc/lvm/lvm.conf #配置LVM只有:只有实例可以访问存储块
devices {
...
filter = [ "a/sdb/", "r/.*/"]
10.拷贝控制节点的配置文件并修改:
scp 172.16.1.240:/etc/cinder/cinder.conf /etc/cinder/
vim /etc/cinder/cinder.conf
[DEFAULT]
glance_api_servers = http://controller:9292
#下面这段在文章尾部添加
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
11.启动服务:
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service
12.验证:
# cinder service-list
+------------------+-------------------+------+---------+-------+-----------------------
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+-------------------+------+---------+-------+-----------------------
| cinder-scheduler | openstack-ser | nova | enabled | up | 2017-02-27T08:00:54.000000 | - |
| cinder-volume | openstack-cli@lvm | nova | enabled | up | 2017-02-27T08:00:54.000000 | - |
+------------------+-------------------+------+---------+-------+-----------------------
13.使用界面:
1: 然后可以进入dashboard创建云硬盘,点击“管理以挂载的云硬盘”来挂载到虚拟机上。
2:云硬盘挂载到虚拟机后,卸载需要先umount后在执行。
OpenStack-Lbaas 相关(端口8776)
1.安装Lbaas服务:
yum install openstack-neutron-lbaas python-neutron-lbaas haproxy
2.修改配置文件:
vim /etc/neutron/neutron.conf
service_plugins = router,lbaas
vim /etc/neutron/lbaas_agent.ini
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
device_driver = neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
3.重启neutron服务:
systemctl restart neutron-server
systemctl restart neutron-lbaas-agent.service
重启以后可以在dashboard的网络里面找到负责均衡配置项。
4.创建负责均衡完成后验证:
ip netns li #查看命名空间
ip netns exec qlbaas-6104510d-cf14-4608-8c9f-9e7841b1a918 netstat -antp #可以看到haproxy的端口监听
ip netns exec qlbaas-6104510d-cf14-4608-8c9f-9e7841b1a918 ip add #查看VIP