• CentOS7安装OpenStack(Rocky版)-05.安装一个nova计算节点实例


    上一篇文章分享了控制节点的nova计算服务的安装方法,在实际生产环境中,计算节点通常会安装一些单独的节点提供服务,本文分享单独的nova计算节点的安装方法

    ----------------  完美的分割线 -----------------

    # 参考文章:

    https://docs.openstack.org/install-guide/environment.html

    https://docs.openstack.org/nova/rocky/install/compute-install-rdo.html

    计算节点的配置方法与控制节点基本相同,只是在时间同步上需要连接控制节点,保证openstack集群内的服务器时间一致,否则会出现问题,需要注意

    5.1.配置域名解析

    1)配置主机名

    # 主机名设置好就不能修改,否则会出问题,控制节点和计算节点配置相同,且都需要配置

    hostname openstack02.zuiyoujie.com
    hostname
    echo "openstack02.zuiyoujie.com"> /etc/hostname
    cat /etc/hostname

    2)配置主机名解析

    vim /etc/hosts
    -----------------------------------
    192.168.1.81    openstack01.zuiyoujie.com  controller
    192.168.1.82    openstack02.zuiyoujie.com  compute02 block02 object02
    -----------------------------------

    # 依然是将简单的集群内角色名解析也配置上去

    5.2.关闭防火墙和selinux

    1)关闭iptables

    # 在CentOS7上面是firewalld

    systemctl stop firewalld.service
    systemctl disable firewalld.service
    systemctl status firewalld.service

    2)关闭 selinux

    setenforce 0
    getenforce
    sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
    grep SELINUX=disabled /etc/sysconfig/selinux

    5.3.配置时间同步

    1)在在计算节点配置时间同步服务

    # 安装时间同步的软件包

    yum install chrony -y

    2)编辑配置文件确认有以下配置

    vim /etc/chrony.conf
    -------------------------------------
    # 修改引用控制节点openstack01的IP
    server 192.168.1.81 iburst
    -------------------------------------

    3)重启chronyd服务,并配置开机自启动

    systemctl restart chronyd.service
    systemctl status chronyd.service
    systemctl enable chronyd.service
    systemctl list-unit-files |grep chronyd.service

    4)设置时区,首次同步时间

    timedatectl set-timezone Asia/Shanghai
    chronyc sources
    timedatectl status

    # 至此,时间同步配置完成

    5.4.配置相关yum源 

    1)配置阿里云的base和epel源

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    
    mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

    2)安装openstack-rocky的仓库

    # 很显然,计算节点也需要安装openstack的yum源

    yum install centos-release-openstack-rocky -y
    yum clean all
    yum makecache

    # 也可以手动创建OpenStack的阿里云yum源地址

    vim /etc/yum.repos.d/CentOS-OpenStack-Rocky.repo
    ----------------------------------------
    [centos-openstack-rocky]
    name=CentOS-7 - OpenStack rocky
    baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/
    gpgcheck=1
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
    
    [centos-openstack-rocky-test]
    name=CentOS-7 - OpenStack rocky Testing
    baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/
    gpgcheck=0
    enabled=0
    
    [centos-openstack-rocky-debuginfo]
    name=CentOS-7 - OpenStack rocky - Debug
    baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
    
    [centos-openstack-rocky-source]
    name=CentOS-7 - OpenStack rocky - Source
    baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
    
    [rdo-trunk-rocky-tested]
    name=OpenStack rocky Trunk Tested
    baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/rdo-trunk-rocky-tested/
    gpgcheck=0
    enabled=0
    ----------------------------------------

    3)更新软件包

    yum update -y

    4)安装openstack客户端相关软件

    yum install python-openstackclient openstack-selinux -y

    # 至此,openstack计算节点的系统环境配置完成,虚拟机的话可以关机做下快照

    5.5.安装nova计算节点相关软件包

    1)计算节点安装nova软件包

    cd /server/tools
    yum install openstack-nova-compute python-openstackclient openstack-utils -y

    2)快速修改配置文件(/etc/nova/nova.conf)

    openstack-config --set  /etc/nova/nova.conf DEFAULT my_ip 192.168.1.82
    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 enabled_apis  osapi_compute,metadata
    openstack-config --set  /etc/nova/nova.conf DEFAULT transport_url  rabbit://openstack:openstack@controller
    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 enabled True
    openstack-config --set  /etc/nova/nova.conf vnc server_listen 0.0.0.0
    openstack-config --set  /etc/nova/nova.conf vnc server_proxyclient_address  '$my_ip'
    openstack-config --set  /etc/nova/nova.conf vnc novncproxy_base_url  http://controller: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

    # 服务器组件监听所有的 IP 地址,而代理组件仅仅监听计算节点管理网络接口的 IP 地址。

    # 查看生效的配置:

    egrep -v "^#|^$" /etc/nova/nova.conf
    -------------------------------------------------------------
    [root@openstack02 nova]# egrep -v "^#|^$" /etc/nova/nova.conf
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    transport_url = rabbit://openstack:openstack@controller
    my_ip = 192.168.1.82
    use_neutron = True
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    log_date_format=%Y-%m-%d %H:%M:%S
    log_file=nova-compute.log
    log_dir=/var/log/nova
    [api]
    auth_strategy = keystone
    [api_database]
    [barbican]
    [cache]
    [cells]
    [cinder]
    [compute]
    [conductor]
    [console]
    [consoleauth]
    [cors]
    [database]
    [devices]
    [ephemeral_storage_encryption]
    [filter_scheduler]
    [glance]
    api_servers = http://controller:9292
    [guestfs]
    [healthcheck]
    [hyperv]
    [ironic]
    [key_manager]
    [keystone]
    [keystone_authtoken]
    auth_url = http://controller:5000/v3
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = nova
    password = nova
    [libvirt]
    virt_type = qemu
    [matchmaker_redis]
    [metrics]
    [mks]
    [neutron]
    [notifications]
    [osapi_v21]
    [oslo_concurrency]
    lock_path = /var/lib/nova/tmp
    [oslo_messaging_amqp]
    [oslo_messaging_kafka]
    [oslo_messaging_notifications]
    [oslo_messaging_rabbit]
    [oslo_messaging_zmq]
    [oslo_middleware]
    [oslo_policy]
    [pci]
    [placement]
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://controller:5000/v3
    username = placement
    password = placement
    [placement_database]
    [powervm]
    [profiler]
    [quota]
    [rdp]
    [remote_debug]
    [scheduler]
    [serial_console]
    [service_user]
    [spice]
    [upgrade_levels]
    [vault]
    [vendordata_dynamic_auth]
    [vmware]
    [vnc]
    enabled = True
    server_listen = 0.0.0.0
    server_proxyclient_address = 192.168.1.82
    novncproxy_base_url = http://controller:6080/vnc_auto.html
    [workarounds]
    [wsgi]
    [xenserver]
    [xvp]
    [zvm]
    -------------------------------------------------------------

    # ok

    3)配置虚拟机的硬件加速

    # 首先确定您的计算节点是否支持虚拟机的硬件加速。

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

    # 如果返回位0,表示计算节点不支持硬件加速,需要配置libvirt使用QEMU方式管理虚拟机,使用以下命令:

    openstack-config --set  /etc/nova/nova.conf libvirt virt_type  qemu
    egrep -v "^#|^$" /etc/nova/nova.conf|grep 'virt_type'

    # 如果返回为其他值,表示计算节点支持硬件加速且不需要额外的配置,使用以下命令:

    openstack-config --set  /etc/nova/nova.conf libvirt virt_type  kvm 
    egrep -v "^#|^$" /etc/nova/nova.conf|grep 'virt_type'

    4)启动nova相关服务,并配置为开机自启动

    # 需要启动2个服务

    systemctl start libvirtd.service openstack-nova-compute.service 
    systemctl status libvirtd.service openstack-nova-compute.service
    systemctl enable libvirtd.service openstack-nova-compute.service
    systemctl list-unit-files |grep libvirtd.service
    systemctl list-unit-files |grep openstack-nova-compute.service

    5)将计算节点增加到cell数据库

    # 以下命令在控制节点操作:

    cd /server/tools
    source keystone-admin-pass.sh 

    # 检查确认数据库有新的计算节点

    openstack compute service list --service nova-compute

    # 实例演示:

    [root@openstack01 tools]# openstack compute service list --service nova-compute
    openstack compute service list
    +----+--------------+---------------------------+------+---------+-------+----------------------------+
    | ID | Binary       | Host                      | Zone | Status  | State | Updated At                 |
    +----+--------------+---------------------------+------+---------+-------+----------------------------+
    |  6 | nova-compute | openstack02.zuiyoujie.com | nova | enabled | up    | 2018-10-29T12:02:40.000000 |
    +----+--------------+---------------------------+------+---------+-------+----------------------------+

    # 手动将新的计算节点添加到openstack集群

    su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

    # 实例演示:

    [root@openstack01 tools]# 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 computes from cell 'cell1': c078477e-cb43-40c9-ad8b-a9fde183747d
    Found 0 unmapped computes in cell: c078477e-cb43-40c9-ad8b-a9fde183747d

    # 设置新创建节点自动注册的任务(已经添加到配置文件中)

    [scheduler]
    discover_hosts_in_cells_interval = 300

    # 至此,计算节点安装完毕,接下来需要进行测试,检查nova节点的状态

    5.6.在控制节点进行验证

    # 参考文章:https://docs.openstack.org/nova/rocky/install/compute-install-rdo.html

    1)应用管理员环境变量脚本

    cd /server/tools
    source keystone-admin-pass.sh 

    2)列表查看安装的nova服务组件

    # 验证是否成功注册并启动了每个进程

    openstack compute service list

    # 实例演示:

    [root@openstack01 tools]# openstack compute service list
    +----+------------------+---------------------------+----------+---------+-------+----------------------------+
    | ID | Binary           | Host                      | Zone     | Status  | State | Updated At                 |
    +----+------------------+---------------------------+----------+---------+-------+----------------------------+
    |  1 | nova-conductor   | openstack01.zuiyoujie.com | internal | enabled | up    | 2018-10-29T12:02:47.000000 |
    |  2 | nova-scheduler   | openstack01.zuiyoujie.com | internal | enabled | up    | 2018-10-29T12:02:47.000000 |
    |  5 | nova-consoleauth | openstack01.zuiyoujie.com | internal | enabled | up    | 2018-10-29T12:02:42.000000 |
    |  6 | nova-compute     | openstack02.zuiyoujie.com | nova     | enabled | up    | 2018-10-29T12:02:40.000000 |
    +----+------------------+---------------------------+----------+---------+-------+----------------------------+

    3)在身份认证服务中列出API端点以验证其连接性

    openstack catalog list

    # 实例演示:

    [root@openstack01 tools]# openstack catalog list
    +-----------+-----------+-----------------------------------------+
    | Name      | Type      | Endpoints                               |
    +-----------+-----------+-----------------------------------------+
    | keystone  | identity  | RegionOne                               |
    |           |           |   admin: http://controller:5000/v3/     |
    |           |           | RegionOne                               |
    |           |           |   internal: http://controller:5000/v3/  |
    |           |           | RegionOne                               |
    |           |           |   public: http://controller:5000/v3/    |
    |           |           |                                         |
    | glance    | image     | RegionOne                               |
    |           |           |   admin: http://controller:9292         |
    |           |           | RegionOne                               |
    |           |           |   internal: http://controller:9292      |
    |           |           | RegionOne                               |
    |           |           |   public: http://controller:9292        |
    |           |           |                                         |
    | nova      | compute   | RegionOne                               |
    |           |           |   internal: http://controller:8774/v2.1 |
    |           |           | RegionOne                               |
    |           |           |   admin: http://controller:8774/v2.1    |
    |           |           | RegionOne                               |
    |           |           |   public: http://controller:8774/v2.1   |
    |           |           |                                         |
    | placement | placement | RegionOne                               |
    |           |           |   public: http://controller:8778        |
    |           |           | RegionOne                               |
    |           |           |   admin: http://controller:8778         |
    |           |           | RegionOne                               |
    |           |           |   internal: http://controller:8778      |
    |           |           |                                         |
    +-----------+-----------+-----------------------------------------+

    #

    4)在镜像服务中列出已有镜像已检查镜像服务的连接性

    openstack image list

    # 实例演示:

    [root@openstack01 tools]# openstack image list
    +--------------------------------------+--------+--------+
    | ID                                   | Name   | Status |
    +--------------------------------------+--------+--------+
    | 78f5671b-fb2d-494f-8da7-25dbe425cad6 | cirros | active |
    +--------------------------------------+--------+--------+

    #

    5)检查nova各组件的状态

    # 检查placement API和cell服务是否正常工作

    nova-status upgrade check

    # 实例演示:

    [root@openstack01 tools]# nova-status upgrade check
    +-------------------------------+
    | 升级检查结果                  |
    +-------------------------------+
    | 检查: Cells v2                |
    | 结果: 成功                    |
    | 详情: None                    |
    +-------------------------------+
    | 检查: Placement API           |
    | 结果: 成功                    |
    | 详情: None                    |
    +-------------------------------+
    | 检查: Resource Providers      |
    | 结果: 成功                    |
    | 详情: None                    |
    +-------------------------------+
    | 检查: Ironic Flavor Migration |
    | 结果: 成功                    |
    | 详情: None                    |
    +-------------------------------+
    | 检查: API Service Version     |
    | 结果: 成功                    |
    | 详情: None                    |
    +-------------------------------+
    | 检查: Request Spec Migration  |
    | 结果: 成功                    |
    | 详情: None                    |
    +-------------------------------+

    # 至此,nova计算节点,安装完毕并添加到openstack集群中

    ========= 完毕,呵呵呵呵 ========

  • 相关阅读:
    pycharm 社区版运行flask app相关配置
    飞冰框架学习记录
    从上一次到现在总结2
    从上一次到今天的总结1
    mybatis 遇到空串无法判断
    Shell 脚本入门
    数据库批量插入数据
    Navicat for mysql 实现数据库自动备份
    自定义校验注解
    C++ 提高编程
  • 原文地址:https://www.cnblogs.com/tssc/p/9857647.html
Copyright © 2020-2023  润新知