• OpenStack IceHouse 部署


    Nova计算服务(计算节点)

     参考

    本页内容依照官方安装文档进行,具体参见Configure a compute node(nova service)

    前置工作

    数据库

    由于我们在Nova(计算管理)部署配置中使用了mysql数据库,所以移除本地sqlite数据库

    sudo rm /var/lib/nova/nova.sqlite
    

    修改vmlinuz权限

    For security reasons, the Linux kernel is not readable by normal users which restricts hypervisor services such as qemu and libguestfs. For details, see this bug. To make the current kernel readable, run:

    sudo dpkg-statoverride  --update --add root root 0644 /boot/vmlinuz-$(uname -r)
    

    为了以后在内核升级vmlinuz重新生成后还能保持可读状态,创建一个脚本/etc/kernel/postinst.d/statoverride,包含以下内容:

    #!/bin/sh
    version="$1"
    # passing the kernel version is required
    [ -z "${version}" ] && exit 0
    dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-${version}
    

    修改脚本权限

    sudo chmod +x /etc/kernel/postinst.d/statoverride
    

    安装

    # apt-get install nova-compute-kvm python-guestfs
    

    配置

    涉及的配置文件包含两个:

    /etc/nova/nova.conf
    配置与controller节点nova服务通信
    /etc/nova/nova-compute.conf
    配置nova-compute服务,即计算节点的虚拟化方面的配置,比如指定使用扫描虚拟化技术

    数据库

    编辑/etc/nova/nova.conf,修改[database]小节中的数据库连接字符串(没有则添加)如下:

    [database]
    connection = mysql://nova:nova_dbpass@controller/nova
    

    这里假定在控制节点的Nova(计算管理)部署配置时设定的数据库帐号nova的密码为nova_dbpass

    keystone对接

    编辑/etc/nova/nova.conf,首先配置文件中的[DEFAULT]小节,指定使用keystone作为验证后台:

    [DEFAULT]
    ...
    auth_strategy = keystone
    

    然后配置[keystone_authtoken]小节(没有则添加),如下

    [keystone_authtoken]
    auth_uri = http://controller:5000
    auth_host = controller
    auth_port = 35357
    auth_protocol = http
    admin_tenant_name = service
    admin_user = nova
    admin_password = nova_pass
    

    rabbitmq对接

    编辑/etc/nova/nova.conf,在[DEFAULT]节中修改为如下

    [DEFAULT]
    ...
    # rpc_backend = rabbit
    rabbit_host = controller
    rabbit_password = RABBIT_PASS
    

    其中"rpc_backend = rabbit"为官方配中给出,但是我们在实际配置发现,加入该字段后计算节点的nova服务无法启动,提示找不到"rabbit"模块.因此此处我们将其注释掉,服务仍然可以正常启动.

    VNC对接

    编辑/etc/nova/nova.conf,修改其中的[DEFAULT]小节,加入以下内容

    [DEFAULT]
    ...
    my_ip = 10.14.39.196
    vnc_enabled = True
    vncserver_listen = 0.0.0.0
    vncserver_proxyclient_address = 10.14.39.196
    novncproxy_base_url = http://controller:6080/vnc_auto.html
    

    其中10.14.39.196为本计算节点的ip,controller为/etc/hosts文件中控制节点的主机名

    glance对接

    创建虚拟机时需要把映像从glance服务中获取到计算节点上,所以在/etc/nova/nova.conf文件的[DEFAULT]小节中配置提供glance服务的主机(在我们的部署中由控制节点提供)

    [DEFAULT]
    ...
    glance_host = controller
    

    虚拟化技术

    需要根据硬件情况决定nova-compute使用的虚拟化技术 通过以下命令检测cpu是否支持硬件虚拟化

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

    其中vmx为intel提供的虚拟化技术,svm为amd提供的对应技术[1],如果上述命令输出为0,则该节点硬件不支持硬件虚拟化,需要修改/etc/nova/nova-compute.conf配置文件,指定使用qemu软件模拟

    [libvirt]
    ...
    virt_type = qemu
    

    如果输出大于0,则不需要进行配置,nova默认使用kvm技术[2][3]加速

    更新服务

    为了日后管理方便,在admin的home目录下创建一个脚本文件nova_compute_restart.sh,内如如下:

    #! /bin/bash
    service nova-compute restart
    

    修改脚本权限

    chmod +x nova_compute_restart.sh
    

    执行脚本应用刚刚的配置

    sudo ./nova_compute_restart.sh
    

    验证

    运行如下命令:

    admin@compute1:~$ . admin-openrc.sh
    admin@compute1:~$ sudo nova-manage host list
    host                     	zone           
    controller               	internal       
    compute1                 	nova      
    

    在host中可以看到本计算节点(compute1)

    Neutron网络服务(计算节点)

     参考

    本页内容依照官方部署指导[1]进行

    前置工作

    关闭反向路径过滤

    有关linux反向路径过滤参考[2],编辑/etc/sysctl.conf对内核做相应的配置变更如下:

    net.ipv4.conf.all.rp_filter=0
    net.ipv4.conf.default.rp_filter=0
    

    应用变更

    sudo sysctl -p
    

    安装

    sudo apt-get install neutron-common neutron-plugin-ml2 neutron-plugin-openvswitch-agent openvswitch-datapath-dkms
    

    注意:Ubuntu installations using Linux kernel version 3.11 or newer do not require the openvswitch-datapath-dkms package.

    配置

    涉及的配置文件如下

    /etc/neutron/neutron.conf
    计算节点的neutron网络服务
    /etc/neutron/plugins/ml2/ml2_conf.ini
    ml2插件配置
    /etc/nova/nova.conf
    计算节点的nova服务,因为nova中的虚拟机通信通过neutron提供的网络实现,所以要进行必要的配置,是他们能够协同工作

    keystone对接

    修改/etc/neutron/neutron.conf配置文件中的[DEFAULT]小节,指定使用keystone作为身份验证后台:

    [DEFAULT]
    ...
    auth_strategy = keystone
    

    然后修改(添加)配置文件中的[keystone_authtoken]小节:

    [keystone_authtoken]
    ...
    auth_uri = http://controller:5000
    auth_host = controller
    auth_protocol = http
    auth_port = 35357
    admin_tenant_name = service
    admin_user = neutron
    admin_password = neutron_pass
    

    这里假定在Neutron(网络管理)部署配置中配置的neutron服务的keystone帐号的密码为neutron为neutron_pass

    rabbitmq对接

    在配置文件/etc/neutron/neutron.conf中的[DEFAULT]小节中添加以下内容

    [DEFAULT]
    ...
    rpc_backend = neutron.openstack.common.rpc.impl_kombu
    rabbit_host = controller
    rabbit_password = rabbit123
    

    这里假定控制节点上rabbitmq消息队列服务的默认用户(guest)使用的密码时rabbit123

    ml2插件配置

    /etc/neutron/neutron.conf

    首先修改配置文件中的[DEFAULT]小节中添加以下内容:

    [DEFAULT]
    ...
    core_plugin = ml2
    service_plugins = router
    allow_overlapping_ips = True
    

    /etc/neutron/plugins/ml2/ml2_conf.ini

    然后修改ml2专有的配置文件,编辑各个小节的相关字段如下:

    [ml2]
    ...
    type_drivers = gre
    tenant_network_types = gre
    mechanism_drivers = openvswitch
    
    [ml2_type_gre]
    ...
    tunnel_id_ranges = 1:1000
    
    [ovs]
    ...
    local_ip = 10.14.39.196
    tunnel_type = gre
    enable_tunneling = True
    
    [securitygroup]
    ...
    firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
    enable_security_group = True
    

    其中[ovs]小节中的local_ip为用来作为GRE传输隧道的网络接口所拥有的ip地址,由于实验室中的台式机只有一个网卡,因此我们将使用与管理网络相同的接口作为的GRE隧道所用的网络接口(即计算节点上的eth0,ip=10.14.39.196).

    添加桥接接口

    添加一个名为br-int(系统默认使用该名,可以修改)的桥接,实际是对计算节点上各个虚拟网络的桥接并且有连接了br-tun隧道桥接,使得其上的流量能够通过GRE隧道到达其他的网络节点[3].

    # service openvswitch-switch restart
    # ovs-vsctl add-br br-int
    

    这个桥接是openswitch桥接,不是linux bridge.

    nova对接

    为了使得nova中的虚拟机使用neutron提供的网络服务,必须对计算节点上的nova服务也进行配置.

    修改配置文件/etc/nova/nova.conf 中的相关字段如下:

    [DEFAULT]
    ...
    network_api_class = nova.network.neutronv2.api.API
    neutron_url = http://controller:9696
    neutron_auth_strategy = keystone
    neutron_admin_tenant_name = service
    neutron_admin_username = neutron
    neutron_admin_password = neutron_pass
    neutron_admin_auth_url = http://controller:35357/v2.0
    linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    security_group_api = neutron
    

    这里假定neutron的keystone用户的密码为neutron_pass

    更新服务

    为了方便管理,在admin用户的home目录下创建一个脚本:neutron_and_vswitch_restart.sh,内容如下:

    #! /bin/bash
    service openvswitch-switch restart 
    && service neutron-plugin-openvswitch-agent restart
    

    修改脚本权限

    chmod +x neutron_and_vswitch_restart.sh
    

    执行脚本以应用刚刚修改的各个配置项:

    # ./neutron_and_vswitch_restart.sh
    # ./nova_compute_restart.sh
    

    注意:nova_compute_restart.sh为在配置Nova计算服务(计算节点)时创建的脚本

  • 相关阅读:
    PHP实现用户在线状态检测
    php面试题汇集2
    php 调用银联接口 【转载】
    【基础算法】基础算法【转载】
    下ue节点
    Python 字典 列表 嵌套 复杂排序大全
    Linux IO 监控与深入分析
    ELK之kibana的web报错[request] Data too large, data for [<agg [2]>] would be larger than limit of
    Elasticsearch聚合优化 | 聚合速度提升5倍
    elasticsearch bulk批量导入 大文件拆分
  • 原文地址:https://www.cnblogs.com/lailailai/p/3783508.html
Copyright © 2020-2023  润新知