OpenStack 学习笔记(五):OpenStack nova服务搭建

——先决条件


1.)创建数据库

MariaDB [(none)]> CREATE DATABASE nova;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL ON nova.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘nova‘;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL ON nova.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘nova‘;  Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> CREATE DATABASE nova_api;Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> GRANT ALL ON nova_api.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘nova‘;  Query OK, 0 rows affected (0.02 sec)MariaDB [(none)]> GRANT ALL ON nova_api.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘nova‘;
Query OK, 0 rows affected (0.02 sec)

2.)Create the nova user

[[email protected] ~]# openstack user create --domain default --password nova nova
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 0b741c2e67ed4d618fa7e963325221ad |
| enabled   | True                             |
| id        | f059f5d68d8441f2ac506701c972221e |
| name      | nova                             |
+-----------+----------------------------------+

3.)Add the admin role to the nova user

[[email protected] ~]# openstack role add --project service --user nova admin

4.)Create the nova service entity

[[email protected] ~]# openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 6276582dd78040cbb125db6793bdfe5d |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+

5.)Create the Compute service API endpoints

[[email protected] ~]# openstack endpoint create --region RegionOne compute public http://192.168.100.120:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------------+
| Field        | Value                                          |
+--------------+------------------------------------------------+
| enabled      | True                                           |
| id           | 4982a6ccbef244148e6c15992a56185f               |
| interface    | public                                         |
| region       | RegionOne                                      |
| region_id    | RegionOne                                      |
| service_id   | 6276582dd78040cbb125db6793bdfe5d               |
| service_name | nova                                           |
| service_type | compute                                        |
| url          | http://192.168.100.120:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne compute internal http://192.168.100.120:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------------+
| Field        | Value                                          |
+--------------+------------------------------------------------+
| enabled      | True                                           |
| id           | 8a96cff800914256b6049e2d5e8ca913               |
| interface    | internal                                       |
| region       | RegionOne                                      |
| region_id    | RegionOne                                      |
| service_id   | 6276582dd78040cbb125db6793bdfe5d               |
| service_name | nova                                           |
| service_type | compute                                        |
| url          | http://192.168.100.120:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne compute admin http://192.168.100.120:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------------+
| Field        | Value                                          |
+--------------+------------------------------------------------+
| enabled      | True                                           |
| id           | 2dfbc5fcf3204aa9a7930024eaa90899               |
| interface    | admin                                          |
| region       | RegionOne                                      |
| region_id    | RegionOne                                      |
| service_id   | 6276582dd78040cbb125db6793bdfe5d               |
| service_name | nova                                           |
| service_type | compute                                        |
| url          | http://192.168.100.120:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------------+


——控制节点nova服务搭建配置


6.)安装nova服务

[[email protected] ~]# yum -y install openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient

7.)配置nova服务

[[email protected] ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[[email protected] ~]# vim /etc/nova/nova.conf
   1: [DEFAULT]
 141: my_ip=192.168.254.140
 265: enabled_apis=osapi_compute,metadata
 380: auth_strategy=keystone
1559: firewall_driver=nova.virt.firewall.NoopFirewallDriver
1682: use_neutron=true
1949: debug=true
2117: rpc_backend=rabbit
2158: [api_database]
2166: connection=mysql://nova:[email protected]:3306/nova_api
3103: [database]
3126: connection=mysql://nova:[email protected]:3306/nova
3320: [glance]
3352: api_servers=http://192.168.254.140:9292
3520: [keystone_authtoken]
3521: auth_uri = http://192.168.254.140:5000
3522: auth_url = http://192.168.254.140:35357
3523: memcached_servers = 192.168.254.140:11211
3524: auth_type = password
3525: project_domain_name = default
3526: user_domain_name = default
3527: project_name = service
3528: username = nova
3529: password = nova
4290: [oslo_concurrency]
4305: lock_path=/var/lib/nova/tmp
4401: [oslo_messaging_rabbit]
4456: rabbit_host=192.168.254.140
4462: rabbit_port=5672
4474: rabbit_userid=openstack
4478: rabbit_password=11111111
5355: [vnc]
5425: vncserver_listen=192.168.254.140
5449: vncserver_proxyclient_address=$my_ip

8.)同步数据库

