您好,登錄后才能下訂單哦!
openstack
時(shí)間:2016年11月28日
Nova是openstack最早的兩塊模塊之一,另一個(gè)是對(duì)象存儲(chǔ)swift
。在openstack體系中一個(gè)叫做計(jì)算節(jié)點(diǎn)
,一個(gè)叫做控制節(jié)點(diǎn)
。這個(gè)主要和nova相關(guān),我們把安裝為計(jì)算節(jié)點(diǎn)nova-compute
,把除了nova-compute叫做控制節(jié)點(diǎn)。nova-compute是創(chuàng)建虛擬機(jī)的,只是創(chuàng)建虛擬機(jī),所有的控制都在另一臺(tái)上。
nova有非常多的組件(服務(wù))
Nova服務(wù)介紹 API:
負(fù)責(zé)接受和響應(yīng)外部請(qǐng)求。支持OpenStack API,EC2 API Cert:
負(fù)責(zé)身份認(rèn)證EC 2 Scheduler:
用于云主機(jī)調(diào)度 Conductor:
計(jì)算節(jié)點(diǎn)訪問(wèn)數(shù)據(jù)的中間件 Consoleauth:
用于控制臺(tái)的授權(quán)驗(yàn)證 Novncproxy:
VNC代理
提示:EC 2
是亞馬遜云主機(jī)的意思
Nova scheduler
Nova scheduler
模塊在openstack中的作用就是決策虛擬機(jī)創(chuàng)建在那個(gè)主機(jī)(計(jì)算節(jié)點(diǎn))上
決策一個(gè)虛擬機(jī)應(yīng)該調(diào)度到那個(gè)物理節(jié)點(diǎn),需要分兩個(gè)步驟:
1、過(guò)濾(Fliter)
2、計(jì)算權(quán)值(Weight)
提示:我們經(jīng)常會(huì)出現(xiàn)找不到有效的主機(jī)?為什么?
因?yàn)?code>nova scheduler認(rèn)為沒(méi)有資源創(chuàng)建虛擬機(jī),即使你有100G
內(nèi)存,如果nova scheduler
認(rèn)為你沒(méi)有資格照樣無(wú)法進(jìn)行創(chuàng)建。scheduler
作用就是決策虛擬機(jī)創(chuàng)建在那個(gè)主機(jī)上
經(jīng)過(guò)主機(jī)過(guò)濾后,需要對(duì)主機(jī)進(jìn)行權(quán)值的計(jì)算,根據(jù)策略選擇相應(yīng)的某一臺(tái)主機(jī)(對(duì)于每一個(gè)要?jiǎng)?chuàng)建的虛擬機(jī)而言)
控制節(jié)點(diǎn)設(shè)置:
數(shù)據(jù)庫(kù)以及keystone修改我們?cè)谇懊嬉呀?jīng)完成,所以在此跳過(guò)
安裝軟件包
[root@linux-node1 ~]# yum install openstack-nova-api openstack-nova-conductor \> openstack-nova-console openstack-nova-novncproxy \> openstack-nova-scheduler
在配置文件中修改數(shù)據(jù)庫(kù)的連接地址
[root@linux-node1 ~]# vim /etc/nova/nova.conf…[database]connection=mysql+pymysql://nova:nova@192.168.56.11/nova…[api_database]connection=mysql+pymysql://nova:nova@192.168.56.11/nova_api
提示:不要修改錯(cuò)了,每個(gè)都在在相對(duì)應(yīng)的模塊下面進(jìn)行修改
同步數(shù)據(jù)庫(kù)
[root@linux-node1 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova[root@linux-node1 ~]# su -s /bin/sh -c "nova-manage db sync" nova
提示:db的有警告可以忽略
檢查是否有表結(jié)構(gòu)
[root@linux-node1 ~]# mysql -h 192.168.56.11 -unova -pnova -e "use nova;show tables;"[root@linux-node1 ~]# mysql -h 192.168.56.11 -unova_api -pnova_api -e "use nova_api;show tables;"
配置keystone
[root@linux-node1 ~]# vim /etc/nova/nova.conf…[keystone_authtoken]auth_uri = http://192.168.56.11:5000auth_url = http://192.168.56.11:35357memcached_servers = 192.168.56.11:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = novapassword = nova…[DEFAULT]auth_strategy=keystone#打開(kāi)注釋,此行代表使用keystone進(jìn)行認(rèn)證
RabbitMq(消息隊(duì)列配置)
因?yàn)?code>nova服務(wù)之間使用消息隊(duì)列進(jìn)行溝通,所以我們需要配置rabbitmq
[root@linux-node1 ~]# vim /etc/nova/nova.conf[DEFAULT]rpc_backend=rabbit#搜索rpc_backend打開(kāi)注釋rabbit_host=192.168.56.11將localhost修改為IP地址rabbit_port=5672端口我們可以開(kāi)啟也可以不開(kāi)啟默認(rèn)就好rabbit_userid=openstackrabbit_password=openstack這個(gè)是我們?cè)趓abbitmq上配置的用戶
配置nova自己的一些功能
設(shè)置啟用的元數(shù)據(jù)API[root@linux-node1 ~]# vim /etc/nova/nova.conf[DEFAULT]enabled_apis=osapi_compute,metadata啟動(dòng)網(wǎng)絡(luò)服務(wù)支持use_neutron=true關(guān)閉防火墻firewall_driver=nova.virt.firewall.NoopFirewallDriver
提示:默認(rèn)情況下,計(jì)算服務(wù)使用內(nèi)置的防火墻服務(wù)。由于網(wǎng)絡(luò)服務(wù)包含了防火墻服務(wù),你必須使用nova.virt.firewall.NoopFirewallDriver
防火墻服務(wù)來(lái)禁用掉計(jì)算服務(wù)內(nèi)置的防火墻服務(wù)
我們不配置my IP
,因?yàn)镸y IP是一個(gè)大坑
配置VNC
代理使用控制節(jié)點(diǎn)的管理接口IP地址
[root@linux-node1 ~]# vim /etc/nova/nova.confvncserver_listen=192.168.56.11vncserver_proxyclient_address=192.168.56.11
配置glance鏡像服務(wù)API
[root@linux-node1 ~]# vim /etc/nova/nova.conf[glance]api_servers=http://192.168.56.11:9292
配置鎖路徑
[oslo_concurrency]…lock_path=/var/lib/nova/tmp
nova配置說(shuō)明
[root@linux-node1 ~]# grep '^[a-z]' /etc/nova/nova.confenabled_apis=osapi_compute,metadata #啟動(dòng)apiauth_strategy=keystone #設(shè)置keystonefirewall_driver=nova.virt.firewall.NoopFirewallDriver #關(guān)閉防火墻use_neutron=true #使用neutronrpc_backend=rabbit #使用rabbitmqconnection = mysql+pymysql://nova:nova@192.168.56.11/nova_api #數(shù)據(jù)庫(kù)地址connection = mysql+pymysql://nova:nova@192.168.56.11/nova #數(shù)據(jù)庫(kù)地址api_servers=http://192.168.56.11:9292 #glance api地址auth_uri = http://192.168.56.11:5000 #keystoneauth_url = http://192.168.56.11:35357 #keystonememcached_servers = 192.168.56.11:11211 #keystoneauth_type = password #keystoneproject_domain_name = default #keystoneuser_domain_name = default #keystoneproject_name = service #keystone username = nova #keystonepassword = nova #keystonelock_path=/var/lib/nova/tmp #鎖路徑rabbit_host=192.168.56.11 #rabbitmqrabbit_port=5672 #rabbitmqrabbit_userid=openstack #rabbitmqrabbit_password=openstack #rabbitmqvncserver_listen=192.168.56.11 #VNCvncserver_proxyclient_address=192.168.56.11 #VNC
設(shè)置開(kāi)機(jī)啟動(dòng),并啟動(dòng)服務(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
nova啟動(dòng)成功之后還需要去keystone
上進(jìn)行注冊(cè),否則別人無(wú)法進(jìn)行連接
創(chuàng)建nova服務(wù)
[root@linux-node1 ~]# source admin-openstack.sh [root@linux-node1 ~]# openstack service create --name nova --description "Openstack Compute " compute+-------------+----------------------------------+| Field | Value |+-------------+----------------------------------+| description | Openstack Compute || enabled | True || id | c9aca55493924f2ba9cb5b304cb1322f || name | nova || type | compute |+-------------+----------------------------------+
創(chuàng)建Compute服務(wù)api端點(diǎn)
[root@linux-node1 ~]# openstack endpoint create --region RegionOne \> compute public http://192.168.56.11:8774/v2.1/%\(tenant_id\)s+--------------+----------------------------------------------+| Field | Value |+--------------+----------------------------------------------+| enabled | True || id | 71414f00b2834e8190ee25c219e3d3c4 || interface | public || region | RegionOne || region_id | RegionOne || service_id | c9aca55493924f2ba9cb5b304cb1322f || service_name | nova || service_type | compute || url | http://192.168.56.11:8774/v2.1/%(tenant_id)s |+--------------+----------------------------------------------+[root@linux-node1 ~]# openstack endpoint create --region RegionOne compute admin http://192.168.56.11:8774/v2.1/%\(tenant_id\)s+--------------+----------------------------------------------+| Field | Value |+--------------+----------------------------------------------+| enabled | True || id | 9162f57b72e244f799086eeca3b7df6c || interface | admin || region | RegionOne || region_id | RegionOne || service_id | c9aca55493924f2ba9cb5b304cb1322f || service_name | nova || service_type | compute || url | http://192.168.56.11:8774/v2.1/%(tenant_id)s |+--------------+----------------------------------------------+[root@linux-node1 ~]# openstack endpoint create --region RegionOne compute internal http://192.168.56.11:8774/v2.1/%\(tenant_id\)s+--------------+----------------------------------------------+| Field | Value |+--------------+----------------------------------------------+| enabled | True || id | 8fb3d0da5ee64ed693b7b4608844d5ff || interface | internal || region | RegionOne || region_id | RegionOne || service_id | c9aca55493924f2ba9cb5b304cb1322f || service_name | nova || service_type | compute || url | http://192.168.56.11:8774/v2.1/%(tenant_id)s |+--------------+----------------------------------------------+
檢查控制節(jié)點(diǎn)是否成功
[root@linux-node1 ~]# openstack host list+---------------------------+-------------+----------+| Host Name | Service | Zone |+---------------------------+-------------+----------+| linux-node1.abcdocker.com | consoleauth | internal || linux-node1.abcdocker.com | conductor | internal || linux-node1.abcdocker.com | scheduler | internal |+---------------------------+-------------+----------+
我們?cè)诩軜?gòu)中想構(gòu)建幾個(gè)虛擬機(jī)就要看計(jì)算節(jié)點(diǎn)的配置,虛擬化工具我們只能使用VMware,因?yàn)閂Mware支持嵌套虛擬化,其他的虛擬化軟件不支持
我們nova計(jì)算節(jié)點(diǎn)IP是192.168.56.12
需要開(kāi)啟虛擬化技術(shù)
因?yàn)樾枰褂胟vm來(lái)創(chuàng)建虛擬機(jī),所以我們需要開(kāi)啟虛擬化。如果是服務(wù)器需要在bios上開(kāi)啟
環(huán)境準(zhǔn)備
[root@linux-node2 ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@linux-node2 ~]# uname -r3.10.0-327.36.2.el7.x86_64
時(shí)間同步
[root@linux-node1 ~]# yum install ntpdate -y[root@linux-node1 ~]# ntpdate time1.aliyun.com[root@linux-node1 ~]# timedatectl set-timezone Asia/Shanghai #設(shè)置時(shí)區(qū)[root@linux-node1 ~]# rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
安裝openstack倉(cāng)庫(kù)
[root@linux-node2 ~]# yum install -y centos-release-openstack-mitaka
安裝openstack客戶端
[root@linux-node1 ~]# yum install -y python-openstackclient
因?yàn)榭刂乒?jié)點(diǎn)的nova和計(jì)算節(jié)點(diǎn)的配置除了沒(méi)有數(shù)據(jù)庫(kù)其他的都是相同的,這里我們采取scp
的形式進(jìn)行修改
安裝openstack SELinux管理包
[root@linux-node2 ~]# yum install -y openstack-selinux
安裝nova
[root@linux-node2 ~]# yum install -y openstack-nova-compute
步驟:
1、從控制節(jié)點(diǎn)scp nova.conf
2、 刪除數(shù)據(jù)庫(kù)的配置
3、 vnc的配置進(jìn)行變更
4、 設(shè)置一個(gè)虛擬化的選項(xiàng)
提示:要注意nova.conf
文件的權(quán)限
時(shí)間必須同步!?。?!
1.將控制節(jié)點(diǎn)的nova.conf
復(fù)制到計(jì)算節(jié)點(diǎn)上
[root@linux-node1 ~]# scp /etc/nova/nova.conf 192.168.56.12:/etc/nova/The authenticity of host '192.168.56.12 (192.168.56.12)' can't be established.ECDSA key fingerprint is 43:50:3c:fa:03:29:7c:3c:5f:aa:d2:76:b5:8e:d9:54.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.56.12' (ECDSA) to the list of known hosts.root@192.168.56.12's password: nova.conf 100% 180KB 180.0KB/s 00:00
2.進(jìn)入計(jì)算節(jié)點(diǎn)進(jìn)行修改
首先保證權(quán)限一致[root@linux-node2 nova]# ll /etc/nova/nova.conf -rw-r----- 1 root nova 184332 Nov 18 17:02 /etc/nova/nova.conf
3.修改配置文件
[root@linux-node2 nova]# vim /etc/nova/nova.conf#connection =#connection =搜索mysql將mysql路徑注釋掉
配置vnc
novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.htmlvncserver_listen=0.0.0.0vncserver_proxyclient_address=192.168.56.125384行enabled=true
提示:服務(wù)器組件監(jiān)聽(tīng)所有的 IP 地址,而代理組件僅僅監(jiān)聽(tīng)計(jì)算節(jié)點(diǎn)管理網(wǎng)絡(luò)接口的 IP 地址。基本的 URL 指示您可以使用 web 瀏覽器訪問(wèn)位于該計(jì)算節(jié)點(diǎn)上實(shí)例的遠(yuǎn)程控制臺(tái)的位置。
選擇虛擬化類型
確定您的計(jì)算節(jié)點(diǎn)是否支持虛擬化
的硬件加速。 egrep -c '(vmx|svm)' /proc/cpuinfo
如果這個(gè)命令返回了1
或不等于0
的值,那么你的計(jì)算節(jié)點(diǎn)支持硬件加速且不需要額外的配置。
如果這個(gè)命令返回了 0
值,那么你的計(jì)算節(jié)點(diǎn)不支持硬件加速。你必須配置 libvirt
來(lái)使用 QEMU
去代替 KVM
KVM文章:http://www.abcdocker.com/abcdocker/1627
在 /etc/nova/nova.conf
文件的 [libvirt]
區(qū)域做出如下的編輯:
[libvirt]…virt_type=kvm#配置虛擬化類型
總結(jié) nova.conf
修改了如下五行
[root@linux-node2 nova]# grep '^[a-z]' /etc/nova/nova.conf…enabled=truevncserver_listen=0.0.0.0vncserver_proxyclient_address=192.168.56.12novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.htmlvirt_type=kvm
設(shè)置開(kāi)機(jī)啟動(dòng)
[root@linux-node2 ~]# systemctl enable libvirtd openstack-nova-compute[root@linux-node2 ~]# systemctl start libvirtd openstack-nova-compute
列出服務(wù)組件,以驗(yàn)證是否成功啟動(dòng)并注冊(cè)了每個(gè)進(jìn)程:
[root@linux-node1 ~]# source admin-openstack.sh [root@linux-node1 ~]# openstack host list+---------------------------+-------------+----------+| Host Name | Service | Zone |+---------------------------+-------------+----------+| linux-node1.abcdocker.com | consoleauth | internal || linux-node1.abcdocker.com | conductor | internal || linux-node1.abcdocker.com | scheduler | internal || linux-node2.abcdocker.com | compute | nova |+---------------------------+-------------+----------+該輸出應(yīng)該顯示三個(gè)服務(wù)組件在控制節(jié)點(diǎn)上啟用,一個(gè)服務(wù)組件在計(jì)算節(jié)點(diǎn)上啟用。
查看nova
和keystone
是否正常
[root@linux-node1 ~]# nova service-list+----+------------------+---------------------------+----------+---------+-------+----------------------------+-----------------+| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |+----+------------------+---------------------------+----------+---------+-------+----------------------------+-----------------+| 1 | nova-consoleauth | linux-node1.abcdocker.com | internal | enabled | up | 2016-11-18T09:24:23.000000 | - || 2 | nova-conductor | linux-node1.abcdocker.com | internal | enabled | up | 2016-11-18T09:24:22.000000 | - || 3 | nova-scheduler | linux-node1.abcdocker.com | internal | enabled | up | 2016-11-18T09:24:23.000000 | - || 6 | nova-compute | linux-node2.abcdocker.com | nova | enabled | up | 2016-11-18T09:24:23.000000 | - |+----+------------------+---------------------------+----------+---------+-------+----------------------------+-----------------+
查看nova和glance服務(wù)相互是否正常
[root@linux-node1 ~]# nova p_w_picpath-list+--------------------------------------+--------+--------+--------+| ID | Name | Status | Server |+--------------------------------------+--------+--------+--------+| fc67361d-ad30-40b2-9d96-941e50fc17f5 | cirros | ACTIVE | |+--------------------------------------+--------+--------+--------+
再次提示:時(shí)間必須同步?。?!
nova
安裝到此截止!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。