-
若是要安裝的系統多了效率就很低
-
時間長,工做量大
-
安裝完還要進行手工配置,好比安裝其餘的軟件,設置 IP 等
-
備份和恢復系統不靈活
-
先手工安裝好這麼一個虛機
-
而後對虛機執行 snapshot,這樣就獲得了一個 image
-
當有新員工入職須要辦公環境時,立馬啓動一個或多個該 image 的 instance(虛機)就能夠了
-
提供 REST API 讓用戶可以查詢和獲取 image 的元數據和 image 自己
-
支持多種方式存儲 image,包括普通的文件系統、Swift、Amazon S3 等
-
對 Instance 執行 Snapshot 建立新的 image
glance-api
glance-registry
Database
Store backend
-
A directory on a local file system(這是默認配置)
-
GridFS
-
Ceph RBD
-
Amazon S3
-
Sheepdog
-
OpenStack Block Storage (Cinder)
-
OpenStack Object Storage (Swift)
-
VMware ESX
[DEFAULT] [cors] [cors.subdomain] [database] connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/ [image_format] [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = glance [matchmaker_redis] [oslo_concurrency] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [paste_deploy] flavor = keystone [profiler] [store_type_location_strategy] [task] [taskflow_executor]
vim /etc/glance/glance-registry.confhtml
[DEFAULT] [database] connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = glance [matchmaker_redis] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_policy] [paste_deploy] flavor = keystone [profiler]
布建openstack的glance node
1. mysql -u root -pmysql
2. CREATE DATABASE glance;redis
3.sql
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \ IDENTIFIED BY '123';shell
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \ IDENTIFIED BY '123';數據庫
3.source openrcapache
建立用戶 設置角色 設置服務 建立三種服務端點vim
(internal內部 admin管理 public公共)後端
4. 退出數據庫 建立 glance用戶 domain項目
openstack user create --domain default --password=glance glance
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | bcaefe90e2ce41879fde9c81332a2229 |
| name | glance |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
5把glance的用戶 設置在service的項目中 設置admin的權限管理員
openstack role add --project service --user glance admin
6.建立服務
openstack service create --name glance \ --description "OpenStack Image" image
問題解決
[root@node1 ~]# openstack endpoint create --region RegionOne \
> image internal http://node1:9292
Missing value auth-url required for auth plugin password
[root@node1 ~]# source openrc
7建立服務端點
openstack endpoint create --region RegionOne \
image public http://node1:9292
服務端點列表 顯示兩種方式
1 openstack endpoint list
2 openstack catalog list
刪除不要的服務端點
openstack endpoint delete 加上ID 號
8 建立內部服務端點
openstack endpoint create --region RegionOne \ image internal http://node1:9292
9 建立管理端點
openstack endpoint create --region RegionOne \ image admin http://node1:9292
openstack endpoint list 有3個glance
10 yum install openstack-glance -y
11 cd /etc/glance/
ls
LL
修改這兩個配置文件 注意屬主 屬組
cp glance-api.conf glance-api.conf.beifen 備份一根文件進行修改
cp glance-rgistry.conf glance-registry.conf.beifen
12 以前的所有刪除掉
vim glance-api.conf glance—store 進行後臺存儲
[DEFAULT]
[cors]
[cors.subdomain]
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@node1/glance
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[image_format]
[keystone_authtoken]
auth_uri = http://node1:5000
auth_url = http://node1:35357
memcached_servers = node1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[paste_deploy] 認證模板
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
13 以前的所有刪除掉
vim glance-rgistry.conf 元數據有關的工做交給rgistry
[DEFAULT]
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@node1/glance
[keystone_authtoken]
auth_uri = http://node1:5000
auth_url = http://node1:35357
memcached_servers = node1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[matchmaker_redis]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
14 導入表內容同步數據庫
su -s /bin/sh -c "glance-manage db_sync" glance
15 glance-api glance-registry 開機自啓
# systemctl enable openstack-glance-api.service \ openstack-glance-registry.service # systemctl start openstack-glance-api.service \ openstack-glance-registry.service
查看狀態
# systemctl status openstack-glance-api.service \ openstack-glance-registry.service # systemctl status openstack-glance-api.service \ openstack-glance-registry.service
建立鏡像
16 wget http://download2.yunwei.edu/shell/openstack_app.tar.gz
17 ls
[root@node1 ~]# ls
1234.txt 2 3 5 7 9 apache-tomcat-9.0.20.zip openstack_app.tar.gz pjh.txt
1.txt 2.txt 4 6 8 anaconda-ks.cfg openrc openstack-ocata yum-repo.sh
18 tar zxf openstack_app.tar.gz
19 ls
[root@node1 openstack-ocata]# ls
cirros-0.3.3-x86_64-disk.img openstack-compute-yilai
20 openstack image create "cirros" \ --file cirros-0.3.3-x86_64-disk.img \ --disk-format qcow2 --container-format bare \ --public
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 133eae9fb1c98f45894a4e60d8736619 |
| container_format | bare |
| created_at | 2019-08-03T01:22:51Z |
| disk_format | qcow2 |
| file | /v2/images/6a99c72d-e083-471d-a6f7-787cd05f8e56/file |
| id | 6a99c72d-e083-471d-a6f7-787cd05f8e56 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | 77539b5d86c6419d88e99140ed0f84a1 |
| protected | False |
| schema | /v2/schemas/image |
| size | 13200896 |
| status | active |
| tags | |
| updated_at | 2019-08-03T01:22:52Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
21 openstack image list
glance image-list