• OpenStack Trail 部署文档(四)部署Glance服务


    镜像服务Glance

    官方文档:https://docs.openstack.org/glance/train/install/ 

    1、初始化数据库

    MariaDB [(none)]> CREATE DATABASE glance;
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance123';

    2、创建glance用户:

    [root@openstack-controller ~]# openstack user create --domain default --password-prompt glance 
    User Password: glance
    Repeat User Password: glance

    3、创建服务并加入service项目:

    [root@openstack-controller ~]# openstack role add --project service --user glance admin
    [root@openstack-controller ~]# openstack service create --name glance --description "OpenStack Image" image

    4、创建endpoint:

    [root@openstack-controller ~]# openstack endpoint create --region RegionOne image public http://openstack-controller.local:9292 
    [root@openstack-controller ~]# openstack endpoint create --region RegionOne image internal http://openstack-controller.local:9292 
    [root@openstack-controller ~]# openstack endpoint create --region RegionOne image admin http://openstack-controller.local:9292

    5、安装glance软件包

    [root@openstack-controller ~]# yum install openstack-glance

    6、配置glance:/etc/glance/glance-api.conf

    [database]
    connection = mysql+pymysql://glance:glance123@openstack-controller.local/glance
    ......
    [glance_store]
    stores = file
    default_store = file
    filesystem_store_datadir = /var/lib/glance/images/
    ......
    [keystone_authtoken]
    www_authenticate_uri  = http://openstack-controller.itcast.cn:5000
    auth_url = http://openstack-controller.itcast.cn:5000
    memcached_servers = openstack-controller.itcast.cn:11211
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = service
    username = glance 
    password = glance 
    ......
    [paste_deploy]
    flavor = keystone 

    7、初始化数据库

    [root@openstack-controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance

    8、启动glance服务

    [root@openstack-controller ~]# systemctl enable openstack-glance-api.service 
    [root@openstack-controller ~]# systemctl start openstack-glance-api.service

    重启方法:systemctl restart openstack-glance-api.service
    镜像存放路径:/var/lib/glance/images/
    日志存放路径:/var/log/glance/api.log

    创建镜像:

    [root@openstack-controller ~]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
    [root@openstack-controller ~]# glance image-create --name "cirros-0.4.0" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public

        * --name:指定镜像名称
        * --file:指定镜像文件
        * --disk-format:指定镜像格式
        * --container-format:指定磁盘类型
        * --visibility:指定镜像访问方式

  • 相关阅读:
    如何将数组初始化为全0?
    什么是优先级队列(priority queue)?
    C语言中指针的指针是如何工作的?
    什么是队列(Queue)?
    理解*ptr++
    【Luogu】P4172水管局长(LCT)
    【Luogu】P4159迷路(矩阵优化)
    【Luogu】P3971Alice And Bob(贪心)
    【Luogu】P3211XOR和路径(高斯消元)
    【Luogu】P2445动物园(最大流)
  • 原文地址:https://www.cnblogs.com/wubolive/p/14417468.html
Copyright © 2020-2023  润新知