티스토리 뷰

안녕하세요~!! 

이것저것 벌려놓은게 많아서 이일저일 하느라 정작 블로그에 글을 올릴 시간은 별로 없네요~!! 오늘 시간을 내서 글 한번 올려봅니다. 오늘 공개하는건 Horizon 설치와 Cinder 설치 부분입니다. 다음 포스팅에서는 컴퓨트 노드 설치편을 올리도록 하겠습니다. 

Horizon 설치

이번에는 오픈스택을 쉽게 사용할 수 있게 제공되는 데쉬보드 서비스인 Horizon을 설치해 보겠습니다.

 

1.     먼저 mamcached, python-memcached, mod_wsgi, openstack-dashboard를 설치합니다.

# yum install memcached python-memcached mod_wsgi openstack-dashboard

 

2.     /etc/openstack-dashboard/local-settings를 열어 데쉬보드에 접속할 수 있는 IP를 등록합니다. 접속할 IP 주소는 컨트롤러 노드 IP로 입력합니다.

# vi /etc/openstack-dashboard/local_settings
…
CACHES = {
'default': {
'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION' : 127.0.0.1:11211'
}
}
…
ALLOWED_HOSTS = ['localhost', '10.10.15.11']
…
OPENSTACK_HOST = "10.10.15.11"

 

3.     시스템의 SELinux 정책이 HTTP 서버에 대한 네트워크 연결을 허용하도록 구성되어 있는지 확인합니다.

# setsebool -P httpd_can_network_connect on

 

4.     /etc/httpd/conf/httpd.conf 파일을 열어 ServerName을 다음과 같이 입력합니다.

# vi /etc/httpd/conf/httpd.conf
…
ServerName 10.10.15.11:80

 

5.     아파치 웹 서버와 memcache 서비스를 시작합니다.

# service httpd start
Starting httpd:                                            [  OK  ]
# service memcached start
Starting memcached:                                        [  OK  ]
# chkconfig httpd on
# chkconfig memcached on

 

6.     이제 컨트롤러 IP로 데쉬보드에 접속할 수 있습니다.

 

Cinder 설치

Cinder는 인스턴스에 디스크를 연결해서 인스턴스가 별도의 저장 공간을 가질 수 있도록 관리해 주는 서비스입니다. 그럼 지금부터 Cinder를 설치해 보겠습니다.

 

1.     Fdisk 명령을 이용해서 스토리지용 디스크가 있는지 확인합니다.

$ sudo fdisk -l
 
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001c419
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1306     9972736   8e  Linux LVM
 
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

 

2.     확인된 디바이스로 물리 볼륨(Physical Volume)과 볼륨 그룹(Volume Group)을 생성합니다.

# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
# vgcreate cinder-volumes /dev/sdb
Volume group "cinder-volumes" successfully created

 

3.     볼륨 그룹을 생성한 후 /etc/lvm/lvm.conf 파일을 열어 LVM이 기존 디바이스에 접근하지 못하도록 다음과 같이 Filter을 걸어줍니다.

# vi /etc/lvm/lvm.conf
devices {
...
filter = [ "a/sda1/", "a/sdb/", "r/.*/"]
...
}

 

4.     Yum install을 이용해서 openstack-cinderscsi-target-utils를 설치합니다.

# yum install openstack-cinder scsi-target-utils

 

5.     설치가 완료되면 openstack-config를 이용해서 데이터베이스 정보를 설정합니다.

# openstack-config --set /etc/cinder/cinder.conf \
  database connection mysql://cinder:cinderdbpass@10.10.15.11/cinder

 

6.     Mysql에 접속해서 cinder 데이터베이스와 계정을 생성하고 접속권한을 설정합니다.

# mysql -u root ?p
mysql> CREATE DATABASE cinder;
Query OK, 1 row affected (0.00 sec)
 
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY 'cinderdbpass';
Query OK, 0 rows affected (0.00 sec)
 
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY 'cinderdbpass';
Query OK, 0 rows affected (0.00 sec)

 

7.     다음과 같은 명령으로 cinder 테이블을 생성합니다.

# su -s /bin/sh -c "cinder-manage db sync" cinder

 

8.     Keystonecinder 사용자를 생성하고 서비스 테넌트에 admin 롤을 추가합니다.

# keystone user-create --name=cinder --pass=cinderpass --email=cinder@example.com
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |        cinder@example.com        |
| enabled  |               True               |
|    id    | c95341072f35490a83351f760c151e9b |
|   name   |              cinder              |
| username |              cinder              |
+----------+----------------------------------+
# keystone user-role-add --user=cinder --tenant=service --role=admin

 

9.     생성된 keystone 정보는 openstack-config을 이용해서 /etc/cinder/cinder.conf에 적용합니다.

# openstack-config --set /etc/cinder/cinder.conf DEFAULT \
  auth_strategy keystone
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
  auth_uri http://10.10.15.11:5000
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
  auth_host 10.10.15.11
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
  auth_protocol http
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
  auth_port 35357
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
  admin_user cinder
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
  admin_tenant_name service
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
  admin_password cinderpass

 

10.  이번에는 Qpid 정보를 openstack-config를 이용해서 다음과 같이 설정합니다.

# openstack-config --set /etc/cinder/cinder.conf \
  DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid
# openstack-config --set /etc/cinder/cinder.conf \
  DEFAULT qpid_hostname 10.10.15.11

 