[[email protected] ~]# nova-manage api_db sync
[[email protected] ~]# mysql -unova -pnova -e "use nova_api; show tables;"
+--------------------+
| Tables_in_nova_api |
+--------------------+
| build_requests     |
| cell_mappings      |
| flavor_extra_specs |
| flavor_projects    |
| flavors            |
| host_mappings      |
| instance_mappings  |
| migrate_version    |
| request_specs      |
+--------------------+
[[email protected] ~]# nova-manage db sync
[[email protected] ~]# mysql -unova -pnova -e "use 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_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                         |
+--------------------------------------------+

9.)Start the Compute services and configure start when the system boots

9.1) configure start when the system boots

[[email protected] ~]# systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service

9.2)start compute service

[[email protected] ~]# systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service

9.2)select compute service status

[[email protected] ~]# systemctl status openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[[email protected] ~]# netstat -antup|egrep ‘8774|6080‘
tcp        0      0 0.0.0.0:6080            0.0.0.0:*               LISTEN      6950/python2        
tcp        0      0 0.0.0.0:8774            0.0.0.0:*               LISTEN      6946/python2

10.)校验操作

[[email protected] ~]# openstack compute service list
+----+------------------+-----------+----------+---------+-------+----------------------------+
| Id | Binary           | Host      | Zone     | Status  | State | Updated At                 |
+----+------------------+-----------+----------+---------+-------+----------------------------+
|  1 | nova-scheduler   | openstack | internal | enabled | up    | 2016-05-26T07:06:29.000000 |
|  2 | nova-conductor   | openstack | internal | enabled | up    | 2016-05-26T07:06:29.000000 |
|  3 | nova-consoleauth | openstack | internal | enabled | up    | 2016-05-26T07:06:30.000000 |
+----+------------------+-----------+----------+---------+-------+----------------------------+


——计算节点nova服务搭建配置


1.同步时间

[[email protected] ~]# hostnamectl set-hostname OpenStack-Compute
[[email protected] ~]# su -
[[email protected] ~]# ntpdate pool.ntp.org

2.添加mitaka源

[[email protected] ~]# wget https://repos.fedorapeople.org/repos/openstack/openstack-mitaka/rdo-release-mitaka-3.noarch.rpm
[[email protected] ~]# yum install -y centos-release-openstack-mitaka
[[email protected] ~]# yum install -y rdo-release-mitaka-3.noarch.rpm
[[email protected] ~]# yum upgrade -y

3.添加hosts解析

[[email protected] ~]# echo -e "192.168.100.120\topenstack" >> /etc/hosts
[[email protected] ~]# echo -e "192.168.100.121\t$(uname -n)" >> /etc/hosts
[[email protected] ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.254.140 openstack
192.168.254.141 OpenStack-Computee

4.安装配置compute

[[email protected] ~]# yum install -y openstack-nova-compute
[[email protected] ~]# cp /etc/nova/nova.conf  /etc/nova/nova.conf.bak
[[email protected] ~]# vim /etc/nova/nova.conf
   1:[DEFAULT]
 141:my_ip=192.168.254.141
 380:auth_strategy=keystone
1559:firewall_driver=nova.virt.firewall.NoopFirewallDriver
1682:use_neutron=true
1949:debug=true
2117:rpc_backend=rabbit
3320:[glance]
3352:api_servers=http://192.168.254.140:9292
3520:[keystone_authtoken]
3521:auth_uri = http://192.168.254.140:5000
3522:auth_url = http://192.168.254.140:35357
3523:memcached_servers = 192.168.254.140:11211
3524:auth_type = password
3525:project_domain_name = default
3526:user_domain_name = default
3527:project_name = service
3528:username = nova
3529:password = nova
4290:[oslo_concurrency]
4305:lock_path=/var/lib/nova/tmp
4401:[oslo_messaging_rabbit]
4456:rabbit_host=192.168.254.140
4462:rabbit_port=5672
4474:rabbit_userid=openstack
4478:rabbit_password=11111111
5355:[vnc]
5383:enabled=true
5425:vncserver_listen=192.168.254.140
5449:vncserver_proxyclient_address=$my_ip
5530:novncproxy_base_url=http://192.168.254.140:6080/vnc_auto.html

5.)查看硬件是否支持kvm

[[email protected] ~]# egrep -c ‘(vmx|svm)‘ /proc/cpuinfo
1

6.)start libvirtd and openstack-nova-compute

[[email protected] ~]# systemctl enable libvirtd.service openstack-nova-compute.service
[[email protected] ~]# systemctl start libvirtd.service openstack-nova-compute.service

