OpenstackMitakaforCentos7.2部署指南(二)

4.4 計(jì)算服務(wù)配置(Compute Service Nova)

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供和平網(wǎng)站建設(shè)、和平做網(wǎng)站、和平網(wǎng)站設(shè)計(jì)、和平網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、和平企業(yè)網(wǎng)站模板建站服務(wù),十年和平做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

部署節(jié)點(diǎn):Controller Node

在Controller節(jié)點(diǎn)上需要安裝novaapi  novaconductor  novaconsoleauth  novanovncproxy  novascheduler

MySQL -u root  -p123456
CREATE DATABASE nova_api;
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'novaapi';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'novaapi';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova';


openstack user create --domain default   --password-prompt nova
openstack role add --project service --user nova admin
openstack service create --name nova   --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne   compute public http://controller:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne   compute internal http://controller:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne   compute admin http://controller:8774/v2.1/%\(tenant_id\)s

安裝計(jì)算服務(wù)組件

① 安裝Nova組件

yum install openstack-nova-api openstack-nova-conductor   openstack-nova-console openstack-nova-novncproxy   openstack-nova-scheduler

② 修改配置文件sudo vi /etc/nova/nova.conf 。

在[DEFAULT] 處只啟用compute 和metadata APIs,將

267 #enabled_apis=osapi_compute,metadata
改為
enabled_apis = osapi_compute,metadata

在[api_database] 和[database] 處配置數(shù)據(jù)庫(kù)訪問(wèn)連接(若沒(méi)有[api_database] 和[database] 標(biāo)記,則

手動(dòng)添加)

注:將NOVA_DBPASS 替換為前面設(shè)計(jì)的實(shí)際密碼

[api_database]
...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
[database]
...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova

在[DEFAULT] 和[oslo_messaging_rabbit] 處配置RabbitMQ消息隊(duì)里訪問(wèn)

注:將RABBIT_PASS 替換為前面設(shè)計(jì)的實(shí)際密碼


[DEFAULT]
...
rpc_backend = rabbit

