Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Python
- es6
- Eclipse
- NPM
- Java
- SPC
- R
- tomcat
- 공정능력
- GIT
- window
- SSL
- Express
- Sqoop
- plugin
- Spring
- mybatis
- hadoop
- IntelliJ
- MSSQL
- Kotlin
- react
- vaadin
- 보조정렬
- xPlatform
- JavaScript
- table
- mapreduce
- Android
- SQL
Archives
- Today
- Total
DBILITY
centos 7 mariadb install 본문
반응형
tajo catalog로 사용할 db가 필요했다. PostgreSQL을 쓰자니 경험이 일천하다.
회사 업무용은 PostgreSQL로 대체하기로 했는데..framework은 거의 준비가 되었다만..
apm사용하던때는 mysql compile도 많이 했는데,configure....
mariadb는 처음이다.cmake를 쓰는구만.
make file 생성인지 check인지 하는 중에 library 오류가 나면 찾아서 설치해 준다.
엄청 오래 걸린다..테스트용도는 그냥 rpm이나 binary버전으로 설치하는게 좋겠다.
그나저나 개발자는 참 좋은 아빠다.
딸들이름을 개발제품에 쓸 정도니까ㅎㅎ
나는 어떤 아빠일까...
https://mariadb.com/kb/en/library/Build_Environment_Setup_for_Linux/
https://mariadb.com/kb/en/library/generic-build-instructions/
https://mariadb.com/kb/en/library/compiling-mariadb-with-vanilla-xtradb/
[root@big-slave2 src]# wget http://ftp.kaist.ac.kr/mariadb/mariadb-10.2.14/source/mariadb-10.2.14.tar.gz
--2018-04-16 09:51:10-- http://ftp.kaist.ac.kr/mariadb/mariadb-10.2.14/source/mariadb-10.2.14.tar.gz
Resolving ftp.kaist.ac.kr (ftp.kaist.ac.kr)... 103.22.220.133
Connecting to ftp.kaist.ac.kr (ftp.kaist.ac.kr)|103.22.220.133|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 72607526 (69M) [application/gzip, application/x-gzip]
Saving to: ‘mariadb-10.2.14.tar.gz’
100%[=======================================================>] 72,607,526 11.2MB/s in 6.2s
2018-04-16 09:51:16 (11.2 MB/s) - ‘mariadb-10.2.14.tar.gz’ saved [72607526/72607526]
[root@big-slave2 src]# ll
total 70908
-rw-r--r--. 1 root root 72607526 Mar 27 01:41 mariadb-10.2.14.tar.gz
[root@big-slave2 src]# tar -zxpf mariadb-10.2.14.tar.gz
[root@big-slave2 src]# ll
total 70912
drwxrwxr-x. 33 zookeeper zookeeper 4096 Mar 27 01:41 mariadb-10.2.14
-rw-r--r--. 1 root root 72607526 Mar 27 01:41 mariadb-10.2.14.tar.gz
[root@big-slave2 src]# adduser mysql; echo 'mysql' | passwd --stdin mysql ; usermod -G datagroup mysql
Changing password for user mysql.
passwd: all authentication tokens updated successfully.
[root@big-slave2 src]# chown root.root mariadb-10.2.14
[root@big-slave2 src]# ll
total 70912
drwxrwxr-x. 33 root root 4096 Mar 27 01:41 mariadb-10.2.14
-rw-r--r--. 1 root root 72607526 Mar 27 01:41 mariadb-10.2.14.tar.gz
[root@big-slave2 src]# mkdir build-mariadb
[root@big-slave2 src]# cd build-mariadb/
[root@big-slave2 build-mariadb]# cmake ../mariadb-10.2.14 -DWITH_READLINE=ON \
-DWITH_SSL=bundled -DWITH_ZLIB=system \
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=ON -DWITH_EXTRA_CHARSETS=all \
-DWITH_ARIA_STORAGE_ENGINE=OFF -DWITH_XTRADB_STORAGE_ENGINE=ON \
-DWITH_ARCHIVE_STORAGE_ENGINE=OFF -DWITH_INNOBASE_STORAGE_ENGINE=OFF \
-DWITH_PARTITION_STORAGE_ENGINE=OFF -DWITH_BLACKHOLE_STORAGE_ENGINE=OFF \
-DWITH_FEDERATEDX_STORAGE_ENGINE=OFF -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \
-DCMAKE_INSTALL_PREFIX=/bigdata/mariadb \
-DMYSQL_DATADIR=/bigdata/repository/mariadb/data
#시간이 오래 걸리니 백그라운드 실행
[root@big-slave2 build-mariadb]# nohup make &
#진행상황을 보고 싶다면
[root@big-slave2 build-mariadb]# tail -f nohup.out
[root@big-slave2 build-mariadb]# nohup make install &
#tajo catalog 테스트용으로 최소 환경으로..
[root@big-slave2 build-mariadb]# vi /etc/profile
export MARIADB_HOME=/bigdata/mariadb
export PATH=$PATH:$MARIADB_HOME/bin
:wq!
[root@big-slave2 build-mariadb]# source /etc/profile
[root@big-slave2 build-mariadb]# cp /mariadb/support-files/my-small.cnf /etc/my.cnf
[root@big-slave2 build-mariadb]# vi /etc/my.cnf
# The MySQL server
[mysqld]
datadir = /bigdata/repository/mariadb/data
:wq!
[root@big-slave2 build-mariadb]# chown -R mysql.mysql /bigdata/mariadb/
[root@big-slave2 build-mariadb]# /mariadb/scripts/mysql_install_db --user=mysql \
--basedir=/mariadb --datadir=/bigdata/repository/mariadb/data
Installing MariaDB/MySQL system tables in '/bigdata/repository/mariadb/data' ...
OK
[root@big-slave2 build-mariadb]# touch /etc/systemd/system/mariadb.service
[root@big-slave2 build-mariadb]# vi /etc/systemd/system/mariadb.service
[Unit]
Description = MariaDB Server ( ver 10.2.14 )
After = syslog.target network.target
[Service]
Type = forking
User = mysql
Group = mysql
ExecStart = /mariadb/support-files/mysql.server start
ExecReload = /mariadb/support-files/mysql.server restart
ExecStop = /mariadb/support-files/mysql.server stop
[Install]
WantedBy = multi-user.target
:wq!
[root@big-slave2 build-mariadb]# systemctl daemon-reload
[root@big-slave2 build-mariadb]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /etc/systemd/system/mariadb.service.
[root@big-slave2 build-mariadb]# systemctl start mariadb
[root@big-slave2 build-mariadb]# systemctl status mariadb
● mariadb.service - MariaDB Server ( ver 10.2.14 )
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-04-19 20:52:22 KST; 8s ago
Process: 11553 ExecStart=/mariadb/support-files/mysql.server start (code=exited, status=0/SUCCESS)
Main PID: 11563 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─11563 /bin/sh /mariadb/bin/mysqld_safe --datadir=/bigdata/repository/mariadb/data --pid-file=/bigdata/repository/mariadb/data/big-slave2.pi...
└─11675 /mariadb/bin/mysqld --basedir=/mariadb --datadir=/bigdata/repository/mariadb/data --plugin-dir=/mariadb/lib/plugi...
Apr 19 20:52:21 big-slave2 systemd[1]: Starting MariaDB Server ( ver 10.2.14 )...
Apr 19 20:52:21 big-slave2 mysql.server[11553]: Starting MariaDB.180419 20:52:21 mysqld_safe Logging to '/bigdata/repository/mariadb/data/big-slave2.err'.
Apr 19 20:52:21 big-slave2 mysql.server[11553]: 180419 20:52:21 mysqld_safe Starting mysqld daemon with databases from /bigdata/repository/mariadb/data
Apr 19 20:52:22 big-slave2 mysql.server[11553]: SUCCESS!
Apr 19 20:52:22 big-slave2 systemd[1]: Started MariaDB Server ( ver 10.2.14 ).
[root@big-slave2 build-mariadb]# mysql_secure_installation
[root@big-slave2 build-mariadb]# systemctl restart mariadb
[root@big-slave2 build-mariadb]# mysql -uroot -p -e "select @@version; show databases"
Enter password:
+-----------------+
| @@version |
+-----------------+
| 10.2.14-MariaDB |
+-----------------+
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
[root@big-slave2 build-mariadb]# mysql -uroot -p -e 'SHOW VARIABLES WHERE Variable_Name = "datadir"'
Enter password:
+---------------+-----------------------------------+
| Variable_name | Value |
+---------------+-----------------------------------+
| datadir | /bigdata/repository/mariadb/data/ |
+---------------+-----------------------------------+
[root@big-slave2 build-mariadb]# mysql -u root -p mysql
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.2.14-MariaDB Source distribution
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 [mysql]> create database tajo;
Query OK, 1 row affected (0.00 sec)
MariaDB [mysql]> grant all privileges on tajo.* to tajo@localhost identified by 'tajo' with grant option;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> grant all privileges on tajo.* to tajo@"big-master" identified by 'tajo' with grant option;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> grant all privileges on tajo.* to tajo@"big-slave1" identified by 'tajo' with grant option;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
#tajo ha ,catalog db를 mariadb구성 후 시작하고나면 아래와 같이 테이블이 생성되어 있다.
[tajo@big-slave2 ~]$ mysql -u tajo -p tajo
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.2.14-MariaDB Source distribution
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 [tajo]> show tables;
+-------------------+
| Tables_in_tajo |
+-------------------+
| COLUMNS |
| DATABASES_ |
| INDEXES |
| META |
| OPTIONS |
| PARTITIONS |
| PARTITION_KEYS |
| PARTITION_METHODS |
| STATS |
| TABLES |
| TABLESPACES |
+-------------------+
11 rows in set (0.00 sec)
MariaDB [tajo]>
#예전에 주로 사용했던 시작과 종료...
[root@big-slave2 /]# /usr/local/mariadb/bin/safe_mysqld &
[root@big-slave2 /]# /usr/local/mariadb/bin/mysqladmin -uroot -p shutdown
패키지로 설치 해보자. datadir변경때문에 해봤다.
[root@big-slave2 /]# cat > MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
^D
[root@big-slave2 yum.repos.d]# yum install MariaDB-server -y
[root@big-slave2 yum.repos.d]# rpm -qa | grep Maria
MariaDB-server-10.1.32-1.el7.centos.x86_64
MariaDB-common-10.1.32-1.el7.centos.x86_64
MariaDB-client-10.1.32-1.el7.centos.x86_64
[root@big-slave2 yum.repos.d]# systemctl enable mariadb
[root@big-slave2 yum.repos.d]# systemctl start mariadb
[root@big-slave2 yum.repos.d]# mysql_secure_installation
[root@big-slave2 yum.repos.d]# systemctl restart mariadb
[root@big-slave2 yum.repos.d]# mysql -uroot -p -e "select @@version; show databases"
Enter password:
+-----------------+
| @@version |
+-----------------+
| 10.1.32-MariaDB |
+-----------------+
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
[root@big-slave2 yum.repos.d]# systemctl stop mariadb
[root@big-slave2 yum.repos.d]# usermod -G datagroup mysql
[root@big-slave2 yum.repos.d]# mkdir -p /bigdata/repository/mariadb/data
[root@big-slave2 yum.repos.d]# chmod 775 -R mariadb
[root@big-slave2 yum.repos.d]# chown -r mysql.mysql /bigdata/repository/mariadb
[root@big-slave2 yum.repos.d]# cp -Rp /var/lib/mysql/* /bigdata/repository/mariadb/data/
[root@big-slave2 yum.repos.d]# semanage fcontext -a -t mysqld_db_t "/bigdata/repository/mariadb(/.*)?"
[root@big-slave2 yum.repos.d]# restorecon -Rv /bigdata/repository/mariadb
[root@big-slave2 yum.repos.d]# vi /etc/my.cnf.d/server.cnf
[mysqld]
datadir=/bigdata/repository/mariadb/data
socket=/bigdata/repository/mariadb/mariadb.sock
:wq!
[root@big-slave2 yum.repos.d]# vi /etc/my.cnf.d/mysql-clients.cnf
[mysql]
socket=/bigdata/repository/mariadb/mariadb.sock
:wq!
[root@big-slave2 yum.repos.d]# systemctl start mariadb
[root@big-slave2 yum.repos.d]# mysql -uroot -p -e 'SHOW VARIABLES WHERE Variable_Name = "datadir"'
Enter password:
+---------------+-----------------------------------+
| Variable_name | Value |
+---------------+-----------------------------------+
| datadir | /bigdata/repository/mariadb/data/ |
+---------------+-----------------------------------+
[root@big-slave2 yum.repos.d]#
[root@big-slave2 yum.repos.d]# systemctl status mariadb
● mariadb.service - MariaDB 10.1.32 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Thu 2018-04-19 14:58:34 KST; 2min 4s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 5705 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 5659 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 5657 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 5677 (mysqld)
Status: "Taking your SQL requests now..."
CGroup: /system.slice/mariadb.service
└─5677 /usr/sbin/mysqld
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716819310848 [Note] InnoDB: Highest supported file format is Barracuda.
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716819310848 [Note] InnoDB: 128 rollback segment(s) are active.
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716819310848 [Note] InnoDB: Waiting for purge to start
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716819310848 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.38-83.0 started; log se...ber 1616737
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716030293760 [Note] InnoDB: Dumping buffer pool(s) not yet started
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716819310848 [Note] Plugin 'FEEDBACK' is disabled.
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716819310848 [Note] Server socket created on IP: '::'.
Apr 19 14:58:34 big-slave2 mysqld[5677]: 2018-04-19 14:58:34 140716819310848 [Note] /usr/sbin/mysqld: ready for connections.
Apr 19 14:58:34 big-slave2 mysqld[5677]: Version: '10.1.32-MariaDB' socket: '/bigdata/repository/mariadb/mariadb.sock' port: 3306 MariaDB Server
Apr 19 14:58:34 big-slave2 systemd[1]: Started MariaDB 10.1.32 database server.
[root@big-slave2 yum.repos.d]# rm -rf /var/lib/mysql/
[root@big-slave2 yum.repos.d]# mysql -u root -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.1.32-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 [mysql]> create database tajo;
Query OK, 1 row affected (0.00 sec)
MariaDB [mysql]> grant all privileges on tajo.* to tajo@localhost identified by 'tajo' with grant option;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> grant all privileges on tajo.* to tajo@"big-master" identified by 'tajo' with grant option;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> grant all privileges on tajo.* to tajo@"big-slave1" identified by 'tajo' with grant option;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
#tajo ha ,catalog db를 mariadb구성 후 시작하고나면 아래와 같이 테이블이 생성되어 있다.
MariaDB [tajo]> show tables;
+-------------------+
| Tables_in_tajo |
+-------------------+
| COLUMNS |
| DATABASES_ |
| INDEXES |
| META |
| OPTIONS |
| PARTITIONS |
| PARTITION_KEYS |
| PARTITION_METHODS |
| STATS |
| TABLES |
| TABLESPACES |
+-------------------+
11 rows in set (0.00 sec)
반응형
Comments