zoukankan      html  css  js  c++  java
  • openstack搭建9、 Nova控制节点集群

    9、 Nova控制节点集群
    9.1 创建Nova相关数据库
    注:nova服务含4个数据库,统一授权到nova用户;

    [root@controller1:/root]# mysql -uroot -p"123456"
    MariaDB [(none)]> CREATE DATABASE nova_api;
    Query OK, 1 row affected (0.010 sec)
    
    MariaDB [(none)]> CREATE DATABASE nova;
    Query OK, 1 row affected (0.009 sec)
    
    MariaDB [(none)]> CREATE DATABASE nova_cell0;
    Query OK, 1 row affected (0.009 sec)
    
    MariaDB [(none)]> CREATE DATABASE placement;
    Query OK, 1 row affected (0.009 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_szh';
    Query OK, 0 rows affected (0.011 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_szh';
    Query OK, 0 rows affected (0.010 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_szh';
    Query OK, 0 rows affected (0.010 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_szh';
    Query OK, 0 rows affected (0.011 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_szh';
    Query OK, 0 rows affected (0.009 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_szh';
    Query OK, 0 rows affected (0.010 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'PLACEMENT_szh';
    Query OK, 0 rows affected (0.024 sec)
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'PLACEMENT_szh';
    Query OK, 0 rows affected (0.010 sec)
    
    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.011 sec)
    
    MariaDB [(none)]> exit
    Bye

    9.2 创建nova/placement-api

    [root@controller1:/root]# source openrc 
    [root@controller1:/root]# openstack user create --domain default --password=nova_szh nova
    +---------------------+----------------------------------+
    | Field | Value |
    +---------------------+----------------------------------+
    | domain_id | default |
    | enabled | True |
    | id | 2905a0f08e68433e9db648f2bdda1b52 |
    | name | nova |
    | options | {} |
    | password_expires_at | None |
    +---------------------+----------------------------------+
    //密码:nova_szh
    [root@controller2:/root]# openstack user list
    +----------------------------------+--------+
    | ID | Name |
    +----------------------------------+--------+
    | 5b63c4528d2a4147b52dd720a4a387fe | admin |
    | 2cd51918a8da419f8da4118e80ad7bb2 | glance |
    | 398fe755d4dd47b6851c6eee63316f13 | myuser |
    | 2905a0f08e68433e9db648f2bdda1b52 | nova |
    +----------------------------------+--------+
    [root@controller2:/root]# openstack role add --project service --user nova admin
    [root@controller2:/root]# openstack service list
    +----------------------------------+----------+----------+
    | ID | Name | Type |
    +----------------------------------+----------+----------+
    | d0311e554ec742069c267963d4c3acfa | glance | image |
    | 5c44c9890e7744d8b322531192aa12db | keystone | identity |
    +----------------------------------+----------+----------+
    [root@controller2:/root]# openstack service create --name nova --description "OpenStack Compute" compute
    +-------------+----------------------------------+
    | Field | Value |
    +-------------+----------------------------------+
    | description | OpenStack Compute |
    | enabled | True |
    | id | eac467e3e05f464e8fa2bec9237f2338 |
    | name | nova |
    | type | compute |
    +-------------+----------------------------------+
    [root@controller2:/root]# openstack service list
    +----------------------------------+----------+----------+
    | ID | Name | Type |
    +----------------------------------+----------+----------+
    | eac467e3e05f464e8fa2bec9237f2338 | nova | compute |
    | d0311e554ec742069c267963d4c3acfa | glance | image |
    | 5c44c9890e7744d8b322531192aa12db | keystone | identity |
    +----------------------------------+----------+----------+
    [root@controller2:/root]# openstack endpoint create --region RegionOne compute public http://VirtualIP:9774/v2.1
    +--------------+----------------------------------+
    | Field | Value |
    +--------------+----------------------------------+
    | enabled | True |
    | id | 3ae6c07e8c1844b3a21c3fc073cd3da9 |
    | interface | public |
    | region | RegionOne |
    | region_id | RegionOne |
    | service_id | eac467e3e05f464e8fa2bec9237f2338 |
    | service_name | nova |
    | service_type | compute |
    | url | http://VirtualIP:9774/v2.1 |
    +--------------+----------------------------------+
    [root@controller2:/root]# openstack endpoint create --region RegionOne compute internal http://VirtualIP:9774/v2.1
    +--------------+----------------------------------+
    | Field | Value |
    +--------------+----------------------------------+
    | enabled | True |
    | id | b0f71d34aedf41a9a8fb9d56313efb00 |
    | interface | internal |
    | region | RegionOne |
    | region_id | RegionOne |
    | service_id | eac467e3e05f464e8fa2bec9237f2338 |
    | service_name | nova |
    | service_type | compute |
    | url | http://VirtualIP:9774/v2.1 |
    +--------------+----------------------------------+
    [root@controller2:/root]# openstack endpoint create --region RegionOne compute admin http://VirtualIP:9774/v2.1
    +--------------+----------------------------------+
    | Field | Value |
    +--------------+----------------------------------+
    | enabled | True |
    | id | 7bff1a44974a42a59e49eebffad550c0 |
    | interface | admin |
    | region | RegionOne |
    | region_id | RegionOne |
    | service_id | eac467e3e05f464e8fa2bec9237f2338 |
    | service_name | nova |
    | service_type | compute |
    | url | http://VirtualIP:9774/v2.1 |
    +--------------+----------------------------------+
    [root@controller2:/root]# openstack catalog list
    //查看所有服务端点的服务地址
    +----------+----------+----------------------------------------+
    | Name | Type | Endpoints |
    +----------+----------+----------------------------------------+
    | nova | compute | RegionOne |
    | | | public: http://VirtualIP:9774/v2.1 |
    | | | RegionOne |
    | | | admin: http://VirtualIP:9774/v2.1 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9774/v2.1 |
    | | | |
    | glance | image | RegionOne |
    | | | admin: http://VirtualIP:9293 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9293 |
    | | | RegionOne |
    | | | public: http://VirtualIP:9293 |
    | | | |
    | keystone | identity | RegionOne |
    | | | internal: http://VirtualIP:5001/v3/ |
    | | | RegionOne |
    | | | admin: http://VirtualIP:5001/v3/ |
    | | | RegionOne |
    | | | public: http://VirtualIP:5001/v3/ |
    | | | |
    +----------+----------+----------------------------------------+
    
    [root@controller1:/root]# openstack user create --domain default --password=placement_szh placement
    //密码:placement_szh
    +---------------------+----------------------------------+
    | Field | Value |
    +---------------------+----------------------------------+
    | domain_id | default |
    | enabled | True |
    | id | 66b6d87d0410419e8070817a9fa6493e |
    | name | placement |
    | options | {} |
    | password_expires_at | None |
    +---------------------+----------------------------------+
    [root@controller1:/root]# openstack role add --project service --user placement admin
    [root@controller1:/root]# openstack service create --name placement --description "Placement API" placement
    +-------------+----------------------------------+
    | Field | Value |
    +-------------+----------------------------------+
    | description | Placement API |
    | enabled | True |
    | id | dba3c60da5084dfca6b220fe666c2f9b |
    | name | placement |
    | type | placement |
    +-------------+----------------------------------+
    [root@controller1:/root]# openstack endpoint create --region RegionOne placement public http://VirtualIP:9778
    +--------------+----------------------------------+
    | Field | Value |
    +--------------+----------------------------------+
    | enabled | True |
    | id | c2a1f308b3c04a448667967afb6016fe |
    | interface | public |
    | region | RegionOne |
    | region_id | RegionOne |
    | service_id | dba3c60da5084dfca6b220fe666c2f9b |
    | service_name | placement |
    | service_type | placement |
    | url | http://VirtualIP:9778 |
    +--------------+----------------------------------+
    [root@controller1:/root]# openstack endpoint create --region RegionOne placement internal http://VirtualIP:9778
    +--------------+----------------------------------+
    | Field | Value |
    +--------------+----------------------------------+
    | enabled | True |
    | id | 9035afba42be4b4387571d02b16c168c |
    | interface | internal |
    | region | RegionOne |
    | region_id | RegionOne |
    | service_id | dba3c60da5084dfca6b220fe666c2f9b |
    | service_name | placement |
    | service_type | placement |
    | url | http://VirtualIP:9778 |
    +--------------+----------------------------------+
    [root@controller1:/root]# openstack endpoint create --region RegionOne placement admin http://VirtualIP:9778
    +--------------+----------------------------------+
    | Field | Value |
    +--------------+----------------------------------+
    | enabled | True |
    | id | 53be3d592dfa4060b46ca6a488067191 |
    | interface | admin |
    | region | RegionOne |
    | region_id | RegionOne |
    | service_id | dba3c60da5084dfca6b220fe666c2f9b |
    | service_name | placement |
    | service_type | placement |
    | url | http://VirtualIP:9778 |
    +--------------+----------------------------------+
    [root@controller1:/root]# openstack catalog list
    +-----------+-----------+----------------------------------------+
    | Name | Type | Endpoints |
    +-----------+-----------+----------------------------------------+
    | nova | compute | RegionOne |
    | | | public: http://VirtualIP:9774/v2.1 |
    | | | RegionOne |
    | | | admin: http://VirtualIP:9774/v2.1 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9774/v2.1 |
    | | | |
    | glance | image | RegionOne |
    | | | admin: http://VirtualIP:9293 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9293 |
    | | | RegionOne |
    | | | public: http://VirtualIP:9293 |
    | | | |
    | keystone | identity | RegionOne |
    | | | internal: http://VirtualIP:5001/v3/ |
    | | | RegionOne |
    | | | admin: http://VirtualIP:5001/v3/ |
    | | | RegionOne |
    | | | public: http://VirtualIP:5001/v3/ |
    | | | |
    | placement | placement | RegionOne |
    | | | admin: http://VirtualIP:9778 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9778 |
    | | | RegionOne |
    | | | public: http://VirtualIP:9778 |
    | | | |
    +-----------+-----------+----------------------------------------+
    
     



    9.3 安装Nova服务

    [root@controller1:/root]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
    [root@controller2:/root]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
    [root@controller3:/root]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y

    9.4 配置nova.conf

    [root@controller1:/root]# cp -p /etc/nova/nova.conf{,.bak}
    [root@controller2:/root]# cp -p /etc/nova/nova.conf{,.bak}
    [root@controller3:/root]# cp -p /etc/nova/nova.conf{,.bak}
    
    [root@controller1:/etc/nova]# vim /etc/nova/nova.conf
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    my_ip = 192.168.110.121
    use_neutron = true
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    transport_url = rabbit://openstack:adminopenstack@controller1:5672,openstack:adminopenstack@controller2:5672,openstack:adminopenstack@controller3:5672
    osapi_compute_listen=$my_ip
    osapi_compute_listen_port=8774
    metadata_listen=$my_ip
    metadata_listen_port=8775
    agent_down_time = 30
    report_interval=15
    dhcp_agents_per_network = 3
    
    [api]
    auth_strategy = keystone
    
    [api_database]
    connection = mysql+pymysql://nova:NOVA_szh@VirtualIP:3307/nova_api
    
    [cache]
    backend=oslo_cache.memcache_pool
    enabled=True
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    
    [database]
    connection = mysql+pymysql://nova:NOVA_szh@VirtualIP:3307/nova
    
    [glance]
    api_servers = http://VirtualIP:9293
    
    [keystone_authtoken]
    auth_url = http://VirtualIP:5001/v3
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = service
    username = nova
    password = nova_szh
    
    [oslo_concurrency]
    lock_path = /var/lib/nova/tmp
    
    [placement]
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://VirtualIP:5001/v3
    username = placement
    password = placement_szh
    [scheduler]
    discover_hosts_in_cells_interval = 60
    
    [vnc]
    enabled = true
    server_listen = $my_ip
    server_proxyclient_address = $my_ip
    
    [root@controller2:/etc/nova]# vim /etc/nova/nova.conf
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    my_ip = 192.168.110.122
    use_neutron = true
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    transport_url = rabbit://openstack:adminopenstack@controller1:5672,openstack:adminopenstack@controller2:5672,openstack:adminopenstack@controller3:5672
    osapi_compute_listen=$my_ip
    osapi_compute_listen_port=8774
    metadata_listen=$my_ip
    metadata_listen_port=8775
    agent_down_time = 30
    report_interval=15
    dhcp_agents_per_network = 3
    
    [api]
    auth_strategy = keystone
    
    [api_database]
    connection = mysql+pymysql://nova:NOVA_szh@VirtualIP:3307/nova_api
    
    [cache]
    backend=oslo_cache.memcache_pool
    enabled=True
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    
    [database]
    connection = mysql+pymysql://nova:NOVA_szh@VirtualIP:3307/nova
    
    [glance]
    api_servers = http://VirtualIP:9293
    
    [keystone_authtoken]
    auth_url = http://VirtualIP:5001/v3
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = service
    username = nova
    password = nova_szh
    
    [oslo_concurrency]
    lock_path = /var/lib/nova/tmp
    
    [placement]
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://VirtualIP:5001/v3
    username = placement
    password = placement_szh
    [scheduler]
    discover_hosts_in_cells_interval = 60
    
    [vnc]
    enabled = true
    server_listen = $my_ip
    server_proxyclient_address = $my_ip
    
    [root@controller3:/etc/nova]# vim /etc/nova/nova.conf
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    my_ip = 192.168.110.123
    use_neutron = true
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    transport_url = rabbit://openstack:adminopenstack@controller1:5672,openstack:adminopenstack@controller2:5672,openstack:adminopenstack@controller3:5672
    osapi_compute_listen=$my_ip
    osapi_compute_listen_port=8774
    metadata_listen=$my_ip
    metadata_listen_port=8775
    agent_down_time = 30
    report_interval=15
    dhcp_agents_per_network = 3
    
    [api]
    auth_strategy = keystone
    
    [api_database]
    connection = mysql+pymysql://nova:NOVA_szh@VirtualIP:3307/nova_api
    
    [cache]
    backend=oslo_cache.memcache_pool
    enabled=True
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    
    [database]
    connection = mysql+pymysql://nova:NOVA_szh@VirtualIP:3307/nova
    
    [glance]
    api_servers = http://VirtualIP:9293
    
    [keystone_authtoken]
    auth_url = http://VirtualIP:5001/v3
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = service
    username = nova
    password = nova_szh
    
    [oslo_concurrency]
    lock_path = /var/lib/nova/tmp
    
    [placement]
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://VirtualIP:5001/v3
    username = placement
    password = placement_szh
    [scheduler]
    discover_hosts_in_cells_interval = 60
    
    [vnc]
    enabled = true
    server_listen = $my_ip
    server_proxyclient_address = $my_ip

    9.5 配置00-nova-placement-api.conf

    [root@controller1:/root]# cp -p /etc/httpd/conf.d/00-nova-placement-api.conf{,.bak}
    [root@controller2:/root]# cp -p /etc/httpd/conf.d/00-nova-placement-api.conf{,.bak}
    [root@controller3:/root]# cp -p /etc/httpd/conf.d/00-nova-placement-api.conf{,.bak}
    
    [root@controller1:/root]# vim /etc/httpd/conf.d/00-nova-placement-api.conf
    //在最后添加
    #Placement API
    <Directory /usr/bin>
    <IfVersion >= 2.4>
    Require all granted
    </IfVersion>
    <IfVersion < 2.4>
    Order allow,deny
    Allow from all
    </IfVersion>
    </Directory>
    
    [root@controller2:/root]# vim /etc/httpd/conf.d/00-nova-placement-api.conf
    //在最后添加
    #Placement API
    <Directory /usr/bin>
    <IfVersion >= 2.4>
    Require all granted
    </IfVersion>
    <IfVersion < 2.4>
    Order allow,deny
    Allow from all
    </IfVersion>
    </Directory>
    
    [root@controller3:/root]# vim /etc/httpd/conf.d/00-nova-placement-api.conf
    //在最后添加
    #Placement API
    <Directory /usr/bin>
    <IfVersion >= 2.4>
    Require all granted
    </IfVersion>
    <IfVersion < 2.4>
    Order allow,deny
    Allow from all
    </IfVersion>
    </Directory>
    
    [root@controller1:/root]# systemctl restart httpd
    [root@controller2:/root]# systemctl restart httpd
    [root@controller3:/root]# systemctl restart httpd

    9.6 同步nova相关数据库(任意控制节点操作)

    [root@controller1:/root]# su -s /bin/sh -c "nova-manage api_db sync" nova
    [root@controller1:/root]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
    [root@controller1:/root]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
    All hosts must be set with username/password or not at the same time. Hosts with credentials are: ['controller1']. Hosts without credentials are ['controller2', 'controller3'].
    All hosts must be set with username/password or not at the same time. Hosts with credentials are: ['controller1']. Hosts without credentials are ['controller2', 'controller3'].
    418b9e81-2804-4a9d-9baf-40bfa07066ed
    [root@controller2:/root]# su -s /bin/sh -c "nova-manage db sync" nova
    /usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release')
    result = self._query(query)
    /usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release')
    result = self._query(query)
    [root@controller2:/root]# 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:****@VirtualIP/nova_cell0 | False 
    | cell1 | 418b9e81-2804-4a9d-9baf-40bfa07066ed | rabbit://openstack:****@controller1:5672,controller2:5672,controller3:5672 | mysql+pymysql://nova:****@VirtualIP/nova | False |
    +-------+--------------------------------------+-----------------------------------

     9.6 启动nova服务

    [root@controller1:/root]#systemctl enable openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    [root@controller1:/root]#systemctl restart openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    [root@controller1:/root]#systemctl status openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service | grep active
    [root@controller2:/root]#systemctl enable openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    [root@controller2:/root]#systemctl restart openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    [root@controller2:/root]#systemctl status openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service | grep active
    [root@controller3:/root]#systemctl enable openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    [root@controller3:/root]#systemctl restart openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    [root@controller3:/root]#systemctl status openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service | grep active

    9.7 验证

    [root@controller2:/root]# . admin-openrc
    [root@controller2:/root]# openstack compute service list
    +----+------------------+--------+----------+---------+-------+------------
    | ID | Binary | Host | Zone | Status | State | Updated At |
    +----+------------------+--------+----------+---------+-------+------------
    | 1 | nova-scheduler | controller1 | internal | enabled | up | 2020-08-11T05:52:27.000000 |
    | 13 | nova-conductor | controller1 | internal | enabled | up | 2020-08-11T05:52:32.000000 |
    | 16 | nova-consoleauth | controller1 | internal | enabled | up | 2020-08-11T05:52:25.000000 |
    | 28 | nova-scheduler | controller2 | internal | enabled | up | 2020-08-11T05:52:25.000000 |
    | 43 | nova-conductor | controller2 | internal | enabled | up | 2020-08-11T05:52:32.000000 |
    | 49 | nova-consoleauth | controller2 | internal | enabled | up | 2020-08-11T05:52:31.000000 |
    | 67 | nova-conductor | controller3 | internal | enabled | up | 2020-08-11T05:52:27.000000 |
    | 70 | nova-scheduler | controller3 | internal | enabled | up | 2020-08-11T05:52:26.000000 |
    | 82 | nova-consoleauth | controller3 | internal | enabled | up | 2020-08-11T05:52:32.000000 |
    +----+------------------+--------+----------+---------+-------+------------
    [root@controller2:/root]# openstack catalog list
    +-----------+-----------+----------------------------------------+
    | Name | Type | Endpoints |
    +-----------+-----------+----------------------------------------+
    | nova | compute | RegionOne |
    | | | public: http://VirtualIP:9774/v2.1 |
    | | | RegionOne |
    | | | admin: http://VirtualIP:9774/v2.1 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9774/v2.1 |
    | | | |
    | glance | image | RegionOne |
    | | | admin: http://VirtualIP:9293 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9293 |
    | | | RegionOne |
    | | | public: http://VirtualIP:9293 |
    | | | |
    | keystone | identity | RegionOne |
    | | | internal: http://VirtualIP:5001/v3/ |
    | | | RegionOne |
    | | | admin: http://VirtualIP:5001/v3/ |
    | | | RegionOne |
    | | | public: http://VirtualIP:5001/v3/ |
    | | | |
    | placement | placement | RegionOne |
    | | | admin: http://VirtualIP:9778 |
    | | | RegionOne |
    | | | internal: http://VirtualIP:9778 |
    | | | RegionOne |
    | | | public: http://VirtualIP:9778 |
    | | | |
    +-----------+-----------+----------------------------------------+
    [root@controller2:/root]# nova-status upgrade check
    +--------------------------------------------------------------------+
    | Upgrade Check Results |
    +--------------------------------------------------------------------+
    | Check: Cells v2 |
    | Result: Success |
    | Details: No host mappings or compute nodes were found. Remember to |
    | run command 'nova-manage cell_v2 discover_hosts' when new |
    | compute hosts are deployed. |
    +--------------------------------------------------------------------+
    | Check: Placement API |
    | Result: Success |
    | Details: None |
    +--------------------------------------------------------------------+
    | Check: Resource Providers |
    | Result: Success |
    | Details: There are no compute resource providers in the Placement |
    | service nor are there compute nodes in the database. |
    | Remember to configure new compute nodes to report into the |
    | Placement service. See |
    | https://docs.openstack.org/nova/latest/user/placement.html |
    | for more details. |
    +--------------------------------------------------------------------+
    | Check: Ironic Flavor Migration |
    | Result: Success |
    | Details: None |
    +--------------------------------------------------------------------+
    | Check: API Service Version |
    | Result: Success |
    | Details: None |
    +--------------------------------------------------------------------+
    | Check: Request Spec Migration |
    | Result: Success |
    | Details: None |
    +--------------------------------------------------------------------+
    | Check: Console Auths |
    | Result: Success |
    | Details: None |
    +--------------------------------------------------------------------+
    
     

    9.8 设置PCS资源(任意控制节点操作)

    //添加资源openstack-nova-api,openstack-nova-consoleauth,openstack-nova-scheduler,openstack-nova-conductor与openstack-nova-novncproxy
    //经验证,建议openstack-nova-api,openstack-nova-consoleauth,openstack-nova-conductor与openstack-nova-novncproxy 等无状态服务以active/active模式运行;
    //经验证,建议openstack-nova-scheduler等服务以active/passive模式运行
    
    [root@controller1:/root]# pcs resource create openstack-nova-api systemd:openstack-nova-api --clone interleave=true
    [root@controller1:/root]# pcs resource create openstack-nova-consoleauth systemd:openstack-nova-consoleauth --clone interleave=true
    [root@controller1:/root]# pcs resource create openstack-nova-scheduler systemd:openstack-nova-scheduler --clone interleave=true
    [root@controller1:/root]# pcs resource create openstack-nova-conductor systemd:openstack-nova-conductor --clone interleave=true
    [root@controller1:/root]# pcs resource create openstack-nova-novncproxy systemd:openstack-nova-novncproxy --clone interleave=true
    [root@controller1:/root]# pcs resource
    VirtualIP (ocf::heartbeat:IPaddr2): Started controller1
    Clone Set: openstack-glance-api-clone [openstack-glance-api]
    Started: [ controller1 controller2 controller3 ]
    Clone Set: openstack-glance-registry-clone [openstack-glance-registry]
    Started: [ controller1 controller2 controller3 ]
    Clone Set: openstack-nova-api-clone [openstack-nova-api]
    Started: [ controller1 controller2 controller3 ]
    Clone Set: openstack-nova-consoleauth-clone [openstack-nova-consoleauth]
    Started: [ controller1 controller2 controller3 ]
    Clone Set: openstack-nova-scheduler-clone [openstack-nova-scheduler]
    Started: [ controller1 controller2 controller3 ]
    Clone Set: openstack-nova-conductor-clone [openstack-nova-conductor]
    Started: [ controller1 controller2 controller3 ]
    Clone Set: openstack-nova-novncproxy-clone [openstack-nova-novncproxy]
    Started: [ controller1 controller2 controller3 ]

    控制nova节点已布置完成


    9.8 部署 Nova计算节点
    在计算节点上compute1、compute2、compute3执行:

    [root@compute1:/root]yum install centos-release-openstack-rocky -y
    [root@compute1:/root]yum update
    [root@compute1:/root]yum install openstack-nova-compute -y
    [root@compute2:/root]yum install centos-release-openstack-rocky -y
    [root@compute2:/root]yum update
    [root@compute2:/root]yum install openstack-nova-compute -y
    [root@compute3:/root]yum install centos-release-openstack-rocky -y
    [root@compute3:/root]yum update
    [root@compute3:/root]yum install openstack-nova-compute -y

    9.10 计算节点和直接ssh免密认证

    ssh-keygen
    ssh-copy-id compute1
    ssh-copy-id compute2
    ssh-copy-id compute3

    9.11 配置计算节点的配置nova.conf

    [root@compute1:/etc/nova]# cp -p /etc/nova/nova.conf{,.bak}
    [root@compute2:/etc/nova]# cp -p /etc/nova/nova.conf{,.bak}
    [root@compute3:/etc/nova]# cp -p /etc/nova/nova.conf{,.bak}
    
    [root@compute1:/etc/nova]# vim /etc/nova/nova.conf
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    my_ip = 192.168.110.117
    use_neutron = true
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    transport_url = rabbit://openstack:adminopenstack@controller1:5672,openstack:adminopenstack@controller2:5672,openstack:adminopenstack@controller3:5672
    
    [api]
    auth_strategy = keystone
    
    [glance]
    api_servers = http://VirtualIP:9293
    
    [keystone_authtoken]
    auth_url = http://VirtualIP:5001/v3
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = service
    username = nova
    password = nova_szh
    
    [libvirt]
    virt_type = qemu
    //注:通过“egrep -c '(vmx|svm)' /proc/cpuinfo”命令查看主机是否支持硬件加速,返回1或者更大的值表示支持,返回0表示不支持;
    //注: 支持硬件加速使用”kvm”类型,不支持则使用”qemu”类型;
    //注: 一般虚拟机不支持硬件加速
    //注:此处正常全用qemu,实验测试时,根据返回结果为8 ,将virt_type = kvm 后,创建实例显示 nova的type错误,实例创建后显示状态为错误
    [placement]
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://VirtualIP:5001/v3
    username = placement
    password = placement_szh
    
    [vnc]
    enabled=true
    vncserver_listen=0.0.0.0
    vncserver_proxyclient_address=$my_ip
    novncproxy_base_url=http://192.168.110.120:6081/vnc_auto.html
    //注:此处novncproxy_base_url的IP使用数字192.168.110.120,不建议使用VirtualIP;因为用VirtualIP会报错。
    
    
    [root@compute2:/root]# vim /etc/nova/nova.conf
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    my_ip = 192.168.110.118
    use_neutron = true
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    transport_url = rabbit://openstack:adminopenstack@controller1:5672,openstack:adminopenstack@controller2:5672,openstack:adminopenstack@controller3:5672
    
    [api]
    auth_strategy = keystone
    
    [glance]
    api_servers = http://VirtualIP:9293
    
    [keystone_authtoken]
    auth_url = http://VirtualIP:5001/v3
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = service
    username = nova
    password = nova_szh
    
    [libvirt]
    virt_type = qemu
    
    [placement]
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://VirtualIP:5001/v3
    username = placement
    password = placement_szh
    
    [vnc]
    enabled=true
    vncserver_listen=0.0.0.0
    vncserver_proxyclient_address=$my_ip
    novncproxy_base_url=http://192.168.110.120:6081/vnc_auto.html
    
    [root@compute3:/root]# vim /etc/nova/nova.conf
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    my_ip = 192.168.110.119
    use_neutron = true
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    transport_url = rabbit://openstack:adminopenstack@controller1:5672,openstack:adminopenstack@controller2:5672,openstack:adminopenstack@controller3:5672
    
    [api]
    auth_strategy = keystone
    
    [glance]
    api_servers = http://VirtualIP:9293
    
    [keystone_authtoken]
    auth_url = http://VirtualIP:5001/v3
    memcached_servers=controller1:11211,controller2:11211,controller3:11211
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = service
    username = nova
    password = nova_szh
    
    [libvirt]
    virt_type = qemu
    
    [placement]
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://VirtualIP:5001/v3
    username = placement
    password = placement_szh
    
    [vnc]
    enabled=true
    vncserver_listen=0.0.0.0
    vncserver_proxyclient_address=$my_ip
    novncproxy_base_url=http://192.168.110.120:6081/vnc_auto.html

     9.12 启动计算节点服务 在compute1 compute2 compute3上执行

    [root@compute1:/root]#systemctl enable libvirtd.service openstack-nova-compute.service
    [root@compute1:/root]#systemctl restart libvirtd.service openstack-nova-compute.service
    [root@compute1:/root]#systemctl status libvirtd.service openstack-nova-compute.service
    [root@compute2:/root]#systemctl enable libvirtd.service openstack-nova-compute.service
    [root@compute2:/root]#systemctl restart libvirtd.service openstack-nova-compute.service
    [root@compute2:/root]#systemctl status libvirtd.service openstack-nova-compute.service
    [root@compute3:/root]#systemctl enable libvirtd.service openstack-nova-compute.service
    [root@compute3:/root]#systemctl restart libvirtd.service openstack-nova-compute.service
    [root@compute3:/root]#systemctl status libvirtd.service openstack-nova-compute.service

    9.13 向cell数据库添加计算节点(在任意控制节点操作)

    [root@controller2:/root]# . admin-openrc 
    [root@controller2:/root]# openstack compute service list --service nova-compute
    +----+--------------+--------+------+---------+-------+----------------------------
    | ID | Binary | Host | Zone | Status | State | Updated At
    
    | 91 | nova-compute | compute2 | nova | enabled | up | 2020-08-11T12:26:33.000000 |
    | 94 | nova-compute | compute1 | nova | enabled | up | 2020-08-11T12:26:29.000000 |
    | 97 | nova-compute | compute3 | nova | enabled | up | 2020-08-11T12:26:36.000000 |
    +----+--------------+--------+------+---------+-------+----------------------------
    //手工发现计算节点主机,即添加到cell数据库
    [root@controller2:/root]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
    All hosts must be set with username/password or not at the same time. Hosts with credentials are: ['controller1']. Hosts without credentials are ['controller2', 'controller3'].
    All hosts must be set with username/password or not at the same time. Hosts with credentials are: ['controller1']. Hosts without credentials are ['controller2', 'controller3'].
    Found 2 cell mappings.
    Skipping cell0 since it does not contain hosts.
    Getting computes from cell 'cell1': 418b9e81-2804-4a9d-9baf-40bfa07066ed
    Found 0 unmapped computes in cell: 418b9e81-2804-4a9d-9baf-40bfa07066ed
    [root@controller2:/root]# openstack hypervisor list
    +----+---------------------+-----------------+---------------+-------+
    | ID | Hypervisor Hostname | Hypervisor Type | Host IP | State |
    +----+---------------------+-----------------+---------------+-------+
    | 1 | compute1 | QEMU | 192.168.110.117 | up |
    | 4 | compute2 | QEMU | 192.168.110.118 | up |
    | 7 | compute3 | QEMU | 192.168.110.119 | up |
    +----+---------------------+-----------------+---------------+-------+
    [root@controller2:/root]# openstack compute service list
    //注:此命令为查看计算服务列表 Status表示nova功能已打开 State表示nova功能已运行
    +----+------------------+--------+----------+---------+-------+--------------------
    | ID | Binary | Host | Zone | Status | State | Updated At 
    +----+------------------+--------+----------+---------+-------+--------------------
    | 1 | nova-scheduler | controller1 | internal | enabled | up | 2020-08-11T12:28:17.000000 |
    | 13 | nova-conductor | controller1 | internal | enabled | up | 2020-08-11T12:28:14.000000 |
    | 16 | nova-consoleauth | controller1 | internal | enabled | up | 2020-08-11T12:28:18.000000 |
    | 28 | nova-scheduler | controller2 | internal | enabled | up | 2020-08-11T12:28:20.000000 |
    | 43 | nova-conductor | controller2 | internal | enabled | up | 2020-08-11T12:28:21.000000 |
    | 49 | nova-consoleauth | controller2 | internal | enabled | up | 2020-08-11T12:28:19.000000 |
    | 67 | nova-conductor | controller3 | internal | enabled | up | 2020-08-11T12:28:18.000000 |
    | 70 | nova-scheduler | controller3 | internal | enabled | up | 2020-08-11T12:28:21.000000 |
    | 82 | nova-consoleauth | controller3 | internal | enabled | up | 2020-08-11T12:28:14.000000 |
    | 91 | nova-compute | compute2 | nova | enabled | up | 2020-08-11T12:28:23.000000 |
    | 94 | nova-compute | compute1 | nova | enabled | up | 2020-08-11T12:28:19.000000 |
    | 97 | nova-compute | compute3 | nova | enabled | up | 2020-08-11T12:28:16.000000 |
    +----+------------------+--------+----------+---------+-------+--------------------
    [root@controller2:/root]# nova-status upgrade check
    //注:Cells v2 、Placement API、Resource Providers 这3个必须成功
    +--------------------------------+
    | Upgrade Check Results |
    +--------------------------------+
    | Check: Cells v2 |
    | Result: Success |
    | Details: None |
    +--------------------------------+
    | Check: Placement API |
    | Result: Success |
    | Details: None |
    +--------------------------------+
    | Check: Resource Providers |
    | Result: Success |
    | Details: None |
    +--------------------------------+
    | Check: Ironic Flavor Migration |
    | Result: Success |
    | Details: None |
    +--------------------------------+
    | Check: API Service Version |
    | Result: Success |
    | Details: None |
    +--------------------------------+
    | Check: Request Spec Migration |
    | Result: Success |
    | Details: None |
    +--------------------------------+
    | Check: Console Auths |
    | Result: Success |
    | Details: None |
    +--------------------------------+
  • 相关阅读:
    洗礼灵魂,修炼python(27)--异常处理(1)—>了解异常
    洗礼灵魂,修炼python(26)--编程核心之“递归”
    洗礼灵魂,修炼python(25)--自定义函数(6)—从匿名函数进阶话题讲解中解析“函数式编程”
    洗礼灵魂,修炼python(24)--自定义函数(5)—匿名函数lambda
    洗礼灵魂,修炼python(23)--自定义函数(4)—闭包进阶问题—>报错UnboundLocalError: local variable 'x' referenced before assignment
    721. Accounts Merge
    Union found
    547. Friend Circles
    200. Number of Islands
    684. Redundant Connection
  • 原文地址:https://www.cnblogs.com/tartarush/p/14308428.html
Copyright © 2011-2022 走看看