OPENSTACK的计算服务——NOVA 的安装与配置

7 OPENSTACK的计算服务——NOVA
【控制节点】
7.1 相关数据库的安装
7.1.1 创建数据库
(1) 创建nova_api数据库
CREATE DATABASE nova_api;
GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova’@‘localhost’ IDENTIFIED BY ‘nova’;
GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova’@’%’ IDENTIFIED BY ‘nova’;
(2)创建nova_cell0数据库
CREATE DATABASE nova_cell0;
GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova’@‘localhost’ IDENTIFIED BY ‘nova’;
GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova’@’%’ IDENTIFIED BY ‘nova’;
7.1.2 创建 compute API service
(1)创建nova service
[root@controller ~]# source admin-openrc.sh
[root@controller ~]# openstack service create --name nova --description “OpenStack Compute” compute

(2)创建nova service endpoint
public url
#openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1

internal url
openstack endpoint create --region RegionOne
compute internal http://controller:8774/v2.1
admin url
openstack endpoint create --region RegionOne
compute admin http://controller:8774/v2.1

7.1.3 创建Create a Placement service user
(1)创建placement user
openstack user create --domain default --password-prompt placement

Password:placement
添加用户角色admin
openstack role add --project service --user placement admin
(2)创建Placement API service
openstack service create --name placement --description “Placement API” placement

(3)创建Placement API service的endpoint
Public url
openstack endpoint create --region RegionOne placement public http://controller:8778

internal url
openstack endpoint create --region RegionOne placement internal http://controller:8778

admin url
openstack endpoint create --region RegionOne placement admin http://controller:8778