11.  마지막으로 glance_host 정보를 openstack-config를 이용해서 설정합니다.

# openstack-config --set /etc/cinder/cinder.conf \
  DEFAULT glance_host 10.10.15.11

 

12.  이번에는 keystonecinder 서비스를 생성하고 endpoint를 생성합니다.

# keystone service-create --name=cinder --type=volume --description="OpenStack Block Storage"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Block Storage      |
|   enabled   |               True               |
|      id     | 3679708526d84d77b26e26baf0126817 |
|     name    |              cinder              |
|     type    |              volume              |
+-------------+----------------------------------+
# keystone endpoint-create \
  --service-id=3679708526d84d77b26e26baf0126817 \
  --publicurl=http://10.10.15.11:8776/v1/%\(tenant_id\)s \
  --internalurl=http://10.10.15.11:8776/v1/%\(tenant_id\)s \
  --adminurl=http://10.10.15.11:8776/v1/%\(tenant_id\)s
+-------------+------------------------------------------+
|   Property  |                  Value                   |
+-------------+------------------------------------------+
|   adminurl  | http://10.10.15.11:8776/v1/%(tenant_id)s |
|      id     |     797b6381de9f48da95c37c8c83d7c084     |
| internalurl | http://10.10.15.11:8776/v1/%(tenant_id)s |
|  publicurl  | http://10.10.15.11:8776/v1/%(tenant_id)s |
|    region   |                regionOne                 |
|  service_id |     3679708526d84d77b26e26baf0126817     |
+-------------+------------------------------------------+

 

13.  Version 2을 위한 서비스를 하나 더 생성하고 endpoint를 생성합니다.

# keystone service-create --name=cinderv2 --type=volume --description="OpenStack Block Storage V2"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |    OpenStack Block Storage V2    |
|   enabled   |               True               |
|      id     | 786ad0104e504fb7ac794ac161a7c613 |
|     name    |             cinderv2             |
|     type    |              volume              |
+-------------+----------------------------------+
# keystone endpoint-create \
  --service-id=786ad0104e504fb7ac794ac161a7c613 \
  --publicurl=http://10.10.15.11:8776/v2/%\(tenant_id\)s \
  --internalurl=http://10.10.15.11:8776/v2/%\(tenant_id\)s \
--adminurl=http://10.10.15.11:8776/v2/%\(tenant_id\)s
+-------------+------------------------------------------+
|   Property  |                  Value                   |
+-------------+------------------------------------------+
|   adminurl  | http://10.10.15.11:8776/v2/%(tenant_id)s |
|      id     |     e20949bd960f462a8c1d4498ef0f91c9     |
| internalurl | http://10.10.15.11:8776/v2/%(tenant_id)s |
|  publicurl  | http://10.10.15.11:8776/v2/%(tenant_id)s |
|    region   |                regionOne                 |
|  service_id |     786ad0104e504fb7ac794ac161a7c613     |
+-------------+------------------------------------------+

 

14.  CentOS에서는 블록 스토리지용 볼륨을 iSCSI(Internet Small Computer System Interface) 서비스로 구성합니다. 존재하지 않을 경우, / etc/tgt/targets.conf 파일의 시작 부분에 다음 줄을 추가합니다.

# vi /etc/tgt/targets.conf
include /etc/cinder/volumes/*

 

15.  Cinder 서비스를 시작합니다. 그리고 부팅 시 cinder 서비스가 자동 실행 될 수 있도록 설정합니다.

# service openstack-cinder-api start
Starting openstack-cinder-api:                             [  OK  ]
# service openstack-cinder-scheduler start
Starting openstack-cinder-scheduler:                       [  OK  ]
# service openstack-cinder-volume start
Starting openstack-cinder-volume:                          [  OK  ]
# service tgtd start
Starting SCSI target daemon:                               [  OK  ]
# chkconfig openstack-cinder-api on
# chkconfig openstack-cinder-scheduler on
# chkconfig openstack-cinder-volume on
# chkconfig tgtd on

 

16.  Cinder 볼륨을 생성하기 전에 사용자 정보를 먼저 export해야 합니다. 여기서는 앞에서 생성한 Demo 계정을 이용해서 테스트해 보겠습니다. 좀 더 쉽게 테스트를 하기 위해 vi 에디터를 열어 다음과 같은 정보를 입력하고 저장합니다.

# vi demo-openrc.sh
export OS_USERNAME=demo
export OS_PASSWORD=demopass
export OS_TENANT_NAME=demo
export OS_AUTH_URL=http://10.10.15.11:35357/v2.0

 

17.  편집된 계정 정보를 다음과 같은 명령어로 export합니다.

# source demo-openrc.sh

 

18.  Cinder 명령어를 이용해서 볼륨 하나를 생성합니다.

# cinder create --display-name myVolume 1
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2014-06-16T12:31:26.095755      |
| display_description |                 None                 |
|     display_name    |               myVolume               |
|      encrypted      |                False                 |
|          id         | 5e691b7b-12e3-40b6-b714-7f17550db5d1 |
|       metadata      |                  {}                  |
|         size        |                  1                   |
|     snapshot_id     |                 None                 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+

 

19.  생성한 볼륨은 list로 확인할 수 있습니다. 이때 Statusavailable이여야만 인스턴스에 연결해서 사용할 수 있습니다.

# cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
|                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 5e691b7b-12e3-40b6-b714-7f17550db5d1 | available |   myVolume   |  1   |     None    |  false   |             |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

 


최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함