Steward_Xu

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

一、控制节点安装部署Nova

  Nova 包含API(负责接收相应外部请求,支持OpenStackAPI,EC2API);cert:负责身份认证;schedule:用于云主机调度(虚拟机创建在哪台主机上);conductor:计算节点访问数据中间件;consoleauth:用户控制台授权验证;novncproxy:vnc代理。

  1、安装

  [root@linux-node1 ~]#yum install openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient -y

  2、创建用户:  

[root@linux-node1 ~]# openstack user create --domain default --password=nova nova
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | d21d0715890447fb87f72e85dce6d4be |
| enabled             | True                             |
| id                  | 5fbc8074b56843b0a1cdb7d4730bb7fa |
| name                | nova                             |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@linux-node1 ~]# openstack role add --project service --user nova admin
View Code

  3、修改nova的配置文件,配置结果如下

[root@linux-node1 ~]# vi /etc/nova/nova.conf
[database]
connection=mysql://nova:nova@172.22.0.218/nova
[api_database]
connection=mysql://nova:nova@172.22.0.218/nova
[xvp]
rpc_backend=rabbit
[oslo_messaging_rabbit]
rabbit_host=172.22.0.218
rabbit_port=5672
rabbit_userid=openstack
rabbit_password=openstack
[keystone_authtoken]
auth_uri = http://172.22.0.218:5000
auth_url = http://172.22.0.218:35357
auth_plugin = password
memcached_servers = 172.22.0.218:11211
project_domain_id = d21d0715890447fb87f72e85dce6d4be
user_domain_id = d21d0715890447fb87f72e85dce6d4be
project_name = service   
username = nova
password = nova
[DEFAULT]
my_ip=172.22.0.218
auth_strategy=keystone
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
enabled_apis=osapi_compute,metadata
transport_url=rabbit://openstack:openstack@172.22.0.218
[vnc]
vncserver_listen=$my_ip
vncserver_proxyclient_address=$my_ip 
[glance]
api_servers=http://172.22.0.218:9292
[oslo_concurrency]
lock_path=/var/lib/nova/tmp
View Code
[root@linux-node1 ~]# grep -n "^[a-Z]"  /etc/nova/nova.conf 
14:auth_strategy=keystone
23:use_neutron = True
1328:my_ip=172.22.0.218
3052:enabled_apis=osapi_compute,metadata
3266:firewall_driver = nova.virt.firewall.NoopFirewallDriver
3601:transport_url=rabbit://openstack:openstack@172.22.0.218
3608:rpc_backend=rabbit
4678:connection=mysql://nova:nova@172.22.0.218/nova
4814:api_servers=http://172.22.0.218:9292
5435:auth_uri = http://172.22.0.218:5000
5436:auth_url = http://172.22.0.218:35357
5437:auth_plugin = password
5438:memcached_servers = 172.22.0.218:11211
5439:project_domain_id = d21d0715890447fb87f72e85dce6d4be
5440:user_domain_id = d21d0715890447fb87f72e85dce6d4be
5441:project_name = service   
5442:username = nova
5443:password = nova
6706:lock_path=/var/lib/nova/tmp
6952:rabbit_host=172.22.0.218
6961:rabbit_port=5672
6979:rabbit_userid=openstack
6986:rabbit_password=openstack
8325:vncserver_listen=$my_ip
8337:vncserver_proxyclient_address=$my_ip
View Code

  4、数据库同步并检查:  

