• OpenStack集群部署——计算节点neutron节点部署(三)


    五、创建Glance

    5.1 创建数据库

    #控制节点
    mysql -u root -p
    CREATE DATABASE glance;
    #对``glance``数据库授予恰当的权限:
    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
      IDENTIFIED BY 'GLANCE_DBPASS';
    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
      IDENTIFIED BY 'GLANCE_DBPASS';
     
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    #获得 admin 凭证来获取只有管理员能执行的命令的访问权限:
    . admin-openrc
    
    • 1
    • 2

    5.2 创建服务证书

    5.2.1 创建glance用户并关联角色
    openstack user create --domain default --password GLANCE_PASS glance
    openstack role add --project service --user glance admin
    
    • 1
    • 2
    5.2.2 创建服务实体和后端APi
    openstack service create --name glance \
      --description "OpenStack Image" image
    openstack endpoint create --region RegionOne \
      image public http://controller:9292
    openstack endpoint create --region RegionOne \
      image internal http://controller:9292
    openstack endpoint create --region RegionOne \
      image admin http://controller:9292
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    5.2.3 安装软件
    yum install openstack-glance -y
    
    • 1
    5.2.4 自动配置
    #配置glance-api.conf
    cp /etc/glance/glance-api.conf{
       ,.bak}
    grep '^[a-Z\[]' /etc/glance/glance-api.conf.bak >/etc/glance/glance-api.conf
    openstack-config --set /etc/glance/glance-api.conf  database  connection  mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
    openstack-config --set /etc/glance/glance-api.conf  glance_store stores  file,http
    openstack-config --set /etc/glance/glance-api.conf  glance_store default_store  file
    openstack-config --set /etc/glance/glance-api.conf  glance_store filesystem_store_datadir  /var/lib/glance/images/
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken auth_uri  http://controller:5000
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken auth_url  http://controller:35357
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken memcached_servers  controller:11211
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken auth_type  password
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken project_domain_name  default
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken user_domain_name  default
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken project_name  service
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken username  glance
    openstack-config --set /etc/glance/glance-api.conf  keystone_authtoken password  GLANCE_PASS
    openstack-config --set /etc/glance/glance-api.conf  paste_deploy flavor  keystone
    #配置glance-registry.conf
    cp /etc/glance/glance-registry.conf{
       ,.bak}
    grep '^[a-Z\[]' /etc/glance/glance-registry.conf.bak > /etc/glance/glance-registry.conf
    openstack-config --set /etc/glance/glance-registry.conf  database  connection  mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken auth_uri  http://controller:5000
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken auth_url  http://controller:35357
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken memcached_servers  controller:11211
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken auth_type  password
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken project_domain_name  default
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken user_domain_name  default
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken project_name  service
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken username  glance
    openstack-config --set /etc/glance/glance-registry.conf  keystone_authtoken password  GLANCE_PASS
    openstack-config --set /etc/glance/glance-registry.conf  paste_deploy flavor  keystone
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    5.2.5 同步数据
    su -s /bin/sh -c "glance-manage db_sync" glance
    #验证
    mysql -e 'use glance;show tables;'
    
    • 1
    • 2
    • 3
    2.14.7 启动
    systemctl enable openstack-glance-api.service \
      openstack-glance-registry.service
    systemctl start openstack-glance-api.service \
      openstack-glance-registry.service
    #验证tcp端口
    netstat -lntp|grep -E '9191|9292'
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    2.14.8
    #下载镜像
    wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
    #上传镜像
    openstack image create "cirros" \
      --file cirros-0.3.4-x86_64-disk.img \
      --disk-format qcow2 --container-format bare \
      --public
    #查看镜像
    openstack image list
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    六、nova计算服务

    nova-api:接受并响应所有的计算服务请求,管理虚拟机(云主机)生命周期
    nova-compute (多个)):真正管理虚拟机(nova-compute调用libvist)
    nova-scheduler:nova调度器(挑选出最合适的nova-compute来创建虚机)
    nova-conductor:帮助nova-compute代理修改数据库中虚拟机的状态
    nova-network:早期openstack版本管理虚拟机的网络(已弃用,neutron)
    nova-consoleauth和nova-novncproxy: web版的vnc来直接操作云主机
    novncproxy:web版vnc客户端
    nova-api-metadata:接受来自虚拟机发送的元数据请求

    6.1 创建数据库

    #控制节点
    ##创建数据库并授权
    CREATE DATABASE nova_api;
    CREATE DATABASE nova;
    GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
      IDENTIFIED BY 'NOVA_DBPASS';
    GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
      IDENTIFIED BY 'NOVA_DBPASS';
    GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
      IDENTIFIED BY 'NOVA_DBPASS';
    GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
      IDENTIFIED BY 'NOVA_DBPASS';
    
    . admin-openrc
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    6.2 创建nova用户并关联角色

    openstack user create --domain default \
      --password NOVA_PASS nova
    openstack role add --project service --user nova admin
    
    openstack service create --name nova \
      --description "OpenStack Compute" compute
    openstack endpoint create --region RegionOne \
      compute public http://controller:8774/v2.1/%\(tenant_id\)s
    openstack endpoint create --region RegionOne \
      compute internal http://controller:8774/v2.1/%\(tenant_id\)s
    openstack endpoint create --region RegionOne \
      compute admin http://controller:8774/v2.1/%\(tenant_id\)s
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    6.3 安装软件

    yum install openstack-nova-api openstack-nova-conductor \
      openstack-nova-console openstack-nova-novncproxy \
      openstack-nova-scheduler -y
    
    • 1
    • 2
    • 3

    6.4 自动配置

    #
    cp /etc/nova/nova.conf{
       ,.bak}
    #
    grep '^[a-Z\[]' /etc/nova/nova.conf.bak >/etc/nova/nova.conf
    #
    openstack-config --set /etc/nova/nova.conf  DEFAULT enabled_apis  osapi_compute,metadata
    openstack-config --set /etc/nova/nova.conf  DEFAULT rpc_backend  rabbit
    openstack-config --set /etc/nova/nova.conf  DEFAULT auth_strategy  keystone
    openstack-config --set /etc/nova/nova.conf  DEFAULT my_ip  10.0.0.11
    openstack-config --set /etc/nova/nova.conf  DEFAULT use_neutron  True
    openstack-config --set /etc/nova/nova.conf  DEFAULT firewall_driver  nova.virt.firewall.NoopFirewallDriver
    openstack-config --set /etc/nova/nova.conf  api_database connection  mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
    openstack-config --set /etc/nova/nova.conf  database  connection  mysql+pymysql://nova:NOVA_DBPASS@controller/nova
    openstack-config --set /etc/nova/nova.conf  glance api_servers  http://controller:9292
    openstack-config --set /etc/nova/nova.conf  keystone_authtoken  auth_uri  http://controller:5000
    openstack-config --set /etc/nova/nova.conf  keystone_authtoken  auth_url  http://controller:35357
    openstack-config --set /etc/nova/nova.conf  keystone_authtoken  memcached_servers  controller:11211
    openstack-config --set /etc/nova/nova.conf  keystone_authtoken  auth_type  password
    openstack-config --set /etc/nova/nova.conf  keystone_authtoken  project_domain_name  default
    openstack-config --set /etc/nova/nova.conf  keystone_authtoken  user_domain_name  default
    openstack-config 
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
  • 相关阅读:
    纳尼?华为首席架构师只用434页笔记,就将网络协议给拿下了
    Halcon学习---光学字符识别(OCR)
    Android开发之科大讯飞语音合成与播报
    webpack中devServer节点的使用
    Leetcode 891. 子序列宽度之和
    【物理应用】基于Matlab模拟高精度轨道传播器
    数仓建模,什么是宽表?如何设计?好处与不足
    Selenium-三大等待和四大操作
    Spring Security:身份验证入口AuthenticationEntryPoint介绍与Debug分析
    WireShark抓包软件的使用 上海商学院 计算机网络 实验作业3
  • 原文地址:https://blog.csdn.net/benziwu/article/details/128124441