7.)校验检查


7.1)在控制节点检查compute注册信息和状态

[[email protected] ~]# openstack compute service list
+----+------------------+--------------------+----------+---------+-------+----------------------------+
| Id | Binary           | Host               | Zone     | Status  | State | Updated At                 |
+----+------------------+--------------------+----------+---------+-------+----------------------------+
|  1 | nova-consoleauth | openstack          | internal | enabled | up    | 2016-05-30T08:20:33.000000 |
|  2 | nova-conductor   | openstack          | internal | enabled | up    | 2016-05-30T08:20:32.000000 |
|  3 | nova-scheduler   | openstack          | internal | enabled | up    | 2016-05-30T08:20:33.000000 |
|  7 | nova-compute     | OpenStack-Computee | nova     | enabled | up    | 2016-05-30T08:20:29.000000 |
+----+------------------+--------------------+----------+---------+-------+----------------------------+
时间: 2024-10-12 22:58:08

OpenStack 学习笔记(五):OpenStack nova服务搭建的相关文章

openstack学习笔记五 多节点部署之 rabbitmq信息中枢与元数据

元数据 rabbitmq信息中枢 rabbitmq信息中枢 所有组件通信的时候 实用 AMQP 高级消息队列 qpid rabbitmq    端口5672       sll加密 5671 192.168.1.201       h1.hequan.com     h1 192.168.1.202       h2.hequan.com     h2 192.168.1.203       h3.hequan.com     h3 在h3上操作  配置YUM源   把openstack软件包上

OpenStack 学习笔记

1 安装 2 管理 3 监控 书籍推荐:OpenStack Cloud Computing Cookbook OpenStack 学习笔记

Sharepoint2013搜索学习笔记之创建搜索服务(二)

第一步,进入管理中心,点击管理服务器上的服务 第二步,在服务器上选择需要承载搜索服务的服务器,并启动服务列表上的sharepoint server search 第三步,从管理中心进入管理服务应用程序 第四步,新建search service application 第五步,在弹出的新建窗口分别填好相应信息点击确定,主要注意的是 应用程序池可以选择已经有的,也可以自己填一个新的名称,选择填写新的之后,程序会在稍后新建一个应用程序池,一般推荐新建应用程序池. 默认情况,爬网组件会用配置好的搜索服务

Android学习笔记五之Service

Android学习笔记五之Service 1.什么是Service? 什么是Service?Service是Android系统的四大组件之一,官方文档是这样描述Service的: A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application comp

Caliburn.Micro学习笔记(五)----协同IResult

Caliburn.Micro学习笔记(五)----协同IResult 今天说一下协同IResult 看一下IResult接口 /// <summary> /// Allows custom code to execute after the return of a action. /// </summary> public interface IResult { /// <summary> /// Executes the result using the specif

Go语言学习笔记(一) : 搭建Windows下的Go开发环境

最近突然对Go语言产生了兴趣,主要是因为在使用python的时候遇到了一些不爽的问题,然后发现了Go.Go是Google出的一个动态语言,语法和C++接近,性能也非常的好,而且还支持编译成exe发布,并且不依赖任何虚拟机(其实是打包在exe里面了),这种好语言怎么能够错过?所以便一时兴起,开始学习了起来.由于本人还处于异常小白的阶段,所以文章中可能不免有些错误,欢迎大家各种指正. 安装Go 前往Go语言的官方网站:http://golang.org/, 下载对应平台的安装包.如果是x86的系统可

angular学习笔记(五)-阶乘计算实例(1)

<!DOCTYPE html> <html ng-app> <head> <title>2.3.2计算阶乘实例1</title> <meta charset="utf-8"> <script src="../angular.js"></script> <script src="script.js"></script> </

NLTK学习笔记(五):分类和标注词汇

[TOC] 词性标注器 之后的很多工作都需要标注完的词汇.nltk自带英文标注器pos_tag import nltk text = nltk.word_tokenize("And now for something compleyely difference") print(text) print(nltk.pos_tag(text)) 标注语料库 表示已经标注的标识符:nltk.tag.str2tuple('word/类型') text = "The/AT grand/J

Linux System Programming 学习笔记(五) 进程管理

1. 进程是unix系统中两个最重要的基础抽象之一(另一个是文件) A process is a running program A thread is the unit of activity inside of a process the virtualization of memory is associated with the process, the threads all share the same memory address space 2. pid The idle pro