7.2 安装和配置组件(Controller node)
7.2.1 安装nova的组件
[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
7.2.2 组件的配置
编辑/etc/nova/nova.conf,完成如下配置
(1)基础配置
[DEFAULT]
2737 enabled_apis = osapi_compute,metadata
(2)mysql的配置
[api_database]
3491 connection = mysql+pymysql://nova:nova@controller/nova_api
[database]
4578 connection = mysql+pymysql://nova:nova@controller/nova
(3)rabbit mq的配置
3132 transport_url=rabbit://openstack:openstack@controller
(4)keystone的配置
[api]
3197 auth_strategy = keystone
[keystone_authtoken]
从6092行开始粘贴
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
(5)neutron配置
【default】
1240 my_ip=192.168.56.11
1709 use_neutron=true
2371 firewall_driver = nova.virt.firewall.NoopFirewallDriver
(6)vnc的配置
[vnc]
10714 enabled=true
10741 keymap=en-us
10938 vncserver_listen = $my_ip
10939 vncserver_proxyclient_address = $my_ip
(7)glance的配置
【glance】
5266 api_servers=http://controller:9292
(8) [oslo_concurrency]
8018 lock_path=/var/lib/nova/tmp
(9)placement组件的配置
[placement]

8824开始粘贴如下代码
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = placement
7.2.3 placement组件bug修复
bug修复
编辑/etc/httpd/conf.d/00-nova-placement-api.conf
添加如下代码:
<Directory /usr/bin>
= 2.4>
Require all granted

<IfVersion < 2.4>
Order allow,deny
Allow from all


7.2.4 同步数据库
(1)重启httpd服务

systemctl restart httpd

(2)同步nova_api数据库

su -s /bin/sh -c “nova-manage api_db sync” nova

#mysql -h 192.168.56.11 -unova -pnova -e"use nova_api;show tables;"

(3)注册cell0数据库
[root@controller ~]# su -s /bin/sh -c “nova-manage cell_v2 map_cell0” nova
(4)创建cell1 cell
[root@controller ~]# su -s /bin/sh -c “nova-manage cell_v2 create_cell --name=cell1 --verbose” nova
返回结果:76f8f580-ee0d-405d-9bcb-9c0b9f5e6986(7728a4f1-1f48-4dfc-a074-d34e0ab2f5d4)
(5)同步nova数据库
su -s /bin/sh -c “nova-manage db sync” nova
mysql -h 192.168.56.11 -unova -pnova -e"use nova;show tables;"
(6)验证novacell0 and cell1注册是否正确
[root@controller ~]# nova-manage cell_v2 list_cells

7.2.5完成安装
[root@controller ~]#systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service

[root@controller ~]#systemctl start openstack-nova-api.service
openstack-nova-consoleauth.service openstack-nova-scheduler.service
openstack-nova-conductor.service openstack-nova-novncproxy.service
7.2.6验证安装
[root@controller ~]# ps aux |grep nova

[root@controller nova]# pwd
/var/log/nova
[root@controller nova]# ll
total 92
-rw-r–r-- 1 nova nova 6498 Oct 15 13:36 nova-api.log
-rw-r–r-- 1 nova nova 1243 Oct 15 13:36 nova-conductor.log
-rw-r–r-- 1 nova nova 824 Oct 15 13:36 nova-consoleauth.log
-rw-r–r-- 1 nova nova 67965 Oct 15 13:28 nova-manage.log
-rw-r–r-- 1 nova nova 899 Oct 15 13:36 nova-novncproxy.log
-rw-r–r-- 1 root root 0 Oct 15 12:23 nova-placement-api.log
-rw-r–r-- 1 nova nova 968 Oct 15 13:36 nova-scheduler.log
【计算节点】
基础环境的安装
yum install -y centos-release-openstack-rocky
yum install -y python-openstackclient
yum install -y openstack-selinux
yum install update -y
7.3 安装和配置组件(compute node)
7.3.1 安装包
yum install openstack-nova-compute -y
7.3.2 配置组件
编辑/etc/nova/nova.conf
(1)基础配置
[DEFAULT]
2737 enabled_apis = osapi_compute,metadata
(2)rabbitMQ
[DEFAULT]
3130 transport_url = rabbit://openstack:openstack@controller
(3)keystone的配置
[api]
3197 auth_strategy = keystone
[keystone_authtoken]
6088粘贴下面代码
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
(4)配置my_ip
1481 my_ip = 192.168.56.21
(5) neutron的配置
[DEFAULT]
1709use_neutron = True
2371 firewall_driver = nova.virt.firewall.NoopFirewallDriver
(6)vnc的配置
[vnc]
10714enabled=true
10741 keymap=en-us
10932 vncserver_listen = 0.0.0.0
10933 vncserver_proxyclient_address = m y i p 10934 n o v n c p r o x y b a s e u r l = h t t p : / / 192.168.56.11 : 6080 / v n c a u t o . h t m l ( 7 ) g l a n c e 的 配 置 【 g l a n c e 】 5262 a p i s e r v e r s = h t t p : / / c o n t r o l l e r : 9292 ( 8 ) [ o s l o c o n c u r r e n c y ] 8014 l o c k p a t h = / v a r / l i b / n o v a / t m p ( 9 ) p l a c e m e n t 的 配 置 [ p l a c e m e n t ] 8826 行 开 始 粘 贴 下 面 的 代 码 o s r e g i o n n a m e = R e g i o n O n e p r o j e c t d o m a i n n a m e = D e f a u l t p r o j e c t n a m e = s e r v i c e a u t h t y p e = p a s s w o r d u s e r d o m a i n n a m e = D e f a u l t a u t h u r l = h t t p : / / c o n t r o l l e r : 35357 / v 3 u s e r n a m e = p l a c e m e n t p a s s w o r d = p l a c e m e n t ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 本 节 配 置 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ m y i p = 192.168.56.21 u s e n e u t r o n = t r u e f i r e w a l l d r i v e r = n o v a . v i r t . f i r e w a l l . N o o p F i r e w a l l D r i v e r e n a b l e d a p i s = o s a p i c o m p u t e , m e t a d a t a t r a n s p o r t u r l = r a b b i t : / / o p e n s t a c k : o p e n s t a c k @ c o n t r o l l e r a u t h s t r a t e g y = k e y s t o n e a p i s e r v e r s = h t t p : / / c o n t r o l l e r : 9292 a u t h u r i = h t t p : / / c o n t r o l l e r : 5000 a u t h u r l = h t t p : / / c o n t r o l l e r : 35357 m e m c a c h e d s e r v e r s = c o n t r o l l e r : 11211 a u t h t y p e = p a s s w o r d p r o j e c t d o m a i n n a m e = d e f a u l t u s e r d o m a i n n a m e = d e f a u l t p r o j e c t n a m e = s e r v i c e u s e r n a m e = n o v a p a s s w o r d = n o v a l o c k p a t h = / v a r / l i b / n o v a / t m p o s r e g i o n n a m e = R e g i o n O n e p r o j e c t d o m a i n n a m e = D e f a u l t p r o j e c t n a m e = s e r v i c e a u t h t y p e = p a s s w o r d u s e r d o m a i n n a m e = D e f a u l t a u t h u r l = h t t p : / / c o n t r o l l e r : 35357 / v 3 u s e r n a m e = p l a c e m e n t p a s s w o r d = p l a c e m e n t e n a b l e d = t r u e k e y m a p = e n − u s v n c s e r v e r l i s t e n = 0.0.0.0 v n c s e r v e r p r o x y c l i e n t a d d r e s s = my_ip 10934 novncproxy_base_url = http://192.168.56.11:6080/vnc_auto.html (7)glance的配置 【glance】 5262 api_servers=http://controller:9292 (8) [oslo_concurrency] 8014 lock_path=/var/lib/nova/tmp (9)placement的配置 [placement] 8826行开始粘贴下面的代码 os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:35357/v3 username = placement password = placement ***************************本节配置****************************** my_ip=192.168.56.21 use_neutron=true firewall_driver = nova.virt.firewall.NoopFirewallDriver enabled_apis=osapi_compute,metadata transport_url=rabbit://openstack:openstack@controller auth_strategy=keystone api_servers=http://controller:9292 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 lock_path=/var/lib/nova/tmp os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:35357/v3 username = placement password = placement enabled=true keymap=en-us vncserver_listen=0.0.0.0 vncserver_proxyclient_address= myip10934novncproxybaseurl=http://192.168.56.11:6080/vncauto.html7glanceglance5262apiservers=http://controller:9292(8)[osloconcurrency]8014lockpath=/var/lib/nova/tmp(9)placement[placement]8826osregionname=RegionOneprojectdomainname=Defaultprojectname=serviceauthtype=passworduserdomainname=Defaultauthurl=http://controller:35357/v3username=placementpassword=placementmyip=192.168.56.21useneutron=truefirewalldriver=nova.virt.firewall.NoopFirewallDriverenabledapis=osapicompute,metadatatransporturl=rabbit://openstack:openstack@controllerauthstrategy=keystoneapiservers=http://controller:9292authuri=http://controller:5000authurl=http://controller:35357memcachedservers=controller:11211authtype=passwordprojectdomainname=defaultuserdomainname=defaultprojectname=serviceusername=novapassword=novalockpath=/var/lib/nova/tmposregionname=RegionOneprojectdomainname=Defaultprojectname=serviceauthtype=passworduserdomainname=Defaultauthurl=http://controller:35357/v3username=placementpassword=placementenabled=truekeymap=enusvncserverlisten=0.0.0.0vncserverproxyclientaddress=my_ip
novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.html
END****
7.3.3 完成安装
(1) 确认你的机器是否支持CPU的虚拟加速
[root@compute1 nova]# egrep -c ‘(vmx|svm)’ /proc/cpuinfo
4
If this command returns a value of one or greater, your compute node supports hardware acceleration which typically requires no additional configuration.
If this command returns a value of zero, your compute node does not support hardware acceleration and you must configure libvirt to use QEMU instead of KVM.
Edit the [libvirt] section in the /etc/nova/nova.conf file as follows:
[libvirt]

virt_type = qemu
(2) 启动计算节点的nova服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
ps aux |grep nova

7.3.4 验证安装
[root@controller ~]# source admin-openrc.sh
[root@controller ~]# openstack compute service list

7.4 Add the compute node to the cell database

(1)Source the admin credentials to enable admin-only CLI commands, then confirm there are compute hosts in the database:

[root@controller ~]# openstack hypervisor list
(2)Discover compute hosts:
[root@controller ~]# su -s /bin/sh -c “nova-manage cell_v2 discover_hosts --verbose” nova
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting compute nodes from cell ‘cell1’: 76f8f580-ee0d-405d-9bcb-9c0b9f5e6986
Found 1 computes in cell: 76f8f580-ee0d-405d-9bcb-9c0b9f5e6986
Checking host mapping for compute host ‘compute1’: 56967041-ff65-4dda-a39f-2421f0b0b078
Creating host mapping for compute host ‘compute1’: 56967041-ff65-4dda-a39f-2421f0b0b078

NOVA正确安装完成!~

注意,要是添加其他的计算节点,参考下面的note

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值