-
Openstack glance 설치하기Cloud 2016. 2. 19. 09:00mysql에 glance 데이터베이스만들기mysql에 접속mysql -u root -pglance DB 만들기CREATE DATABASE glance;glance 접속용 계정 만들기GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \IDENTIFIED BY 'GLANCE_DBPASS';GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \IDENTIFIED BY 'GLANCE_DBPASS';admin CLI용 셀 환경설정. admin-openrc.sh는 keystone 설치할때 만들었던걸 사용한다.source admin-openrc.shkeystone에 glance 사용자 생성(비번은 glance_passwd로 했음)openstack user create --domain default --password-prompt glanceglance user에게 admin role 추가openstack role add --project service --user glance adminglance 서비스 생성openstack service create --name glance \--description "OpenStack Image service" image이미지 서비스의 API endpoint 생성openstack endpoint create --region RegionOne image public http://controller:9292openstack endpoint create --region RegionOne image internal http://controller:9292openstack endpoint create --region RegionOne image admin http://controller:9292glance 패키지 설치apt-get install glance python-glanceclientglance 설정파일 편집vi /etc/glance/glance-api.conf[DEFAULT]verbose = Truedefault_store = filebind_host = 0.0.0.0bind_port = 9292log_file = /var/log/glance/api.logbacklog = 4096workers = 1registry_host = 0.0.0.0registry_port = 9191registry_client_protocol = httpnotification_driver = nooprabbit_host = localhostrabbit_port = 5672rabbit_use_ssl = falserabbit_userid = guestrabbit_password = guestrabbit_virtual_host = /rabbit_notification_exchange = glancerabbit_notification_topic = notificationsrabbit_durable_queues = Falseqpid_notification_exchange = glanceqpid_notification_topic = notificationsqpid_hostname = localhostqpid_port = 5672qpid_username =qpid_password =qpid_sasl_mechanisms =qpid_reconnect_timeout = 0qpid_reconnect_limit = 0qpid_reconnect_interval_min = 0qpid_reconnect_interval_max = 0qpid_reconnect_interval = 0qpid_heartbeat = 5qpid_protocol = tcpqpid_tcp_nodelay = Truefilesystem_store_datadir = /var/lib/glance/images/swift_store_auth_version = 2swift_store_auth_address = 127.0.0.1:5000/v2.0/swift_store_user = jdoe:jdoeswift_store_key = a86850deb2742ec3cb41518e26aa2d89swift_store_container = glanceswift_store_create_container_on_put = Falseswift_store_large_object_size = 5120swift_store_large_object_chunk_size = 200swift_enable_snet = Falses3_store_host = 127.0.0.1:8080/v1.0/s3_store_access_key = <20-char AWS access key>s3_store_secret_key = <40-char AWS secret key>s3_store_bucket = <lowercased 20-char aws access key>glances3_store_create_bucket_on_put = Falsesheepdog_store_address = localhostsheepdog_store_port = 7000sheepdog_store_chunk_size = 64delayed_delete = Falsescrub_time = 43200scrubber_datadir = /var/lib/glance/scrubberimage_cache_dir = /var/lib/glance/image-cache/[database]backend = sqlalchemyconnection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance[keystone_authtoken]auth_uri = http://controller:5000auth_url = http://controller:35357auth_plugin = passwordproject_domain_id = defaultuser_domain_id = defaultproject_name = serviceusername = glancepassword = glance_passwd[paste_deploy]flavor = keystone[store_type_location_strategy]vi /etc/glance/glance-api-paste.ini# Use this pipeline for no auth or image caching - DEFAULT[pipeline:glance-api]pipeline = versionnegotiation unauthenticated-context rootapp# Use this pipeline for image caching and no auth[pipeline:glance-api-caching]pipeline = versionnegotiation unauthenticated-context cache rootapp# Use this pipeline for caching w/ management interface but no auth[pipeline:glance-api-cachemanagement]pipeline = versionnegotiation unauthenticated-context cache cachemanage rootapp# Use this pipeline for keystone auth[pipeline:glance-api-keystone]pipeline = versionnegotiation authtoken context rootapp# Use this pipeline for keystone auth with image caching[pipeline:glance-api-keystone+caching]pipeline = versionnegotiation authtoken context cache rootapp# Use this pipeline for keystone auth with caching and cache management[pipeline:glance-api-keystone+cachemanagement]pipeline = versionnegotiation authtoken context cache cachemanage rootapp# Use this pipeline for authZ only. This means that the registry will treat a# user as authenticated without making requests to keystone to reauthenticate# the user.[pipeline:glance-api-trusted-auth]pipeline = versionnegotiation context rootapp# Use this pipeline for authZ only. This means that the registry will treat a# user as authenticated without making requests to keystone to reauthenticate# the user and uses cache management[pipeline:glance-api-trusted-auth+cachemanagement]pipeline = versionnegotiation context cache cachemanage rootapp[composite:rootapp]paste.composite_factory = glance.api:root_app_factory/: apiversions/v1: apiv1app/v2: apiv2app[app:apiversions]paste.app_factory = glance.api.versions:create_resource[app:apiv1app]paste.app_factory = glance.api.v1.router:API.factory[app:apiv2app]paste.app_factory = glance.api.v2.router:API.factory[filter:versionnegotiation]paste.filter_factory = glance.api.middleware.version_negotiation:VersionNegotiationFilter.factory[filter:cache]paste.filter_factory = glance.api.middleware.cache:CacheFilter.factory[filter:cachemanage]paste.filter_factory = glance.api.middleware.cache_manage:CacheManageFilter.factory[filter:context]paste.filter_factory = glance.api.middleware.context:ContextMiddleware.factory[filter:unauthenticated-context]paste.filter_factory = glance.api.middleware.context:UnauthenticatedContextMiddleware.factory[filter:authtoken]#paste.filter_factory = keystoneclient.middleware.auth_token:filter_factorypaste.filter_factory = keystonemiddleware.auth_token:filter_factoryidentity_uri = http://controller:35357admin_user=admindelay_auth_decision = true[filter:gzip]paste.filter_factory = glance.api.middleware.gzip:GzipMiddleware.factoryvi /etc/glance/glance-registry.conf[DEFAULT]notification_driver = noopverbose = Truebind_host = 0.0.0.0bind_port = 9191log_file = /var/log/glance/registry.log# Backlog requests when creating socketbacklog = 4096api_limit_max = 1000limit_param_default = 25[database]backend = sqlalchemyconnection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance[keystone_authtoken]auth_uri = http://controller:5000auth_url = http://controller:35357auth_plugin = passwordproject_domain_id = defaultuser_domain_id = defaultproject_name = serviceusername = glancepassword = glance_passwd[paste_deploy]flavor = keystoneglance용 mysql 테이블 생성하기su -s /bin/sh -c "glance-manage db_sync" glance위 명령어 에러나면 아래처럼 mysql에 접속해서 migrate_version 테이블의 인코딩을 변경해주면 된다.mysql -u root -palter table migrate_version convert to character set utf8 collate utf8_unicode_ci;keystoneclient가 아니라 keystonemiddleware가 필요하다.pip install keystonemiddlewareglance 서비스 재시작service glance-registry restartservice glance-api restartglance 기본 사용하기glance 클라이언트에서 사용할 API 버전을 기본 설정파일에 추가.echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.shsource admin-openrc.sh소스 이미지 다운로드wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img이미지 업로드glance image-create --name "cirros" \--file cirros-0.3.4-x86_64-disk.img \--disk-format qcow2 --container-format bare \--visibility public --progress이미지 올라갔는지 확인glance image-list참고
'Cloud' 카테고리의 다른 글
gnocchi 간단 정리 (0) 2017.02.27 Openstack Nova 설치하기 (0) 2016.02.22 openstack keystone 설치해보기 (0) 2016.02.17 Large-scale cluster management at Google with Borg 정리 (0) 2015.09.21 kubernetes 기본 개념 (0) 2015.09.14 댓글