OpenStack Mirror Service Glance [3]
OpenStack Mirror Service Glance [3]
OpenStack Mirror Service Glance [3]
Openstack
Time: November 28, 2016
Introduction to OpenStack mirroring service Glance
To create a virtual machine, we need to have the support of glance, because glance provides mirroring service.
Glance has two more important services
Glance-api accepts requests for building, deleting and reading cloud system images.
Image Registration Service for Glance-Registry Cloud system
We need to configure glance-api configuration file and glance-registry configuration file
Glance does not need to configure message queuing, but glance needs to configure keystone (Certification Authority)
Tip: uploading images are stored under / var/lib/glance/p_w_picpaths by default.
Install glance
Create the database and wear the glance user on keystone. We have created it.
Install the package
[root@linux-node1 ~] # yum install openstack-glance-y
Modify database address
[root@linux-node1 ~] # vim / etc/glance/glance-api.conf [database]... Connection = mysql+pymysql://glance:glance@192.168.56.11/glance... [root@linux-node1 ~] # vim / etc/glance/glance-registry.conf [database]... Connection = mysql+pymysql://glance:glance@192.168.56.11/glance... # Open the comment and write the mysql address. Note that it is under the database default.
After the modification, we need to synchronize the database
[root@linux-node1] # su-s / bin/sh-c "glance-manage db_sync" glance# creates the table structure for us. It doesn't matter if openstack has a warning, as long as it's not error.
After synchronizing the database, we check.
[root@linux-node1] # mysql-h 192.168.56.11-u glance-pglance-e "use glance;show tables "+-- + | Tables_in_glance | +-+ | artifact_blob_locations | | artifact_blobs | | artifact_dependencies | | artifact_ Properties | | artifact_tags | | artifacts | | p_w_picpath_locations | | p_w_picpath_members | | p_w_picpath_properties | | p_w_picpath_tags | | p_w_picpaths | | metadef_namespace_resource_types | | metadef_namespaces | | metadef_objects | | metadef_properties | | metadef_resource_types | | metadef_tags | | migrate_version | | task_info | | tasks | +-| -+
We need to make sure that the database can be synchronized
Set up keystone
Set up in [keystone_authtoken]
[root@linux-node1] # vim / etc/glance/glance-api.conf... [keystone_authtoken] auth_uri = http://192.168.56.11:5000auth_url = http://192.168.56.11:35357memcached_servers = 192.168.56.11:11211auth_type = password # Verification type is password project_domain_name = default # default domain user_domain_name = default # user default domain project_name = service # Project name username = glance # user password = glance # password
Tip: it must be copied under [keystone_authtoken] module, otherwise it will not take effect.
You also need to set up the [paste_deploy] module
[paste_deploy] flavor = keystone# remove the comment and change it to keystone
Set registry, which is the same as api
[root@linux-node1] # vim / etc/glance/glance-registry.conf... [keystone_authtoken] auth_uri = http://192.168.56.11:5000auth_url = http://192.168.56.11:35357memcached_servers = 192.168.56.11:11211auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = glance... [paste_deploy] flavor = keystone
Configure the mirror path
Configure local file system storage and mirror file locations in glance-api
[root@linux-node1] # vim / etc/glance/glance-api.conf... [glance_store] stores = file,httpdefault_store = filefilesystem_store_datadir = / var/lib/glance/p_w_picpaths# all the above configurations can be done by opening the comments
Check
Glance-api configuration file configuration summary:
[root@linux-node1 ~] # grep'^ [Amurz]'/ etc/glance/glance-api.conf connection = mysql+pymysql://glance:glance@192.168.56.11/glancestores = file Httpdefault_store = filefilesystem_store_datadir = / var/lib/glance/p_w_picpathsauth_uri = http://192.168.56.11:5000auth_url = http://192.168.56.11:35357memcached_servers = 192.168.56.11:11211auth_type = password project_domain_name = default user_domain_name = defaultproject_name = service username = glancepassword = glanceflavor = keystone
The registry configuration is as follows
[root@linux-node1 ~] # grep'^ [a Murz]'/ etc/glance/glance-registry.conf connection = mysql+pymysql://glance:glance@192.168.56.11/glanceauth_uri = http://192.168.56.11:5000auth_url = http://192.168.56.11:35357memcached_servers = 192.168.56.11:11211auth_type = password project_domain_name = defaultuser_domain_name = default project_name = service username = glance Password = glance flavor = keystone hint: the configuration of registry and api is the same as mine. Now we can start.
Set to enable startup and enable the service
[root@linux-node1 ~] # systemctl enable openstack-glance-api.service [root@linux-node1 ~] # systemctl enable openstack-glance-registry.service [root@linux-node1 ~] # systemctl start openstack-glance-api.service [root@linux-node1 ~] # systemctl start openstack-glance-registry.service
Tip: 9292 is the port of glance-api and 9191 is the port of glance-registry
Set up service registration on keystone
1. Create a service
[root@linux-node1 ~] # source admin-openstack.sh [root@linux-node1 ~] # openstack service create-- name glance-- description "OpenStack Image" paired wayward picpathogical Mustang Luli + | Field | Value | +- -+-+ | description | OpenStack Image | | enabled | True | | id | c9fd28645efe45faa2a9cf2f2cce623e | | name | glance | | type | p_w_picpath | | +-+-+ |
two。 Create an API endpoint for the mirrored service
[root@linux-node1 ~] # openstack endpoint create-- region RegionOne\ > p_w_picpath public http://192.168.56.11:9292+--------------+----------------------------------+| Field | Value | +- -+-+ | enabled | True | | id | cabb8016fef74b438a341866ef10917f | | interface | public | | region | RegionOne | | region_id | RegionOne | Service_id | c9fd28645efe45faa2a9cf2f2cce623e | | service_name | glance | | service_type | p_w_picpath | | url | http://192.168.56.11:9292 | +-- -+ [root@linux-node1 ~] # openstack endpoint create-- region RegionOne p_w_picpath internal http://192.168.56.11:9292+--------------+----------------------------------+| Field | Value | +- -+-+ | enabled | True | | id | 0bafb4e5d90745d789a16c97fc3f5688 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service _ id | c9fd28645efe45faa2a9cf2f2cce623e | | service_name | glance | | service_type | p_w_picpath | | url | http://192.168.56.11:9292 | +-- + [root@linux-node1 ~] # openstack endpoint create-region RegionOne p_w_picpath admin http://192.168.56.11:9292+--------------+----------------------------------+| Field | Value | +- +-- + | enabled | True | | id | 911d06d783094d62bf2cf97e4dd3fed6 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service _ id | c9fd28645efe45faa2a9cf2f2cce623e | | service_name | glance | | service_type | p_w_picpath | | url | http://192.168.56.11:9292 | +-+-+
test
We can use openstack list or glance list to view it.
[root@linux-node1 ~] # openstack p_w_picpath list [root@linux-node1 ~] # glance pendant pictureListListListMutel Muffin + | ID | Name | +-+ +-+-- +-+
Tip: if there is no empty space here, then you need to read the log at this time.
Finally, we can upload an image for testing.
[root@linux-node1 ~] # wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
Let's download the image above and test it.
[root@linux-node1] # openstack p_w_picpath create "cirros"\ >-- file cirros-0.3.4-x86_64-disk.img\ >-- disk-format qcow2-- container-format bare\ >-- public+-+-- -+ | Field | Value | + -+ | checksum | ee1eca47dc88f4879d8a229cc70a07c6 | | container_format | bare | | created_at | 2016-11-17T10:34:14Z | | disk_format | qcow2 | | file | | / v2/p_w_picpaths/fc67361d-ad30-40b2-9d96-941e50fc17f5/file | | id | fc67361d-ad30-40b2-9d96-941e50fc17f5 | | min_disk | 0 | | min_ram | 0 | | Name | cirros | | owner | 026a58f98402437fa95ef4a21fbd4d1a | | protected | False | | schema | / v2/schemas/p_w_picpath | | size | | 13287936 | | status | active | | tags | updated_at | 2016-11-17T10:34:14Z | | | virtual_size | None | | visibility | public | +-- -+
# hint: if there are no environment variables, you still need to source
Check whether the upload is successful
[root@linux-node1 ~] # openstack p_w_picpath list+--+ | ID | Name | Status | +-- -+ | fc67361d-ad30-40b2-9d96-941e50fc17f5 | cirros | active | +-+ [root@linux-node1 ~] # glance p_w_picpath -list+--+-+ | ID | Name | +-+-+ | Fc67361d-ad30-40b2-9d96-941e50fc17f5 | cirros | +-+-+ [root@linux-node1 ~] # ls / var/lib/glance/p_w_picpaths/fc67361d-ad30-40b2-9d96-941e50fc17f5 image is stored under / var/lib/glance/p_w_picpaths
[M version]
Official Chinese document: http://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/keystone-install.html