设为首页 收藏本站
查看: 567|回复: 0

[经验分享] OpenStack 学习笔记(五):OpenStack nova服务搭建

[复制链接]
发表于 2018-6-1 09:15:59 | 显示全部楼层 |阅读模式
  ——先决条件
  
  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
[root@openstack ~]# 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
[root@openstack ~]# openstack role add --project service --user nova admin  
  
  4.)Create the nova service entity
[root@openstack ~]# 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
  
[root@openstack ~]# 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 |
+--------------+------------------------------------------------+
[root@openstack ~]# 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 |
+--------------+------------------------------------------------+
[root@openstack ~]# 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服务
[root@openstack ~]# 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服务
  
[root@openstack ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[root@openstack ~]# 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:nova@localhost:3306/nova_api
3103: [database]
3126: connection=mysql://nova:nova@localhost: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.)同步数据库
  
[root@openstack ~]# nova-manage api_db sync
[root@openstack ~]# 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      |
+--------------------+
[root@openstack ~]# nova-manage db sync
[root@openstack ~]# 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

  
[root@openstack ~]# 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
  
[root@openstack ~]# 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

[root@openstack ~]# systemctl status \
openstack-nova-api.service \
openstack-nova-consoleauth.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
[root@openstack ~]# 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.)校验操作

[root@openstack ~]# 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.同步时间
[root@OpenStack-Compute ~]# hostnamectl set-hostname OpenStack-Compute
[root@OpenStack-Compute ~]# su -
[root@OpenStack-Compute ~]# ntpdate pool.ntp.org  2.添加mitaka源
[root@OpenStack-Compute ~]# wget https://repos.fedorapeople.org/repos/openstack/openstack-mitaka/rdo-release-mitaka-3.noarch.rpm
[root@OpenStack-Compute ~]# yum install -y centos-release-openstack-mitaka
[root@OpenStack-Compute ~]# yum install -y rdo-release-mitaka-3.noarch.rpm
[root@OpenStack-Compute ~]# yum upgrade -y  3.添加hosts解析
[root@OpenStack-Compute ~]# echo -e "192.168.100.120\topenstack" >> /etc/hosts
[root@OpenStack-Compute ~]# echo -e "192.168.100.121\t$(uname -n)" >> /etc/hosts
[root@OpenStack-Compute ~]# 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
[root@OpenStack-Compute ~]# yum install -y openstack-nova-compute
[root@OpenStack-Compute ~]# cp /etc/nova/nova.conf  /etc/nova/nova.conf.bak
[root@OpenStack-Compute ~]# 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
  
[root@OpenStack-Compute ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
1  6.)start libvirtd and openstack-nova-compute
[root@OpenStack-Compute ~]# systemctl enable libvirtd.service openstack-nova-compute.service
[root@OpenStack-Compute ~]# systemctl start libvirtd.service openstack-nova-compute.service  

  7.)校验检查
  
  7.1)在控制节点检查compute注册信息和状态
[root@openstack ~]# 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 |
+----+------------------+--------------------+----------+---------+-------+----------------------------+  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-496832-1-1.html 上篇帖子: 从零构建OpenStack(1) 云计算相关概念及OpenStack介绍 下篇帖子: OpenStack 学习笔记(七):OpenStack Dashboard服务搭建配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表