[root@linux-node1 ~]# su -s /bin/sh -c "nova-manage db sync" nova
[root@linux-node1 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
MariaDB [nova]> show tables;
+--------------------------------------------+
| Tables_in_nova                             |
+--------------------------------------------+
| agent_builds                               |
| aggregate_hosts                            |
| aggregate_metadata                         |
| aggregates                                 |
| allocations                                |
| block_device_mapping                       |
| bw_usage_cache                             |
| cells                                      |
| certificates                               |
| compute_nodes                              |
| console_auth_tokens                        |
| console_pools                              |
| consoles                                   |
| dns_domains                                |
| fixed_ips                                  |
| floating_ips                               |
| instance_actions                           |
| instance_actions_events                    |
| instance_extra                             |
| instance_faults                            |
| instance_group_member                      |
| instance_group_policy                      |
| instance_groups                            |
| instance_id_mappings                       |
| instance_info_caches                       |
| instance_metadata                          |
| instance_system_metadata                   |
| instance_type_extra_specs                  |
| instance_type_projects                     |
| instance_types                             |
| instances                                  |
| inventories                                |
| key_pairs                                  |
| migrate_version                            |
| migrations                                 |
| networks                                   |
| pci_devices                                |
| project_user_quotas                        |
| provider_fw_rules                          |
| quota_classes                              |
| quota_usages                               |
| quotas                                     |
| reservations                               |
| resource_provider_aggregates               |
| resource_providers                         |
| s3_images                                  |
| security_group_default_rules               |
| security_group_instance_association        |
| security_group_rules                       |
| security_groups                            |
| services                                   |
| shadow_agent_builds                        |
| shadow_aggregate_hosts                     |
| shadow_aggregate_metadata                  |
| shadow_aggregates                          |
| shadow_block_device_mapping                |
| shadow_bw_usage_cache                      |
| shadow_cells                               |
| shadow_certificates                        |
| shadow_compute_nodes                       |
| shadow_console_pools                       |
| shadow_consoles                            |
| shadow_dns_domains                         |
| shadow_fixed_ips                           |
| shadow_floating_ips                        |
| shadow_instance_actions                    |
| shadow_instance_actions_events             |
| shadow_instance_extra                      |
| shadow_instance_faults                     |
| shadow_instance_group_member               |
| shadow_instance_group_policy               |
| shadow_instance_groups                     |
| shadow_instance_id_mappings                |
| shadow_instance_info_caches                |
| shadow_instance_metadata                   |
| shadow_instance_system_metadata            |
| shadow_instance_type_extra_specs           |
| shadow_instance_type_projects              |
| shadow_instance_types                      |
| shadow_instances                           |
| shadow_key_pairs                           |
| shadow_migrate_version                     |
| shadow_migrations                          |
| shadow_networks                            |
| shadow_pci_devices                         |
| shadow_project_user_quotas                 |
| shadow_provider_fw_rules                   |
| shadow_quota_classes                       |
| shadow_quota_usages                        |
| shadow_quotas                              |
| shadow_reservations                        |
| shadow_s3_images                           |
| shadow_security_group_default_rules        |
| shadow_security_group_instance_association |
| shadow_security_group_rules                |
| shadow_security_groups                     |
| shadow_services                            |
| shadow_snapshot_id_mappings                |
| shadow_snapshots                           |
| shadow_task_log                            |
| shadow_virtual_interfaces                  |
| shadow_volume_id_mappings                  |
| shadow_volume_usage_cache                  |
| snapshot_id_mappings                       |
| snapshots                                  |
| tags                                       |
| task_log                                   |
| virtual_interfaces                         |
| volume_id_mappings                         |
| volume_usage_cache                         |
+--------------------------------------------+
110 rows in set (0.01 sec)
View Code

二、启动Nova并注册:

  1、开机启动

[root@linux-node1 ~]# systemctl enable openstack-nova-api.service   openstack-nova-cert.service openstack-nova-consoleauth.service   openstack-nova-scheduler.service openstack-nova-conductor.service   openstack-nova-novncproxy.service

  2、在keystone上注册nova,并检查控制节点的nova服务是否配置成功  

[root@linux-node1 ~]# openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 6e8e777cc27c4459aebc35458961a910 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne compute public http://172.22.0.218:8774/v2/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 0a71c8fd893647b690c7574ca73ed9b9          |
| interface    | public                                    |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 6e8e777cc27c4459aebc35458961a910          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://172.22.0.218:8774/v2/%(tenant_id)s |
+--------------+-------------------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne compute internal  http://172.22.0.218:8774/v2/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 5e99985fb4b14c3286d373e0b18dc311          |
| interface    | internal                                  |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 6e8e777cc27c4459aebc35458961a910          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://172.22.0.218:8774/v2/%(tenant_id)s |
+--------------+-------------------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne compute admin http://172.22.0.218:8774/v2/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | d7b07484b2f4437388cd67eb1bccda47          |
| interface    | admin                                     |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 6e8e777cc27c4459aebc35458961a910          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://172.22.0.218:8774/v2/%(tenant_id)s |
+--------------+-------------------------------------------+
[root@linux-node1 ~]# openstack host list

+-------------+-------------+----------+
| Host Name   | Service     | Zone     |
+-------------+-------------+----------+
| linux-node1 | conductor   | internal |
| linux-node1 | consoleauth | internal |
| linux-node1 | cert        | internal |
| linux-node1 | scheduler   | internal |
View Code

三、计算节点环境准备

  1、Nova compute 计算节点的安装部署    

     1)环境部署安装:

                   [root@linux-node2 ~]# yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm -y

                   [root@linux-node2 ~]# yum install centos-release-openstack-newton -y

                   [root@linux-node2 ~]# yum install python-openstackclient -y

        [root@linux-node2 ~]#yum install openstack-nova-compute sysfsutils -y

                   2)开始部署计算节点
                   更改计算节点上的配置文件,直接使用控制节点的配置文件

     [root@linux-node1 ~]# scp /etc/nova/nova.conf 172.22.0.209:/etc/nova     

      
