Stein 오픈스택 클라우드 서버 구축(3) - 오픈스택 기본 패키지 설치 (update 2020.01.28)

blog post

이번 포스팅에서는 오픈스택 관련 기본 패키지를 세팅하는 과정에 관하여 다루도록 하겠습니다. 본 과정은 컨트롤러 노드에서 진행합니다.
 
 
패키지 구성

 

 

컨트롤러 노드에 구성될 패키지는 다음과 같습니다.

 

 

- MariaDB: 오픈스택 서비스 및 VM 관련 설정들을 보관하기 위해 사용됩니다.

- RabbitMQ: 오픈스택 서비스 간 상호 메시지를 주고 받기 위한 메시지 큐로 사용됩니다.

- Memcached: 범용 분산 메모리 캐시 시스템으로, 자주 외부 데이터에 접근해야 하는 경우에 발생하는 오버헤드를 줄이기 위해 메모리에 캐싱하고 읽어들이는 역할을 담당합니다. 오픈스택 서비스에서는 주로 인증 메커니즘에서 토큰 캐싱을 위해 사용됩니다.

 

 

 

1. 오픈스택 패키지 설치 및 레포지토리 구성

 

 

오픈스택 패키지를 설치하고 stein 레포지토리를 활성화 합니다.

[root@Controller ~]# yum -y install centos-release-openstack-stein 
[root@Controller ~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-OpenStack-stein.repo 

 

 

2. DB 설치 및 구성

 

다음과 같이 MariaDB를 설치합니다.

 

[root@Controller ~]# yum --enablerepo=centos-openstack-stein -y install mariadb-server
[root@Controller ~]#
[root@Controller ~]# vim /etc/my.cnf


# 아래 내용을 추가합니다.
[mysqld]
character-set-server=utf8

# 서비스를 시작합니다.
[root@Controller ~]# systemctl start mariadb 
[root@Controller ~]# systemctl enable mariadb

 

설치된 DB를 초기 설정합니다.

 

[root@Controller ~]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

# DB 루트 사용자의 비밀번호를 설정합니다.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

# anonymous 사용자를 제거합니다.
Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

# root 사용자로 원격 접속하는 것을 차단합니다.
Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

 

 

DB 설정이 잘 되었는지 확인해 봅니다. 아래와 같이 초기 테이블이 보이면 정상적으로 구성된 것입니다.

 

[root@Controller ~]# mysql -u root -p 
Enter password:     # MariaDB root password you set
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.37-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


MariaDB [(none)]> select user,host,password from mysql.user; 
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | 127.0.0.1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | ::1       | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> show databases; 
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> exit
Bye

 

방화벽을 사용하는 경우, 내부 방화벽에서 mysql을 허용해줍니다.

 

[root@Controller ~]# firewall-cmd --add-service=mysql --permanent 
[root@Controller ~]# firewall-cmd --reload

 

 

3. RabbitMQ 및 Memcached 설치
 
 
 
 

 

 

다음과 같이 RabbitMQ를 설치하고 설정해줍니다.

 

[root@Controller ~]# yum --enablerepo=centos-openstack-stein -y install rabbitmq-server
[root@Controller ~]#
[root@Controller ~]# vim /etc/my.cnf.d/mariadb-server.cnf

# 아래 섹션에 내용을 추가해 줍니다.
[mysqld]
.....
.....
character-set-server=utf8
max_connections=500

[root@Controller ~]# vim /etc/sysconfig/memcached

# 아래와 같이 옵션 값을 변경해 줍니다. 모든 ip에 대한 리스닝 상태로 전환합니다.
OPTIONS="-l 0.0.0.0,::"

# 서비스를 재시작합니다.
[root@Controller ~]# systemctl restart mariadb rabbitmq-server memcached 
[root@Controller ~]# systemctl enable mariadb rabbitmq-server memcached 

# 사용자를 설정합니다. 아래에서 본인이 원하는 사용자명(openstack)과 비밀번호(passward)로 변경해 줍니다.
[root@Controller ~]# rabbitmqctl add_user openstack password 
Creating user "openstack"

# 생성된 사용자(여기에서는 openstack)에 대한 권한을 설정해줍니다.
[root@Controller ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*" 
Setting permissions for user "openstack" in vhost "/"

 

마지막으로 방화벽에서 memcached(11211), RabbitMQ(5672)가 사용하는 포트를 허용해줍니다.

 

[root@Controller ~]# firewall-cmd --add-port={11211/tcp,5672/tcp} --permanent 
[root@Controller ~]# firewall-cmd --reload 

 

이상으로 기본 패키지 설정을 마치겠습니다. 다음 포스팅부터는 본격적으로 오픈스택 필수 컴포넌트를 구축하는 과정에 대하여 다루도록 하겠습니다.

 

 

TAGS.

Comments