Nova是openstack最先的兩塊模塊之一,另外一個是對象存儲swift。在openstack體系中一個叫作計算節點,一個叫作控制節點。這個主要和nova相關,咱們把安裝爲計算節點nova-compute,把除了nova-compute叫作控制節點。nova-compute是建立虛擬機的,只是建立虛擬機,全部的控制都在另外一臺上。node
nova組件(服務)mysql
提示:EC2是亞馬遜彈性計算雲linux
Nova scheduler模塊在openstack中的做用就是決策虛擬機建立在那個主機(計算節點)上。sql
決策一個虛擬機應該調度到那個物理節點,須要分兩個步驟:數據庫
Q:實際操做中可能會出現找不到有效的主機?其實是有資源的,爲何?
swift
由於在openstack中nova scheduler認爲沒有資源建立虛擬機,即便你有100G內存,若是nova scheduler認爲你沒有資格,就沒法進行建立虛擬機。這個時候多是某一個節點故障,如網絡或者其它。vim
Q:若是決策虛擬機建立在那個主機?api
一、Filter Scheduler首先獲得未通過濾的主機列表,而後根據過濾屬性,選擇符合條件的計算節點主機。bash
二、計算權重,通過主機過濾後,須要對主機進行權值的計算,根據策略選擇相應的某一臺主機(對於每個要建立的虛擬機而言)。網絡
一、安裝軟件包
yum install -y openstack-nova-api openstack-nova-conductor \ openstack-nova-console openstack-nova-novncproxy \ openstack-nova-scheduler
二、數據庫配置
[root@linux-node1 ~]# vim /etc/nova/nova.conf [database] connection=mysql+pymysql://nova:nova@192.168.137.11/nova [api_database] connection=mysql+pymysql://nova:nova@192.168.137.11/nova_api
su -s /bin/sh -c "nova-manage api_db sync" nova su -s /bin/sh -c "nova-manage db sync" nova
提示:有警告能夠忽略
mysql -h 192.168.137.11 -unova -pnova -e "use nova;show tables;" mysql -h 192.168.137.11 -unova -pnova -e "use nova_api;show tables;"
三、配置keystone
[root@linux-node1 ~]# vim /etc/nova/nova.conf [keystone_authtoken] auth_uri = http://192.168.137.11:5000 auth_url = http://192.168.137.11:35357 memcached_servers = 192.168.137.11:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = nova [DEFAULT] auth_strategy=keystone
四、RabbitMq(消息隊列配置)
[root@linux-node1 ~]# vim /etc/nova/nova.conf rpc_backend=rabbit rabbit_host=192.168.137.11 rabbit_port=5672 rabbit_userid=openstack rabbit_password=openstack
五、配置nova本身的一些功能
[DEFAULT] enabled_apis=osapi_compute,metadata
[DEFAULT] use_neutron=true firewall_driver=nova.virt.firewall.NoopFirewallDriver
[vnc] vncserver_listen=192.168.137.11 vncserver_proxyclient_address=192.168.137.11
[glance] api_servers=http://192.168.137.11:9292
[oslo_concurrency] lock_path = /var/lib/nova/tmp
六、設置開機啓動,並啓動服務
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
七、keystone上註冊nova服務
source /root/admin-openstack.sh openstack service create --name nova --description "Openstack Compute " compute
openstack endpoint create --region RegionOne \ compute public http://192.168.137.11:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \ compute internal http://192.168.137.11:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \ compute admin http://192.168.137.11:8774/v2.1/%\(tenant_id\)s
八、檢查控制節點是否成功
openstack host list