Bigdata환경에서 Hive,
HCatalog, Oozie, Ambari 등의 콤포넌트들의 모두 metastore공간으로 db를 요구한다. 그때마다 모두
dbms를 따로 설치할 수는 없는 노릇이라 1개의
dbms를 공유하기로 했다.
mariadb 10.2 설치하기로 했다.
centos 7.3에는 기본으로
mariadb 5.5가 yum으로 설치가능하지만 호환성 이슈로 mariadb 10이상으로 사용하려고 한다.
참조:
https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.0/bk_support-matrices/content/ch_matrices-ambari.html#ambari_database
설치 참조는 아래 링크로 진행해본다.
https://mariadb.com/kb/en/mariadb/yum/
https://mariadb.com/kb/en/mariadb/installing-mariadb-with-the-rpm-tool/
.
yum repository 구축
rpm 파일 각각은 상호
dependency가 강하게 걸려 있어서 yum설치를 권장한다고 한다.
그래서 repository서버에 아래와 같이 구축하였다.
|
#
tar xvf mariadb-10.2.6-rhel-7-x86_64-rpms.tar
mariadb-10.2.6-rhel-7-x86_64-rpms/
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-compat.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-gssapi-server.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-connect-engine.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-client.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-oqgraph-engine.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-devel.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-rocksdb-engine.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-tokudb-engine.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-shared.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-common.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-aws-key-management.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-server.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/jemalloc-3.6.0-1.el7.x86_64.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/jemalloc-devel-3.6.0-1.el7.x86_64.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/galera-25.3.20-1.rhel7.el7.centos.x86_64.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/MariaDB-10.2.6-centos7-x86_64-cracklib-password-check.rpm
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/c1f44a52d7d023900020554941585e7b8c5335f956a7d8e4a46d7e3491284f9e-primary.xml.gz
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/b5a1f4d073313dfa8d33c0f0814df18fecca52fb6987671ca37ae5ea35cb3e4b-filelists.xml.gz
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/be5067c14da550275f26f13e0289b745ff0d4641c9528c8068b9f67d5a5194e9-other.xml.gz
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/repomd.xml
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/8ba0e9ad51e831a3ddfb021e50285ac06c0abd82fb1b1cd6a930e96f20dbcf78-other.sqlite.bz2
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/d0993a2fc77a0387a369912f674f38fc0ed2384d1ffe447f28f466b74b3168ab-filelists.sqlite.bz2
mariadb-10.2.6-rhel-7-x86_64-rpms/repodata/f86661565f4fcb19eb63d74c4d8417f8e85e9db4e33a38c5052b45fef59ae699-primary.sqlite.bz2
mariadb-10.2.6-rhel-7-x86_64-rpms/README
mariadb-10.2.6-rhel-7-x86_64-rpms/setup_repository
#
./setup_repository
Repository file successfully created!
Please install MariaDB Server with this command:
yum install MariaDB-server
#
cd /var/www/html
#
ln -s /data01/mariadb-10.2.6-rhel-7-x86_64-rpms
mariadb-10.2.6-rhel-7-x86_64-rpms
#
cat /etc/yum.repos.d/mariadb.repo
[MariaDB]
name = MariaDB
baseurl =
file:///data01/mariadb-10.2.6-rhel-7-x86_64-rpms
gpgkey =
https://downloads.mariadb.com/MariaDB/yum/RPM-GPG-KEY-MariaDB
|
.
gpgkey파일 생성
인터넷이 끊긴 서버를 가정하여 설치하고 있다. gpgkey는 다운로드하여
내용을 복붙하여 생성한다.
|
#
cd /var/www/html/mariadb-10.2.6-rhel-7-x86_64-rpms
#
mkdir RPM-GPG-KEY
#
cd RPM-GPG-KEY/
#
vi RPM-GPG-KEY-MariaDB
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)
mQGiBEtohJARBACxvZpWSIMTp/e7BUzSW+WDL7Pl0JDg6v7ZJFGJk9qo+5JXIiis
....
|
. 설치할
서버에 repo 정보 세팅
위의 repository서버의
mariadb.repo정보를 참조하여 설정한다.
gpgkey는 다운로드하여 복사하여 붙여넣어 파일을 생성한다.
|
#
vi /etc/yum.repos.d/mariadb.repo
[MariaDB]
name = MariaDB
baseurl =
http://x.x.x.x/mariadb-10.2.6-rhel-7-x86_64-rpms
gpgkey =
http://x.x.x.x/mariadb-10.2.6-rhel-7-x86_64-rpms/RPM-GPG-KEY/RPM-GPG-KEY-MariaDB
#
yum list 'MariaDB*' --disablerepo=* --enablerepo=MariaDB
Loaded plugins: fastestmirror
Loading mirror speeds from cached
hostfile
Installed Packages
mariadb-libs.x86_64
1:5.5.52-1.el7
@anaconda
Available Packages
MariaDB-aws-key-management.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-client.x86_64
10.2.6-1.el7.centos
MariaDB
MariaDB-common.x86_64
10.2.6-1.el7.centos
MariaDB
MariaDB-compat.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-connect-engine.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-cracklib-password-check.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-devel.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-gssapi-server.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-oqgraph-engine.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-rocksdb-engine.x86_64 10.2.6-1.el7.centos MariaDB
MariaDB-server.x86_64
10.2.6-1.el7.centos
MariaDB
MariaDB-shared.x86_64
10.2.6-1.el7.centos
MariaDB
MariaDB-tokudb-engine.x86_64 10.2.6-1.el7.centos MariaDB
|
.
yum으로 설치
dependency에서 perf,
rsync 관련 패키지가 추가로 설치된다.
|
#
yum install MariaDB-server MariaDB-client
...
Dependencies Resolved
=====================================================================================================================================================
Package Arch Version
Repository Size
=====================================================================================================================================================
Installing:
MariaDB-client x86_64 10.2.6-1.el7.centos MariaDB 48 M
MariaDB-compat x86_64 10.2.6-1.el7.centos MariaDB 2.8 M
replacing mariadb-libs.x86_64
1:5.5.52-1.el7
MariaDB-server x86_64 10.2.6-1.el7.centos MariaDB 108 M
Installing for dependencies:
MariaDB-common x86_64 10.2.6-1.el7.centos MariaDB 197 k
boost-program-options x86_64 1.53.0-26.el7 birepos 156 k
galera x86_64
25.3.20-1.rhel7.el7.centos MariaDB 8.0 M
lsof
x86_64
4.87-4.el7
birepos 331 k
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7
birepos 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 birepos 57 k
perl-DBI
x86_64
1.627-4.el7
birepos 802 k
perl-Data-Dumper x86_64 2.145-3.el7
birepos 47 k
perl-IO-Compress noarch 2.061-2.el7
birepos 260 k
perl-Net-Daemon noarch 0.48-5.el7
birepos 51 k
perl-PlRPC noarch 0.2020-14.el7 birepos 36 k
rsync
x86_64
3.0.9-17.el7
birepos 360 k
Transaction Summary
=====================================================================================================================================================
Install
3 Packages (+12 Dependent packages)
...
...
chown: invalid user: ‘mysql’
PLEASE REMEMBER TO SET A PASSWORD FOR THE
MariaDB root USER !
To do so, start the server, then issue
the following commands:
'/usr/bin/mysqladmin' -u root password
'new-password'
'/usr/bin/mysqladmin' -u root -h
bidevdruidm2.bidevclust password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of
removing the test
databases and anonymous user created by
default. This is
strongly recommended for production
servers.
See the MariaDB Knowledgebase at
http://mariadb.com/kb or the
MySQL manual for more instructions.
Please report any problems at
http://mariadb.org/jira
The latest information about MariaDB is
available at http://mariadb.org/.
You can find additional information about
the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and
vibrant community:
https://mariadb.org/get-involved/
Erasing :
1:mariadb-libs-5.5.52-1.el7.x86_64
16/16
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64
1/16
Verifying :
perl-Net-Daemon-0.48-5.el7.noarch
2/16
Verifying :
perl-Data-Dumper-2.145-3.el7.x86_64
3/16
Verifying :
lsof-4.87-4.el7.x86_64 4/16
Verifying :
MariaDB-client-10.2.6-1.el7.centos.x86_64
5/16
Verifying :
MariaDB-compat-10.2.6-1.el7.centos.x86_64
6/16
Verifying :
boost-program-options-1.53.0-26.el7.x86_64
7/16
Verifying :
perl-PlRPC-0.2020-14.el7.noarch
8/16
Verifying :
galera-25.3.20-1.rhel7.el7.centos.x86_64
9/16
Verifying :
MariaDB-common-10.2.6-1.el7.centos.x86_64
10/16
Verifying :
perl-DBI-1.627-4.el7.x86_64
11/16
Verifying :
MariaDB-server-10.2.6-1.el7.centos.x86_64
12/16
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64
13/16
Verifying :
rsync-3.0.9-17.el7.x86_64
14/16
Verifying :
perl-IO-Compress-2.061-2.el7.noarch
15/16
Verifying :
1:mariadb-libs-5.5.52-1.el7.x86_64 16/16
Installed:
MariaDB-client.x86_64 0:10.2.6-1.el7.centos MariaDB-compat.x86_64
0:10.2.6-1.el7.centos
MariaDB-server.x86_64 0:10.2.6-1.el7.centos
Dependency Installed:
MariaDB-common.x86_64 0:10.2.6-1.el7.centos boost-program-options.x86_64
0:1.53.0-26.el7 galera.x86_64
0:25.3.20-1.rhel7.el7.centos
lsof.x86_64 0:4.87-4.el7
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64
0:2.145-3.el7 perl-IO-Compress.noarch
0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch
0:0.2020-14.el7
rsync.x86_64 0:3.0.9-17.el7
Replaced:
mariadb-libs.x86_64 1:5.5.52-1.el7
|
.
data폴더 변경하여 설치하기
|
#
mkdir -p /data01/mysql
#
cd /data01/mysql
#
chown mysql:mysql .
#
cd /usr/bin
#
./mysql_install_db --datadir=/data01/mysql --user=mysql
Installing MariaDB/MySQL system tables in
'/data01/mysql' ...
OK
To start mysqld at boot time you have to
copy
support-files/mysql.server to the right
place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE
MariaDB root USER !
To do so, start the server, then issue
the following commands:
'/usr/bin/mysqladmin' -u root password
'new-password'
'/usr/bin/mysqladmin' -u root -h
bidevdruidm2.bidevclust password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of
removing the test
databases and anonymous user created by
default. This is
strongly recommended for production
servers.
See the MariaDB Knowledgebase at
http://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe
--datadir='/data01/mysql'
You can test the MariaDB daemon with
mysql-test-run.pl
cd '/usr/mysql-test' ; perl
mysql-test-run.pl
Please report any problems at
http://mariadb.org/jira
The latest information about MariaDB is
available at http://mariadb.org/.
You can find additional information about
the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and
vibrant community:
https://mariadb.org/get-involved/
|
. 기본
설정 파일 변경
|
#
vi /etc/my.cnf.d/server.cnf
[mysqld]
...
datadir = /data01/mysql
character_set_server=utf8
|
. 초기 root 비밀번호 설정
|
#
systemctl enable mariadb
#
systemctl start mariadb
#
./mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS
RECOMMENDED FOR ALL MySQL
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:
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.
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] 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!
|
. 서버
설치 환경 확인
|
#
mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.2.6-MariaDB MariaDB
Server
Copyright (c) 2000, 2017, Oracle, MariaDB
Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c'
to clear the current input statement.
MariaDB [(none)]> SHOW VARIABLES WHERE Variable_Name LIKE "%dir";
+---------------------------+----------------------------+
| Variable_name | Value |
+---------------------------+----------------------------+
| aria_sync_log_dir | NEWFILE |
| basedir | /usr/ |
| character_sets_dir | /usr/share/mysql/charsets/ |
|
datadir | /data01/mysql/ |
| innodb_data_home_dir | |
| innodb_log_arch_dir | |
| innodb_log_group_home_dir | ./ |
| innodb_tmpdir | |
| lc_messages_dir | |
| plugin_dir |
/usr/lib64/mysql/plugin/ |
| slave_load_tmpdir | /tmp |
| tmpdir | /tmp |
| wsrep_data_home_dir | /data01/mysql/ |
+---------------------------+----------------------------+
13 rows in set (0.00 sec)
MariaDB [(none)]> SHOW VARIABLES WHERE Variable_Name LIKE "%character%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
|
character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
|
. 원격접속
허용하기
원하는 경우 아래와 같이 root계정의 원격접속을 허용할 수 있다.
|
# mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.2.6-MariaDB MariaDB
Server
Copyright (c) 2000, 2017, Oracle, MariaDB
Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c'
to clear the current input statement.
MariaDB [(none)]> select host,user from mysql.user;
+---------------------------+------+
| host | user |
+---------------------------+------+
| 127.0.0.1 | root |
| ::1 | root |
| bidevkylint1.bikylinclust | root |
| localhost | root |
+---------------------------+------+
4 rows in set (0.00 sec)
MariaDB [(none)]> CREATE USER 'root'@'%' IDENTIFIED BY '비밀번호';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
MariaDB [(none)]> FLUSH PRIVILEGES;
|
댓글 없음:
댓글 쓰기