zoukankan      html  css  js  c++  java
  • 基于OpenStack构建企业私有云(3)Glance

    1.安装Glance

    [root@linux-node1 ~]# yum install -y openstack-glance


    2.Glance数据库配置

    Glance-api.conf

    [root@linux-node1 ~]# vim /etc/glance/glance-api.conf
    [database]
    connection= mysql+pymysql://glance:glance@192.168.56.11/glance


    glance-registry.conf

    [root@linux-node1 ~]# vim /etc/glance/glance-registry.conf
    [database]
    connection= mysql+pymysql://glance:glance@192.168.56.11/glance



    3.设置Keystone

    [root@linux-node1 ~]# vim /etc/glance/glance-api.conf
    [keystone_authtoken]
    auth_uri = http://192.168.56.11:5000
    auth_url = http://192.168.56.11:35357
    memcached_servers = 192.168.56.11:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = glance
    password = glance
    
    [paste_deploy]
    flavor=keystone


    glance-registry.conf配置

    [root@linux-node1 ~]# vim /etc/glance/glance-registry.conf
    [keystone_authtoken]
    auth_uri = http://192.168.56.11:5000
    auth_url = http://192.168.56.11:35357
    memcached_servers = 192.168.56.11:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = glance
    password = glance
    
    [paste_deploy]
    flavor=keystone


    4.设置Glance镜像存储

    [root@linux-node1 ~]# vim /etc/glance/glance-api.conf
    [glance_store]
    stores = file,http
    default_store=file
    filesystem_store_datadir=/var/lib/glance/images/


    5.同步数据库

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


    6.启动Glance服务

    # systemctl enable openstack-glance-api.service
    # systemctl enable openstack-glance-registry.service
    # systemctl start openstack-glance-api.service
    # systemctl start openstack-glance-registry.service


    7.Glance服务注册
       想要让别的服务可以使用Glance,就需要在Keystone上完成服务的注册。注意需要先source一下admin的环境变量。

    [root@linux-node1 ~]# source admin-openstack.sh
    # openstack service create --name glance --description "OpenStack Image service" image
    # openstack endpoint create --region RegionOne   image public http://192.168.56.11:9292
    # openstack endpoint create --region RegionOne   image internal http://192.168.56.11:9292
    # openstack endpoint create --region RegionOne   image admin http://192.168.56.11:9292


    8.测试Glance状态

    [root@linux-node1 ~]# source admin-openstack.sh
    [root@linux-node1 ~]# openstack image list


    9.Glance镜像
    在刚开始实施OpenStack平台阶段,如果没有制作镜像。可以使用一个实验的镜像进行测试,这是一个小的Linux系统。

    [root@linux-node1 ~]# cd /usr/local/src
    [root@linux-node1 src]# wget http://download.cirros-cloud.n ... k.img
    
    [root@linux-node1 src]# openstack image create "cirros" --disk-format qcow2 
    --container-format bare --file cirros-0.3.5-x86_64-disk.img --public
    [root@linux-node1 src]# openstack image list
    +--------------------------------------+--------+--------+
    | ID                                   | Name   | Status |
    +--------------------------------------+--------+--------+
    | cf154a84-a73a-451b-bcb3-83c98e7c0d3e | cirros | active |
    +--------------------------------------+--------+--------+
  • 相关阅读:
    【2020-08-30】盼头这事,还是得有一点好
    【一句日历】2020年9月
    【2020-08-29】边走边想吧,少年
    【2020-08-28】欲望与能力的矛盾假象
    【2020-08-27】人生十三信条
    【2020-08-26】日复一日,年复一年
    【2020-08-25】今天七夕,男人有话要说
    【2020-08-24】处处较真,其实就是自己虚荣
    【2020-08-23】人生十三信条
    【2020-08-22】人生十三信条
  • 原文地址:https://www.cnblogs.com/zhanghn8/p/11278189.html
Copyright © 2011-2022 走看看