Skip to the content.

Cài đặt và cấu hình glance.

Chuẩn bị

  1. Tạo database:
    • Kết nối đến database server:
      mysql -u root -p
      
    • Tạo database glance và cấp quyền:
      mysql -uroot -pSQLROOTPASS << EOF
      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';
      EOF
      
  2. Export thông tin đăng nhập tài khoản admin Openstack.
    . admin-openrc
    
  3. Tạo user, service và endpoint cho glance:
    • Tạo user glance:
      openstack user create --domain default --password=GLANCE_PASSWORD glance
      
    • Thêm admin role vào user glance và project service:
      openstack role add --project service --user glance admin
      
    • Tạo dịch vụ glance:
      openstack service create --name glance --description "Openstack Image" image
      
  4. Tạo Endpoint cho dịch vụ glance.
    openstack endpoint create --region RegionOne image public http://192.168.50.140:9292
    openstack endpoint create --region RegionOne image internal http://192.168.50.140:9292
    openstack endpoint create --region RegionOne image admin http://192.168.50.140:9292
    

Cài đặt các thành phần.

  1. Cài đặt gói cần thiết:
    yum install openstack-glance
    
  2. Cấu hình file /etc/glance/glance-api.conf: ``` cat « EOF > /etc/glance/glace-api.conf [database] connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance

[keystone_authtoken] www_authenticate_uri = http://controller:5000 auth_url = http://controller:5000 memcached_servers = controller: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/ EOF


3. Populate database

su -s /bin/sh -c “glance-manage db_sync” glance


## Hoàn tất cài đặt

Khởi động dịch vụ Openstack image và cấu hình cho nó tự bật khi hệ thống khởi động:

sudo systemctl enable openstack-glance-api.service sudo systemctl start openstack-glance-api.service


Cấu hình firewalld cho phép các port của Image service:

firewall-cmd –zone=public –add-port={9292/tcp,9191/tcp} –permanent firewall-cmd –reload ```

Tài liệu nguồn