• CentOS7安装OpenStack-04.安装Nova计算服务


    nova相关端口:

    api:8774
    metadata:8775
    novncproxy:6080

    4.1.在控制节点安装nova计算服务 

    1)创建nova相关数据库

    # 登录数据库
    mysql -u root -p
    
    # 创建用户并授权
    CREATE DATABASE nova_api;
    CREATE 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 'placement'@'localhost' IDENTIFIED BY 'placement';
    GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'placement';
    
    # 刷新权限
    flush privileges;

    4.2.在keystone上面注册nova服务

    1)在keystone上创建nova用户

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

    2)在keystone上将nova用户配置为admin角色并添加进service项目

    # 以下命令无输出

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

    3)创建nova计算服务的实体

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

    4)创建计算服务的API端点(endpoint)

    # 计算服务compute

    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

    5)这个版本的nova增加了placement项目

    # 同样,创建并注册该项目的服务证书

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

    # 创建placement项目的endpoint(API端口)

    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

    4.3.在控制节点安装nova相关服务 

    1)安装nova相关软件包

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

    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.182.143
    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  service 
    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 vncserver_listen 192.168.182.143
    openstack-config --set  /etc/nova/nova.conf vnc vncserver_proxyclient_address 192.168.182.143
    openstack-config --set  /etc/nova/nova.conf vnc vnc_enabled True
    openstack-config --set  /etc/nova/nova.conf vnc novncproxy_host 0.0.0.0
    openstack-config --set  /etc/nova/nova.conf vnc novncproxy_port 6080
    openstack-config --set  /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.182.143:6080/vnc_auto.html
    
    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 service
    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

    # 默认情况下,计算服务使用内置的防火墙服务。由于网络服务包含了防火墙服务,必须使用``nova.virt.firewall.NoopFirewallDriver``防火墙服务来禁用掉计算服务内置的防火墙服务

    # 检查生效的nova配置

    egrep -v "^#|^$" /etc/nova/nova.conf

    3)修改nova的虚拟主机配置文件(vim /etc/httpd/conf.d/00-nova-placement-api.conf)

    Listen 8778
    
    <VirtualHost *: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
      <IfVersion >= 2.4>
        ErrorLogFormat "%M"
      </IfVersion>
      ErrorLog /var/log/nova/nova-placement-api.log
      #SSLEngine On
      #SSLCertificateFile ...
      #SSLCertificateKeyFile ...
    </VirtualHost>
    
    Alias /nova-placement-api /usr/bin/nova-placement-api
    <Location /nova-placement-api>
      SetHandler wsgi-script
      Options +ExecCGI
      WSGIProcessGroup nova-placement-api
      WSGIApplicationGroup %{GLOBAL}
      WSGIPassAuthorization On
    </Location>
    
    <Directory /usr/bin>
       <IfVersion >= 2.4>
          Require all granted
       </IfVersion>
       <IfVersion < 2.4>
          Order allow,deny
          Allow from all
       </IfVersion>
    </Directory>

    # 修改完毕重启httpd服务

    systemctl restart httpd
    systemctl status httpd 

    # 至此,nova计算服务的软件包安装完成

    4.4.同步nova数据(注意同步顺序)

    1)初始化nova-api和placement数据库

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

    # 验证数据库

    mysql -h192.168.182.143 -unova -pnova -e "use nova_api;show tables;"
    mysql -h192.168.182.143 -uplacement -pplacement -e "use placement;show tables;"

    2)初始化nova_cell0和nova数据库

    # 注册cell0数据库

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

    # 创建cell1单元

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

    # 初始化nova数据库

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

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

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

    # 验证数据库

    mysql -h192.168.182.143 -unova -pnova -e "use nova_cell0;show tables;"
    mysql -h192.168.182.143 -unova -pnova -e "use nova;show tables;"

    5)检查确认cell0和cell1注册成功

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

    # 返回的数据存储在nova_api数据库的cell_mappings表中

    4.5.启动nova服务

    1)启动nova服务并设置为开机自启动

    
    
    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

    systemctl list-unit-files |grep openstack-nova* |grep enabled

    ~~~至此,在控制节点安装nova计算服务就完成了~~~

  • 相关阅读:
    数组删除元素注意事项
    点击下拉菜单以外的区域,关闭弹窗
    webpack学习笔记(六)优化
    webpack学习笔记(五)
    webpack学习笔记(四)
    webpack学习笔记(三)
    webpack学习笔记(二)
    es6 笔记
    vue学习笔记——组件的优化
    vue学习笔记——路由
  • 原文地址:https://www.cnblogs.com/liugp/p/12462854.html
Copyright © 2020-2023  润新知