6,控制节点安装Nova计算服务

文章目录

  • 6.1 创建nova数据库
  • 6.2 Keystone注册nova
    • 6.2.1 Keystone创建nova用户
    • 6.2.2 Keystone中将nova用户添加为admin权限并且添加进test项目
    • 6.2.3 创建nova计算服务
    • 6.2.4 创建nova的API服务(endpoint)
    • 6.2.5 增加了placement项目
    • 6.2.6 增加placement的API服务(endpoint)
  • 6.3 安装配置nova
    • 6.3.1 安装nova
    • 6.3.2 配置nova
    • 6.3.3 修改nova的虚拟主机配置文件
    • 6.3.4 重新启动apache
  • 6.4 同步nova数据库
    • 6.4.1 初始化nova-api与placement数据库
    • 6.4.2 查看同步后数据库
    • 6.4.3 初始化nova_cell0和nova数据库
      • 6.4.3.1 注册cell0数据库
      • 6.4.3.2 创建cell1单元
      • 6.4.3.3 初始化nova数据库
      • 6.4.3.4 检查确认cell0和cell1注册成功
      • 6.4.3.5 查看同步后数据库
      • 6.4.3.6 检查确认cell0和cell1注册成功
  • 6.5 启动并且配置自启动

6.1 创建nova数据库

mysql -u root -pabc-123
---
create database nova_api;
crate database nova;
create database nova_cell0;
create database placement;

grant all privileges on nova_api.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova_api.* to 'nova'@'%' identified by 'nova';

grant all privileges on nova.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova.* to 'nova'@'%' identified by 'nova';

grant all privileges on nova_cell0.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova_cell0.* to 'nova'@'%' identified by 'nova';

grant all privileges on placement.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on placement.* to 'nova'@'%' identified by 'nova';
flush privileges;
exit

6.2 Keystone注册nova

6.2.1 Keystone创建nova用户

openstack user create --domain default --password=nova nova

6.2.2 Keystone中将nova用户添加为admin权限并且添加进test项目

openstack role add --project test --user nova admin

6.2.3 创建nova计算服务

openstack service create --name nova --description "OpenStack Compute" compute
openstack service list

6.2.4 创建nova的API服务(endpoint)

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

6.2.5 增加了placement项目

openstack user create --domain default --password=placement placement
openstack role add --project test --user placement admin
openstack service create --name placement --description "Placement API" placement

6.2.6 增加placement的API服务(endpoint)

主要追踪每个提供者的库存和使用量情况,比如追踪计算节点的资源,存储池的使用情况以及IP的分配情况等等。

openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
openstack endpoint list

6.3 安装配置nova

6.3.1 安装nova

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

6.3.2 配置nova