过滤配置文件有些需要更改:
        [root@linux-node2 ~]# grep -n '^[a-z]' /etc/nova/nova.conf 
14:auth_strategy=keystone
23:use_neutron = True
1328:my_ip=172.22.0.209
3052:enabled_apis=osapi_compute,metadata
3266:firewall_driver = nova.virt.firewall.NoopFirewallDriver
3601:transport_url=rabbit://openstack:openstack@172.22.0.218
3608:rpc_backend=rabbit
3661:connection=mysql://nova:nova@172.22.0.218/nova
4678:connection=mysql://nova:nova@172.22.0.218/nova
4814:api_servers=http://172.22.0.218:9292
5435:auth_uri = http://172.22.0.218:5000
5436:auth_url = http://172.22.0.218:35357
5437:auth_plugin = password
5438:memcached_servers = 172.22.0.218:11211
5439:project_domain_id = d21d0715890447fb87f72e85dce6d4be
5440:user_domain_id = d21d0715890447fb87f72e85dce6d4be
5441:project_name = service   
5442:username = nova
5443:password = nova
5675:virt_type=qemu
6706:lock_path=/var/lib/nova/tmp
6952:rabbit_host=172.22.0.218
6961:rabbit_port=5672
6979:rabbit_userid=openstack
6986:rabbit_password=openstack
8302:enabled=true
8318:keymap=en-us
8325:vncserver_listen=0.0.0.0
8337:vncserver_proxyclient_address=$my_ip
8356:novncproxy_base_url=http://172.22.0.218:6080/vnc_auto.html
View Code

     3)启动计算节点的libvirt和nova-compute      

      
[root@linux-node2 ~]# systemctl enable libvirtd openstack-nova-compute
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
[root@linux-node2 ~]#  systemctl start libvirtd openstack-nova-compute    
View Code

  2、安装时间服务:   

  
[root@linux-node2 ~]# yum install chrony -y
[root@linux-node2 ~]# cat /etc/chrony.conf 
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 172.22.0.218 iburst
[root@linux-node2 ~]# timedatectl set-timezone Asia/Shanghai
[root@linux-node2 ~]# timedatectl status
      Local time: Wed 2018-03-07 03:19:51 CST
  Universal time: Tue 2018-03-06 19:19:51 UTC
        RTC time: Tue 2018-03-06 19:19:52
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@linux-node2 ~]# systemctl enable chronyd.service
[root@linux-node2 ~]# systemctl start  chronyd.service
[root@linux-node2 ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^? linux-node1                   0   7     0     -     +0ns[   +0ns] +/-    0ns
View Code

四、查看是否部署成功:

  1、在控制节点中查看注册的host,最后一个compute即是注册的host  

[root@linux-node1 ~]# openstack host list
+-------------+-------------+----------+
| Host Name   | Service     | Zone     |
+-------------+-------------+----------+
| linux-node1 | conductor   | internal |
| linux-node1 | consoleauth | internal |
| linux-node1 | cert        | internal |
| linux-node1 | scheduler   | internal |
| linux-node2 | compute     | nova     |
+-------------+-------------+----------+
View Code

  2、在控制节点中测试nova和glance连接正常,nova链接keystone是否正常

[root@linux-node1 ~]# nova image-list
WARNING: Command image-list is deprecated and will be removed after Nova 15.0.0 is released. Use python-glanceclient or openstackclient instead.
+--------------------------------------+--------+--------+--------+
| ID                                   | Name   | Status | Server |
+--------------------------------------+--------+--------+--------+
| 8f5837b4-bbec-4ef5-96f6-aba989c27206 | cirros | ACTIVE |        |
+--------------------------------------+--------+--------+--------+
[root@linux-node1 ~]# nova endpoints
/usr/lib/python2.7/site-packages/novaclient/v2/shell.py:4306: UserWarning: nova endpoints is deprecated, use openstack catalog list instead
  "nova endpoints is deprecated, use openstack catalog list instead")
