• openstack搭建之-glance配置(9)


     

    一、 base节点配置

    #设置数据库,创建glance数据库,并设置权限

    mysql -u root -proot

    CREATE DATABASE glance;

    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';

    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';

    二、 ctrl节点配置

    #运行变量

    . admin-openrc

     

    #创建用户glance、角色为admin

    openstack user create --domain default --password GLANCE_PASS glance

    openstack role add --project service --user glance admin

     

    #创建glance服务并设置endpoint

    openstack service create --name glance --description "OpenStack Image" image

    openstack endpoint create --region RegionOne image public http://ctrl.test.com:9292

    openstack endpoint create --region RegionOne image internal http://ctrl.test.com:9292

    openstack endpoint create --region RegionOne image admin http://ctrl.test.com:9292

     

    #安装镜像软件并编辑glance-api配置文件

    yum install openstack-glance -y

    vim /etc/glance/glance-api.conf

    [database]
    connection = mysql+pymysql://glance:GLANCE_DBPASS@base.test.com/glance
    
    [keystone_authtoken]
    auth_uri = http://ctrl.test.com:5000
    auth_url = http://ctrl.test.com:35357
    memcached_servers = base.test.com:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = glance
    password = GLANCE_PASS
    
    [paste_deploy]
    flavor = keystone
    
    [glance_store]
    stores = file,http
    default_store = file
    filesystem_store_datadir = /var/lib/glance/images/

     

    #编辑glance-registry的注册配置文件

    vim  /etc/glance/glance-registry.conf

    [database]
    connection = mysql+pymysql://glance:GLANCE_DBPASS@base.test.com/glance
     
    
    [keystone_authtoken]
    auth_uri = http://ctrl.test.com:5000
    auth_url = http://ctrl.test.com:35357
    memcached_servers = base.test.com:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = glance
    password = GLANCE_PASS
    
    
    [paste_deploy]
    flavor = keystone

     

    #初始化镜像数据库(21个数据表)

    su -s /bin/sh -c "glance-manage db_sync" glance

     

    #启动服务

    systemctl restart openstack-glance-api.service

    systemctl restart openstack-glance-registry.service

     

    systemctl enable openstack-glance-api.service

    systemctl enable openstack-glance-registry.service

     

    #运行变量

    . admin-openrc

     

    #下载镜像

    wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img

    scp root@172.16.3.1:/var/lib/libvirt/image/chen.qcow2 /root/

     

    openstack image create "cirros"

    --file cirros-0.3.5-x86_64-disk.img

    --disk-format qcow2 --container-format bare

    --public

     

    openstack image create "chen"

    --file chen.qcow2

    --disk-format qcow2 --container-format bare

    --public

     

    #查看image镜像:openstack image list

  • 相关阅读:
    虚拟机docker开启服务,本地无法进行访问
    make编译提示:make cc Command not found 解决办法
    yum -y install git 无法安装...提示There are no enabled repos.
    linux 安装mysql
    linux 配置环境变量
    HTML5第三天 无序有序列表、相对绝对路径
    JavaScript第一天
    HTML第二天
    mysql流程控制语句
    mysql存储过程和函数
  • 原文地址:https://www.cnblogs.com/chenli90/p/10351516.html
Copyright © 2020-2023  润新知