[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack

rabbit_password = RABBIT_PASS

在[DEFAULT] 和[keystone_authtoken] 處配置身份服務(wù)訪問(wèn)

注:將NOVA_PASS 替換為前面設(shè)計(jì)的實(shí)際密碼

注:注釋或刪除[keystone_authtoken] 處其他內(nèi)容

[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 = nova

password = nova

在[DEFAULT] 處配置my_ip 為Controller節(jié)點(diǎn)Management Network網(wǎng)口地址

my_ip = 10.0.0.11

在[DEFAULT] 處啟用網(wǎng)絡(luò)服務(wù)支持

注:默認(rèn)情況下,計(jì)算服務(wù)使用主機(jī)內(nèi)部防火墻驅(qū)動(dòng),因此必須禁用OpenStack網(wǎng)絡(luò)服務(wù)中的防火墻驅(qū)動(dòng)。

use_neutron = True

firewall_driver = nova.virt.firewall.NoopFirewallDriver

在[vnc] 處,使用Controller節(jié)點(diǎn)Management Network網(wǎng)口地址配置VNC代理(VNC proxy)。


[vnc]
...
vncserver_listen = $my_ip

vncserver_proxyclient_address = $my_ip

在[glance] 處配置鏡像服務(wù)API位置

[glance]
...

api_servers = http://controller:9292

在[oslo_concurrency] 處配置lock_path

[oslo_concurrency]
...

lock_path = /var/lib/nova/tmp


將配置信息寫入計(jì)算服務(wù)數(shù)據(jù)庫(kù)nova

# su -s /bin/sh -c "nova-manage api_db sync" nova
# su -s /bin/sh -c "nova-manage db sync" nova

重啟計(jì)算服務(wù)

 systemctl enable openstack-nova-api.service   openstack-nova-consoleauth.service openstack-nova-scheduler.service   openstack-nova-conductor.service openstack-nova-novncproxy.service
 systemctl start openstack-nova-api.service   openstack-nova-consoleauth.service openstack-nova-scheduler.service   openstack-nova-conductor.service openstack-nova-novncproxy.service

部署節(jié)點(diǎn):Compute Node

在Compute節(jié)點(diǎn)上需要安裝novacompute

。

注:以下步驟在Compute節(jié)點(diǎn)上執(zhí)行

安裝配置計(jì)算服務(wù)組件

安裝nova‐compute 組件

yum install openstack-nova-compute

修改配置文件sudo vi /etc/nova/nova.conf

① 在[DEFAULT] 和[oslo_messaging_rabbit] 處配置RabbitMQ消息隊(duì)列訪問(wèn)

注:將RABBIT_PASS 替換為前面設(shè)計(jì)的實(shí)際密碼

[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS

② 在[DEFAULT] 和[keystone_authtoken] 處配置身份服務(wù)訪問(wèn)

注:將NOVA_PASS 替換為前面設(shè)計(jì)的實(shí)際密碼

注:注釋或刪除[keystone_authtoken] 處其他內(nèi)容

[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 = nova

password = NOVA_PASS

在[DEFAULT] 處配置my_ip 為Compute節(jié)點(diǎn)Management Network網(wǎng)口地址

my_ip=10.0.0.31

在[DEFAULT] 處啟用網(wǎng)絡(luò)服務(wù)支持

[DEFAULT]
...
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver

在[vnc] 處配置遠(yuǎn)程控制訪問(wèn)

[vnc]
...
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

注: VNC服務(wù)器端監(jiān)聽所有地址,VNC代理客戶端只監(jiān)聽Compute節(jié)點(diǎn)Management Network網(wǎng)口地址,

base URL設(shè)置Compute節(jié)點(diǎn)遠(yuǎn)程控制臺(tái)瀏覽器訪問(wèn)地址(若瀏覽無(wú)法解析controller,則需替換為相應(yīng)IP地

址)。

在[glance] 處配置鏡像服務(wù)API

api_servers = http://controller:9292

在[oslo_concurrency] 處配置lock_path

lock_path = /var/lib/nova/tmp

完成安裝,重啟計(jì)算服務(wù)

① 檢測(cè)是否支持虛擬機(jī)硬件加速

egrep ‐c '(vmx|svm)' /proc/cpuinfo

若返回結(jié)果大于等于1,則支持,無(wú)需做額外配置;

若返回結(jié)果0,則不支持硬件加速,需要做以下額外配置:修改配置文件sudo vi /etc/nova/novacompute.

conf 中的libvirt 設(shè)置項(xiàng),使用QEMU 代替KVM 。


[libvirt]

virt_type = qemu


systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service

驗(yàn)證計(jì)算服務(wù)是否安裝正確

注:以下步驟需在Controller節(jié)點(diǎn)執(zhí)行

① 設(shè)置OpenStack admin 用戶環(huán)境變量

source admin-openrc

② 打印服務(wù)組件列表,驗(yàn)證每個(gè)成功啟動(dòng)和注冊(cè)的進(jìn)程。

[root@controller ~]# openstack compute service list
+----+-----------------+------------+----------+---------+-------+------------------+
| Id | Binary          | Host       | Zone     | Status  | State | Updated At       |
+----+-----------------+------------+----------+---------+-------+------------------+
|  1 | nova-           | controller | internal | enabled | up    | 2016-09-03T09:29 |
|    | consoleauth     |            |          |         |       | :56.000000       |
|  2 | nova-conductor  | controller | internal | enabled | up    | 2016-09-03T09:29 |
|    |                 |            |          |         |       | :56.000000       |
|  3 | nova-scheduler  | controller | internal | enabled | up    | 2016-09-03T09:29 |
|    |                 |            |          |         |       | :56.000000       |
|  7 | nova-compute    | compute    | nova     | enabled | up    | 2016-09-03T09:29 |
|    |                 |            |          |         |       | :56.000000       |
+----+-----------------+------------+----------+---------+-------+------------------+



4.5 網(wǎng)絡(luò)服務(wù)配置(Networking Service Neutron)

部署節(jié)點(diǎn):Controller Node

在MariaDB(MySQL)中創(chuàng)建neutron 數(shù)據(jù)庫(kù)

mysql -u root -p
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost'  IDENTIFIED BY 'neutron';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%'   IDENTIFIED BY 'neutron';

創(chuàng)建網(wǎng)絡(luò)服務(wù)證書和API路徑

openstack user create --domain default --password-prompt neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron   --description "OpenStack Networking" network
openstack endpoint create --region RegionOne   network public http://controller:9696
openstack endpoint create --region RegionOne   network internal http://controller:9696
openstack endpoint create --region RegionOne   network admin http://controller:9696


安裝配置neutron‐server 服務(wù)組件

yum install openstack-neutron openstack-neutron-ml2 

修改配置文件sudo vi /etc/neutron/neutron.conf

vi /etc/neutron/neutron.conf
[database]
connection = mysql://neutron:neutron@controller/neutron
[DEFAULT] 
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
[DEFAULT]
rpc_backend = rabbit
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = openstack
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]  
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = neutron
[DEFAULT]
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
[nova]
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = nova
password = nova
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
[DEFAULT]
verbose = True

配置ML2插件   配置LINUX橋接代理 配置元數(shù)據(jù)代理  

ML2 plugin
使用Linux網(wǎng)橋機(jī)制為OpenStack實(shí)例建立layer2
虛擬網(wǎng)絡(luò)設(shè)施(橋接和交換)。修改配置文件sudo vi /etc/neutron/plugins/ml2/ml2_conf.ini
vi /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,vlan,vxlan   #配置ML2后如果移除此項(xiàng)目會(huì)引起數(shù)據(jù)庫(kù)不一致
[ml2]
tenant_network_types = vxlan
[ml2]
mechanism_drivers = linuxbridge,l2population
[ml2]
extension_drivers = port_security  ##啟用端口安全擴(kuò)展驅(qū)動(dòng)
[ml2_type_flat]
flat_networks = public  ##運(yùn)營(yíng)商虛擬網(wǎng)絡(luò)為flat network
[ml2_type_vxlan]
vni_ranges = 1:1000
[securitygroup]
enable_ipset = True  ##啟用ipset 來(lái)增強(qiáng)安全組規(guī)則的效率

將配置信息寫入neutron 數(shù)據(jù)庫(kù)

su ‐s /bin/sh ‐c "neutron‐db‐manage ‐‐config‐file /etc/neutron/neutron.conf ‐‐config‐file
/etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

配置計(jì)算節(jié)點(diǎn)使用網(wǎng)絡(luò)

vi /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller1:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
service_metadata_proxy = True
metadata_proxy_shared_secret = metadata

創(chuàng)建文件連接

ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

重啟服務(wù)

systemctl restart openstack-nova-api.service
systemctl restart neutron-server.service
systemctl  start  neutron-metadata-agent.service
systemctl enable neutron-server.service
systemctl  enable neutron-metadata-agent.service


部署節(jié)點(diǎn):Network Node

在Network 節(jié)點(diǎn)上部署組件: 

網(wǎng)絡(luò)服務(wù)部署架構(gòu)有兩種方式Provider Networks 和Self‐Service Networks ,在本文開頭作了簡(jiǎn)要介紹。本文采

用Self‐Service Networks 方式部署。

參考文檔:Deploy Networking Service using the Architecture of SelfService

Networks

yum install  openstack-neutron-ml2   openstack-neutron-linuxbridge   ebtables

配置公共服務(wù)組件

公共組件配置包括認(rèn)證機(jī)制、消息隊(duì)列。修改配置文件sudo vi /etc/neutron/neutron.conf

[DEFAULT]
rpc_backend = rabbit
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = openstack
[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 = neutron
password = neutron
配置Linux網(wǎng)橋代理
Linux bridge agent為實(shí)例建立了二層虛擬網(wǎng)絡(luò)設(shè)施,而且可以管理安全組。
修改配置文件sudo vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini   #注意橋接的網(wǎng)卡名稱
[linux_bridge]
physical_interface_mappings = public:eth0
[vxlan]
enable_vxlan = True
local_ip = 10.0.0.21  #物理公共網(wǎng)絡(luò)接口地址(controller)
l2_population = True
[agent]
prevent_arp_spoofing = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

配置三層網(wǎng)絡(luò)代理

L3(Layer‐3) Agent 位自服務(wù)網(wǎng)絡(luò)提供了路由和NAT服務(wù)。

修改配置文件sudo vi /etc/neutron/l3_agent.ini ,在[DEFAULT] 處配置Linux網(wǎng)橋接口驅(qū)動(dòng)(Linux BridgeInterface Driver)和外網(wǎng)網(wǎng)橋。

 vi /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =   ####注: external_network_bridge 值故意空缺,這樣可使多個(gè)外部網(wǎng)絡(luò)共用一個(gè)代理。
[DEFAULT]
verbose = True

修改配置文件sudo vi /etc/neutron/dhcp_agent.ini ,在[DEFAULT] 處配置Linux bridge interface

driver 和DNSmasq DHCP driver ,啟用獨(dú)立的metadata 使運(yùn)營(yíng)商網(wǎng)絡(luò)實(shí)例可以訪問(wèn)虛擬網(wǎng)絡(luò)元信息。

vi /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
[DEFAULT]
verbose = True

配置元數(shù)據(jù)代理

元數(shù)據(jù)代理提供一些諸如證書之類的配置信息。

修改配置文件sudo vi /etc/neutron/metadata_agent.ini ,在[DEFAULT] 處配置元數(shù)據(jù)主機(jī)和共享密鑰。

注:將METADATA_SECRET 替換為前面設(shè)計(jì)的實(shí)際密碼

[DEFAULT]
nova_metadata_ip = controller
metadata_proxy_shared_secret = metadata


systemctl start neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service
systemctl enable neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service

部署節(jié)點(diǎn):Compute Node

安裝網(wǎng)絡(luò)服務(wù)組件

[root@compute ~]# yum install openstack-neutron-linuxbridge

配置公共組件

公共組件配置包括認(rèn)證機(jī)制、消息隊(duì)列、插件。

[root@compute ~]# cat /etc/neutron/neutron.conf
[DEFAULT]
rpc_backend = rabbit
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = openstack
[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 = neutron
password = neutron

配置網(wǎng)絡(luò)設(shè)置

配置Linux網(wǎng)橋代理,修改配置文件sudo vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[root@compute ~]# cat   /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = True
local_ip = 10.0.0.31
l2_population = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

配置計(jì)算服務(wù)訪問(wèn)網(wǎng)絡(luò)

修改配置文件sudo vi /etc/nova/nova.conf

[root@compute ~]# vi /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron

重啟服務(wù)

 systemctl  restart openstack-nova-compute.service
systemctl restart neutron-linuxbridge-agent.service
systemctl enable  neutron-linuxbridge-agent.service

驗(yàn)證

[root@controller ~]# neutron  ext-list
[root@controller ~]# neutron  agent-list                   
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| id                                   | agent_type         | host       | availability_zone | alive | admin_state_up | binary                    |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| 0e1c9f6f-a56b-40d1-b43e-91754cabcf75 | Metadata agent     | network    |                   | :-)   | True           | neutron-metadata-agent    |
| 24c8daec-b495-48ba-b70d-f7d103c8cda1 | Linux bridge agent | compute    |                   | :-)   | True           | neutron-linuxbridge-agent |
| 2e93bf03-e095-444d-8f74-0b832db4a0be | Linux bridge agent | network    |                   | :-)   | True           | neutron-linuxbridge-agent |
| 456c754a-d2c0-4ce5-8d9b-b0089fb77647 | Metadata agent     | controller |                   | :-)   | True           | neutron-metadata-agent    |
| 8a1c7895-fc44-407f-b74b-55bb1b4519d8 | DHCP agent         | network    | nova              | :-)   | True           | neutron-dhcp-agent        |
| 93ad18bf-d961-4d00-982c-6c617dbc0a5e | L3 agent           | network    | nova              | :-)   | True           | neutron-l3-agent          |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+


4.6 儀表盤服務(wù)配置(Dashboard Service Horizon)

儀表盤是一個(gè)Web接口,可使云管理員和用戶管理各種各樣的OpenStack資源和服務(wù)。本文采用Apache Web

Server 部署Dashboard 服務(wù)。

部署節(jié)點(diǎn):Controller Node

yum install openstack-dashboard

修改配置文件sudo vim /etc/openstack‐dashboard/local_settings


OPENSTACK_HOST = "controller"

ALLOWED_HOSTS = ['*', ]

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': 'controller:11211',
    }
}

OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST

OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True

OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "p_w_picpath": 2,
    "volume": 2,
}

OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "default"

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"

OPENSTACK_NEUTRON_NETWORK = {
    ...
    'enable_router': False,
    'enable_quotas': False,
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_lb': False,
    'enable_firewall': False,
    'enable_***': False,
    'enable_fip_topology_check': False,
}

TIME_ZONE = "TIME_ZONE"


systemctl restart httpd.service memcached.service



當(dāng)前文章:OpenstackMitakaforCentos7.2部署指南(二)
本文地址:http://bm7419.com/article34/jdggse.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化外貿(mào)建站、云服務(wù)器、全網(wǎng)營(yíng)銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司