WARNING: nova has no endpoint in ! Available endpoints for this service:
+-----------+--------------------------------------------------------------+
| nova      | Value                                                        |
+-----------+--------------------------------------------------------------+
| id        | 0a71c8fd893647b690c7574ca73ed9b9                             |
| interface | public                                                       |
| region    | RegionOne                                                    |
| region_id | RegionOne                                                    |
| url       | http://172.22.0.218:8774/v2/503b0eab0420454e909a46e476bf1ede |
+-----------+--------------------------------------------------------------+
+-----------+--------------------------------------------------------------+
| nova      | Value                                                        |
+-----------+--------------------------------------------------------------+
| id        | 5e99985fb4b14c3286d373e0b18dc311                             |
| interface | internal                                                     |
| region    | RegionOne                                                    |
| region_id | RegionOne                                                    |
| url       | http://172.22.0.218:8774/v2/503b0eab0420454e909a46e476bf1ede |
+-----------+--------------------------------------------------------------+
+-----------+--------------------------------------------------------------+
| nova      | Value                                                        |
+-----------+--------------------------------------------------------------+
| id        | d7b07484b2f4437388cd67eb1bccda47                             |
| interface | admin                                                        |
| region    | RegionOne                                                    |
| region_id | RegionOne                                                    |
| url       | http://172.22.0.218:8774/v2/503b0eab0420454e909a46e476bf1ede |
+-----------+--------------------------------------------------------------+
WARNING: glance has no endpoint in ! Available endpoints for this service:
+-----------+----------------------------------+
| glance    | Value                            |
+-----------+----------------------------------+
| id        | 2646c93f3cda442fb062887f6c510343 |
| interface | internal                         |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://172.22.0.218:9292         |
+-----------+----------------------------------+
+-----------+----------------------------------+
| glance    | Value                            |
+-----------+----------------------------------+
| id        | 5cc3112ed5944f04935805467ad36ec8 |
| interface | admin                            |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://172.22.0.218:9292         |
+-----------+----------------------------------+
+-----------+----------------------------------+
| glance    | Value                            |
+-----------+----------------------------------+
| id        | af6c4a21691344d7adfd6ec3e2d3674e |
| interface | public                           |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://172.22.0.218:9292         |
+-----------+----------------------------------+
WARNING: keystone has no endpoint in ! Available endpoints for this service:
+-----------+----------------------------------+
| keystone  | Value                            |
+-----------+----------------------------------+
| id        | 10f1ab0fe78c425d8cc4bfd058791fee |
| interface | admin                            |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://172.22.0.218:35357/v2.0   |
+-----------+----------------------------------+
+-----------+----------------------------------+
| keystone  | Value                            |
+-----------+----------------------------------+
| id        | 894040c4f3d044f0af4ecb7230d6cb75 |
| interface | public                           |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://172.22.0.218:5000/v2.0    |
+-----------+----------------------------------+
+-----------+----------------------------------+
| keystone  | Value                            |
+-----------+----------------------------------+
| id        | e8789e11929c447e87271748e316e727 |
| interface | internal                         |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://172.22.0.218:5000/v2.0    |
+-----------+----------------------------------+
View Code

 

    

posted on 2018-03-12 16:49  Steward_Xu  阅读(361)  评论(0编辑  收藏  举报