雲計算Openstack-Liberty版-Cinder+lbaas -學習筆記

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章