IT/Openstack

[Openstack - Train] Centos에 설치하기(1) - SQL Database Install

louky 2019. 10. 31. 11:23
반응형

이 장에서는 Openstack내 Database 설치와 설정을 설명하며, 설치는 아래 Node에만 설치를 합니다. 

 

  • 설치 노드
    • Controller  Node

DATAbase를 분리하고자 할 경우 해당 시스템에 설치를 진행하면 되겠습니다.

 

DATABASE PKG 를 설치 합니다 

[root@controller ~]#  yum install mariadb mariadb-server python2-PyMySQL -y

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: data.aonenetworks.kr
 * centos-ceph-nautilus: data.aonenetworks.kr
 * centos-nfs-ganesha28: data.aonenetworks.kr
 * centos-openstack-train: data.aonenetworks.kr
 * centos-qemu-ev: data.aonenetworks.kr
 * extras: data.aonenetworks.kr
 * updates: ftp.riken.jp
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 3:10.3.10-1.el7.0.0.rdo2 will be installed
---> Package mariadb-server.x86_64 3:10.3.10-1.el7.0.0.rdo2 will be installed
--> Processing Dependency: mariadb-errmsg(x86-64) = 3:10.3.10-1.el7.0.0.rdo2 for package: 3:mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64
--> Processing Dependency: psmisc for package: 3:mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: 3:mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: 3:mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: 3:mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64
---> Package python2-PyMySQL.noarch 0:0.9.2-2.el7 will be installed
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mariadb-errmsg.x86_64 3:10.3.10-1.el7.0.0.rdo2 will be installed
---> Package psmisc.x86_64 0:22.20-16.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================
 Package                 Arch           Version                            Repository                      Size
================================================================================================================
Installing:
 mariadb                 x86_64         3:10.3.10-1.el7.0.0.rdo2           centos-openstack-train         6.0 M
 mariadb-server          x86_64         3:10.3.10-1.el7.0.0.rdo2           centos-openstack-train          16 M
 python2-PyMySQL         noarch         0.9.2-2.el7                        centos-openstack-train          92 k
Installing for dependencies:
 libaio                  x86_64         0.3.109-13.el7                     base                            24 k
 mariadb-errmsg          x86_64         3:10.3.10-1.el7.0.0.rdo2           centos-openstack-train         226 k
 psmisc                  x86_64         22.20-16.el7                       base                           141 k

Transaction Summary
================================================================================================================
Install  3 Packages (+3 Dependent packages)

Total download size: 23 M
Installed size: 121 M
Downloading packages:
(1/6): libaio-0.3.109-13.el7.x86_64.rpm                                                  |  24 kB  00:00:00
(2/6): psmisc-22.20-16.el7.x86_64.rpm                                                    | 141 kB  00:00:00
(3/6): mariadb-errmsg-10.3.10-1.el7.0.0.rdo2.x86_64.rpm                                  | 226 kB  00:00:00
(4/6): python2-PyMySQL-0.9.2-2.el7.noarch.rpm                                            |  92 kB  00:00:00
(5/6): mariadb-10.3.10-1.el7.0.0.rdo2.x86_64.rpm                                         | 6.0 MB  00:00:02
(6/6): mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64.rpm                                  |  16 MB  00:00:04
----------------------------------------------------------------------------------------------------------------
Total                                                                           5.2 MB/s |  23 MB  00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : psmisc-22.20-16.el7.x86_64                                                                   1/6
  Installing : libaio-0.3.109-13.el7.x86_64                                                                 2/6
  Installing : 3:mariadb-10.3.10-1.el7.0.0.rdo2.x86_64                                                      3/6
  Installing : 3:mariadb-errmsg-10.3.10-1.el7.0.0.rdo2.x86_64                                               4/6
  Installing : 3:mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64                                               5/6
  Installing : python2-PyMySQL-0.9.2-2.el7.noarch                                                           6/6
  Verifying  : python2-PyMySQL-0.9.2-2.el7.noarch                                                           1/6
  Verifying  : 3:mariadb-server-10.3.10-1.el7.0.0.rdo2.x86_64                                               2/6
  Verifying  : 3:mariadb-errmsg-10.3.10-1.el7.0.0.rdo2.x86_64                                               3/6
  Verifying  : 3:mariadb-10.3.10-1.el7.0.0.rdo2.x86_64                                                      4/6
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                                 5/6
  Verifying  : psmisc-22.20-16.el7.x86_64                                                                   6/6

Installed:
  mariadb.x86_64 3:10.3.10-1.el7.0.0.rdo2             mariadb-server.x86_64 3:10.3.10-1.el7.0.0.rdo2
  python2-PyMySQL.noarch 0:0.9.2-2.el7

Dependency Installed:
  libaio.x86_64 0:0.3.109-13.el7  mariadb-errmsg.x86_64 3:10.3.10-1.el7.0.0.rdo2  psmisc.x86_64 0:22.20-16.el7

Complete!

 

/etc/my.cnf.d/openstack.cnf 이 있을 경우 수정하고 없을 경우 생성한다. 

[root@controller ~]# cat /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = CONTROLLER_MGT_IP_ADDRESS_입력

default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

 

DB daemon을 실행한다. 

[root@controller ~]# systemctl restart mariadb.service

[root@controller ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

[root@controller ~]# systemctl status mariadb.service
● mariadb.service - MariaDB 10.3 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since 목 2019-10-31 11:00:34 KST; 11s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 3965 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─3965 /usr/libexec/mysqld --basedir=/usr

10월 31 11:00:34 ibcontroller mysql-prepare-db-dir[3860]: Please report any problems at http://mariadb.org/jira
10월 31 11:00:34 ibcontroller mysql-prepare-db-dir[3860]: The latest information about MariaDB is available at http://mariadb.org/.
10월 31 11:00:34 ibcontroller mysql-prepare-db-dir[3860]: You can find additional information about the MySQL part at:
10월 31 11:00:34 ibcontroller mysql-prepare-db-dir[3860]: http://dev.mysql.com
10월 31 11:00:34 ibcontroller mysql-prepare-db-dir[3860]: Consider joining MariaDB's strong and vibrant community:
10월 31 11:00:34 ibcontroller mysql-prepare-db-dir[3860]: https://mariadb.org/get-involved/
10월 31 11:00:34 ibcontroller mysqld[3965]: 2019-10-31 11:00:34 0 [Note] /usr/libexec/mysqld (mysqld 10.3.10-MariaDB) starting as proc...3965 ...
10월 31 11:00:34 ibcontroller mysqld[3965]: 2019-10-31 11:00:34 0 [Warning] Could not increase number of max_open_files to more than 1...t: 8127)
10월 31 11:00:34 ibcontroller mysqld[3965]: 2019-10-31 11:00:34 0 [Warning] Changed limits: max_open_files: 1024  max_connections: 594...as 2000)
10월 31 11:00:34 ibcontroller systemd[1]: Started MariaDB 10.3 database server.
Hint: Some lines were ellipsized, use -l to show in full.

DB의 root pw를 변경한다. 

[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.

Set root password? [Y/n]y
New password:  ##PASSWD 입력
Re-enter new password: ##PASSWD 입력
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.

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.

Disallow root login remotely? [Y/n] n
 ... skipping.

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 -uroot -p
Enter password:  ##DB PW입력
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.3.10-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>

 

Root 계정의 보안이 필요할 경우  DB root계정명을 변경한다. 변경 방법은 아래 링크를 통해 확인한다.

2019/10/31 - [DB/Mysql] - [MariaDB] Database root 계정 이름 변경

 

반응형