openstack-config --set  /etc/nova/nova.conf DEFAULT enabled_apis  osapi_compute,metadata
openstack-config --set  /etc/nova/nova.conf DEFAULT my_ip 192.168.204.10
openstack-config --set  /etc/nova/nova.conf DEFAULT use_neutron  true 
openstack-config --set  /etc/nova/nova.conf DEFAULT firewall_driver  nova.virt.firewall.NoopFirewallDriver
openstack-config --set  /etc/nova/nova.conf DEFAULT transport_url  rabbit://openstack:openstack@controller
openstack-config --set  /etc/nova/nova.conf api_database connection  mysql+pymysql://nova:nova@controller/nova_api
openstack-config --set  /etc/nova/nova.conf database connection  mysql+pymysql://nova:nova@controller/nova
openstack-config --set  /etc/nova/nova.conf placement_database connection  mysql+pymysql://placement:placement@controller/placement
openstack-config --set  /etc/nova/nova.conf api auth_strategy  keystone 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken auth_url  http://controller:5000/v3
openstack-config --set  /etc/nova/nova.conf keystone_authtoken memcached_servers  controller:11211
openstack-config --set  /etc/nova/nova.conf keystone_authtoken auth_type  password
openstack-config --set  /etc/nova/nova.conf keystone_authtoken project_domain_name  default 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken user_domain_name  default
openstack-config --set  /etc/nova/nova.conf keystone_authtoken project_name  test 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken username  nova 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken password  nova
openstack-config --set  /etc/nova/nova.conf vnc enabled true
openstack-config --set  /etc/nova/nova.conf vnc server_listen '$my_ip'
openstack-config --set  /etc/nova/nova.conf vnc server_proxyclient_address '$my_ip'
openstack-config --set  /etc/nova/nova.conf glance api_servers  http://controller:9292
openstack-config --set  /etc/nova/nova.conf oslo_concurrency lock_path  /var/lib/nova/tmp 
openstack-config --set  /etc/nova/nova.conf placement region_name RegionOne
openstack-config --set  /etc/nova/nova.conf placement project_domain_name Default
openstack-config --set  /etc/nova/nova.conf placement project_name test
openstack-config --set  /etc/nova/nova.conf placement auth_type password
openstack-config --set  /etc/nova/nova.conf placement user_domain_name Default
openstack-config --set  /etc/nova/nova.conf placement auth_url http://controller:5000/v3
openstack-config --set  /etc/nova/nova.conf placement username placement
openstack-config --set  /etc/nova/nova.conf placement password placement
openstack-config --set  /etc/nova/nova.conf scheduler discover_hosts_in_cells_interval 300

6.3.3 修改nova的虚拟主机配置文件

vim /etc/httpd/conf.d/00-nova-placement-api.conf
---
Listen 8778


  WSGIProcessGroup nova-placement-api
  WSGIApplicationGroup %{GLOBAL}
  WSGIPassAuthorization On
  WSGIDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
  WSGIScriptAlias / /usr/bin/nova-placement-api
  = 2.4>
    ErrorLogFormat "%M"
  
  ErrorLog /var/log/nova/nova-placement-api.log
  #SSLEngine On
  #SSLCertificateFile ...
  #SSLCertificateKeyFile ...


Alias /nova-placement-api /usr/bin/nova-placement-api

  SetHandler wsgi-script
  Options +ExecCGI
  WSGIProcessGroup nova-placement-api
  WSGIApplicationGroup %{GLOBAL}
  WSGIPassAuthorization On


# made by zhaoshuai

   = 2.4>
      Require all granted
   
   
      Order allow,deny
      Allow from all
   

6.3.4 重新启动apache

systemctl restart httpd
systemctl status httpd 

6.4 同步nova数据库

6.4.1 初始化nova-api与placement数据库

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

6.4.2 查看同步后数据库

mysql -h127.0.0.1 -unova -pnova -e "use nova_api;show tables;"
mysql -h127.0.0.1 -uplacement -pplacement -e "use placement;show tables;"

6.4.3 初始化nova_cell0和nova数据库

6.4.3.1 注册cell0数据库

su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

6.4.3.2 创建cell1单元

su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

6.4.3.3 初始化nova数据库

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

6.4.3.4 检查确认cell0和cell1注册成功

su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

6.4.3.5 查看同步后数据库

mysql -h127.0.0.1 -unova -pnova -e "use nova_cell0;show tables;"
mysql -h127.0.0.1 -unova -pnova -e "use nova;show tables;"

6.4.3.6 检查确认cell0和cell1注册成功

[root@controller downloads]# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+----------+
|  Name |                 UUID                 |           Transport URL            |               Database Connection               | Disabled |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |               none:/               | mysql+pymysql://nova:****@controller/nova_cell0 |  False   |
| cell1 | 1b4aa895-87f3-4303-891a-580ba5bc31fd | rabbit://openstack:****@controller |    mysql+pymysql://nova:****@controller/nova    |  False   |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+----------+

6.5 启动并且配置自启动

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

你可能感兴趣的:(Openstack)