zoukankan      html  css  js  c++  java
  • openstack setup demo Compute service

    本文包含以下部分

    • Compute service overview
    • Install and configure controller node
    • Prerequisites
    • Install and configure components
    • Finalize installation
    • Install and configure a compute node
    • Install and configure components
    • Finalize installation
    • Verify operation

    Compute service overview

    Compute service在openstack中的作用比较复杂,大致模块和功能如下:

    nova-api service
    接受并响应用户的请求

    nova-api-metadata service
    处理metadata请求

    nova-compute service
    是一个worker daemon。会调用hypervisor api来创建删除vm等。

    nova-scheduler service
    接受vm的请求,并分发给compute service

    nova-conductor module
    目前的作用是compute service和database的一个中间层,不要把它和compute service部署在同一个机器上。

    nova-network worker daemon
    跟nova-compute service差不多,从queue中接受task并执行。比如配置bridge和iptable。

    nova-consoleauth daemon
    Authorizes tokens for users that console proxies provide.

    nova-novncproxy daemon
    Provides a proxy for accessing running instances through a VNC connection. Supports browser-based novnc clients.

    nova-novncproxy daemon
    Provides a proxy for accessing running instances through a SPICE connection. Supports browser-based HTML5 client.

    nova-xvpvncproxy daemon
    Provides a proxy for accessing running instances through a VNC connection. Supports an OpenStack-specific Java client.

    Install and configure controller node

    prerequisite

    创建db

    mysql -u root -p
    
    CREATE DATABASE nova_api;
    CREATE DATABASE nova;
    
    GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' 
      IDENTIFIED BY 'NOVA_DBPASS';
    GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' 
      IDENTIFIED BY 'NOVA_DBPASS';
    
    GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' 
      IDENTIFIED BY 'NOVA_DBPASS';
    GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' 
      IDENTIFIED BY 'NOVA_DBPASS';
    

    设置keystone

    . admin-openrc
    
    # 创建用户
    openstack user create --domain default --password-prompt nova
    # 在service project中为nova用户添加admin
    openstack role add --project service --user nova admin
    # 创建compute service
    openstack service create --name nova --description "OpenStack Compute" compute
    # 创建end points
    openstack endpoint create --region RegionOne compute public http://controller01:8774/v2.1/%(tenant_id)s
    openstack endpoint create --region RegionOne compute internal http://controller01:8774/v2.1/%(tenant_id)s
    openstack endpoint create --region RegionOne compute admin http://controller01:8774/v2.1/%(tenant_id)s
    

    Install and configure components

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

    编辑 /etc/nova/nova.conf

    [DEFAULT]
    ...
    enabled_apis = osapi_compute,metadata
    rpc_backend = rabbit
    auth_strategy = keystone
    my_ip = 10.79.148.84
    use_neutron = True
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    
    [api_database]
    ...
    connection = mysql+pymysql://nova:NOVA_DBPASS@controller01/nova_api
    
    [database]
    ...
    connection = mysql+pymysql://nova:NOVA_DBPASS@controller01/nova
    
    [oslo_messaging_rabbit]
    ...
    rabbit_host = controller01
    rabbit_userid = openstack
    rabbit_password = RABBIT_PASS
    
    [keystone_authtoken]
    ...
    auth_uri = http://controller01:5000
    auth_url = http://controller01:35357
    memcached_servers = controller01:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = nova
    password = nova
    
    [vnc]
    ...
    vncserver_listen = $my_ip
    vncserver_proxyclient_address = $my_ip
    
    [glance]
    ...
    api_servers = http://controller01:9292
    
    [oslo_concurrency]
    ...
    lock_path = /var/lib/nova/tmp
    

    初始化compute database

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

    Finalize installation

    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
    

    Install and configure a compute node

    Install and configure components

    yum install openstack-nova-compute
    

    编辑 /etc/nova/nova.conf

    [DEFAULT]
    ...
    rpc_backend = rabbit
    auth_strategy = keystone
    my_ip = 10.79.148.86
    use_neutron = True
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    
    [oslo_messaging_rabbit]
    ...
    rabbit_host = controller01
    rabbit_userid = openstack
    rabbit_password = RABBIT_PASS
    
    [keystone_authtoken]
    ...
    auth_uri = http://controller01:5000
    auth_url = http://controller01:35357
    memcached_servers = controller01:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = nova
    password = nova
    
    [vnc]
    ...
    enabled = True
    vncserver_listen = 0.0.0.0
    vncserver_proxyclient_address = $my_ip
    novncproxy_base_url = http://controller01:6080/vnc_auto.html
    
    [glance]
    ...
    api_servers = http://controller01:9292
    
    [oslo_concurrency]
    ...
    lock_path = /var/lib/nova/tmp
    

    Finalize installation

    判断一下我们的硬件是否支持 hardware acceleration for virtual machines

    egrep -c '(vmx|svm)' /proc/cpuinfo
    

    如果返回0,说明不支持,则需要配置 libvirt 使用qeum 而不是kvm。
    编辑 /etc/nova/nova.conf

    [libvirt]
    ...
    virt_type = qemu
    

    启动libvirt 和 nova compute 并设置开机启动

    systemctl enable libvirtd.service openstack-nova-compute.service
    systemctl start libvirtd.service openstack-nova-compute.service
    

    Verify operation

    . admin.openrc
    
    openstack compute service list
    

    改名了应该能看到类似如下输出

    +----+--------------------+------------+----------+---------+-------+----------------------------+
    | Id | Binary             | Host       | Zone     | Status  | State | Updated At                 |
    +----+--------------------+------------+----------+---------+-------+----------------------------+
    |  1 | nova-consoleauth   | controller | internal | enabled | up    | 2016-02-09T23:11:15.000000 |
    |  2 | nova-scheduler     | controller | internal | enabled | up    | 2016-02-09T23:11:15.000000 |
    |  3 | nova-conductor     | controller | internal | enabled | up    | 2016-02-09T23:11:16.000000 |
    |  4 | nova-compute       | compute1   | nova     | enabled | up    | 2016-02-09T23:11:20.000000 |
    +----+--------------------+------------+----------+---------+-------+----------------------------+
  • 相关阅读:
    DevExpress的GridControl的实时加载数据解决方案(取代分页)
    WinForm程序虚拟分页(实时加载数据)
    C#使用反射特性构建访问者模式
    WinApi学习笔记内存的复制,填充,输出等操作
    PL/SQL学习笔记程序包
    WinApi学习笔记创建进程
    PL/SQL学习笔记触发器
    WinApi学习笔记获取光驱中的信息
    WinApi学习笔记读写文件
    不通过配置文件启动WCF服务
  • 原文地址:https://www.cnblogs.com/kramer/p/5548637.html
Copyright © 2011-2022 走看看