MariaDB 설치하기

Posted 2013. 2. 6. 15:21

오늘은 MariaDB를 사용 해 보려고 계획을 세웠습니다.


1. 우선 다운로드 합니다. 관련 문서가 많지만 영어가 되시는 분, 그리고 꼼꼼하신분은 읽어보시길...

https://downloads.mariadb.org/mariadb/5.5.29/

현재 기준으로 5.5.29가 Stable 버전입니다. 

설치할 OS에 맞는 패키지를 다운로드 해야 합니다. 

각 OS의 특성을 고려해서 패키지를 만든게 아닌가 생각되네요. 

DBMS의 특성상 OS에 최적화가 되지 않으면 성능을 내기 어려우니까요.(당연한 얘기인가요? ㅎㅎㅎ)

http://download.nus.edu.sg/mirror/mariadb/mariadb-5.5.29/


처음엔 다운로드를 해서 rpm으로 설치를 하려고 했다가 설치문서중에 yum 설치가 가능하다고 해서 급 계획 변경.

CentOS 5, 6, RHEL 5, 6, Fedora 16, 17 에서는 yum으로 설치할수도 있습니다.


/etc/yum.repos.d/MariaDB.repo 파일을 생성합니다.


[root@TestFtp yum.repos.d]# vi MariaDB.repo 


# MariaDB.repo


[mariadb]

name=MariaDB

baseurl=http://yum.mariadb.org/5.5/centos6-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1


잠깐~ 혹시 기존에 MySQL이 설치되어 있었다면 먼저 제거합니다. 

yum remove mysql


yum install MariaDB

===========================================================================================

 Package                 Arch            Version                    Repository        Size

===========================================================================================

Installing:

 MariaDB-compat          x86_64          5.5.29-1                   mariadb          2.7 M

     replacing  mysql-libs.x86_64 5.1.66-2.el6_3

 MariaDB-server          x86_64          5.5.29-1                   mariadb           33 M

     replacing  mysql.x86_64 5.1.66-2.el6_3

     replacing  mysql-server.x86_64 5.1.66-2.el6_3

Installing for dependencies:

 MariaDB-common          x86_64          5.5.29-1                   mariadb           23 k

 libaio                  x86_64          0.3.107-10.el6             base              21 k


Transaction Summary

===========================================================================================

Install       4 Package(s)


처음 y 를 입력하면 GPG key를 Import 합니다.

Downloading Packages:

warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 1bb943db: NOKEY

Retrieving key from https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Importing GPG key 0x1BB943DB:

 Userid: "Daniel Bartholomew (Monty Program signing key) <dbart@askmonty.org>"

 From  : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB


테스트를 하려면 MariaDB-Client도 설치합니다.

설치가 완료되면 접속을 해봅니다.

[root@TestDB ~]# mysql -u root -p

Enter password: 

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 3

Server version: 5.5.29-MariaDB MariaDB Server


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


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


MariaDB [(none)]> 

비밀번호는 root의 시스템 비밀번호를 그대로 사용합니다.

사용은 MySQL 명령어를 그대로 사용합니다.


SQLyog에서 테이블 생성시 지원하는 Table type을 살펴봤습니다.


[MySQL 5.5 Table type]


[MariaDB 5.5 Table type]


위의 MySQL5.5, 아래의 MariaDB5.5 비교입니다.

Default Table type 은  MySQL5.5와 마찬가지로 InnoDB입니다.

좀더 자세히 알아보기 위해 show engines 결과를 뽑아 봤습니다.

MariaDB [(none)]> show engines;

+--------------------+---------+------------------------------------------------+--------------+------+------------+

| Engine             | Support | Comment                                                                    | Transactions | XA   | Savepoints |

+--------------------+---------+------------------------------------------------+--------------+------+------------+

| CSV                | YES     | CSV storage engine                                                       | NO           | NO   | NO         |

| MRG_MYISAM  | YES     | Collection of identical MyISAM tables                              | NO           | NO   | NO         |

| MyISAM           | YES     | MyISAM storage engine                                                 | NO           | NO   | NO         |

| BLACKHOLE     | YES     | /dev/null storage engine (anything you write to it disappears)  | NO     | NO   | NO         |

| MEMORY         | YES     | Hash based, stored in memory, useful for temporary tables | NO           | NO   | NO         |

| FEDERATED     | YES     | FederatedX pluggable storage engine                               | YES         | NO   | YES       |

| ARCHIVE         | YES     | Archive storage engine                                                    | NO           | NO   | NO        |

| InnoDB           | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES  | YES        |

| PERFORMANCE_SCHEMA | YES     | Performance Schema                                       | NO           | NO   | NO        |

| Aria                | YES     | Crash-safe tables with MyISAM heritage                             | NO           | NO   | NO        |

+----------------+---------+---------------------------------------------------+--------------+------+------------+


MySQL과 비교해서 눈에 띄는 엔진형식은 Aria 입니다.  

Aria에 대해서는 좀더 알아봐야겠습니다.

Aria storage engine 은 처음엔 Maria 로 불렸다가 혼란성을 줄이기 위해서 Aria로 변경되었습니다.

MariaDB 5.1 에선 MyISAM대신 Default Storage engine으로 사용되었습니다.

Comment를 보면 Crash-safe table 이라고 되어 있습니다. 보통 MyISAM을 사용하다보면 Table Crash 가 나는 경우가 있고 정기 점검하면서 이를 체크하곤 합니다. 또는 CHECKSUM=1 옵션을 주기도 하지요.

그냥 겉보기엔 MyISAM + CHECKSUM 인 Storage engine이 아닌가 생각됩니다.

그외 MyISAM에 비해 캐싱을 많이 하여 GROUP BY, DISTINCT에 대한 속도가 좋다고 합니다. 


Aria Storage Engine 에 대한 자세한 설명은 다음 링크를 참고

https://kb.askmonty.org/en/aria/


역시 MySQL과의 호환성을 무기로 내세울만 합니다.

MariaDB와 MySQL과의 버전별 호환성 / 비호환성에 대한 자세한 내용은 다음링크를 참고하세요.

https://kb.askmonty.org/en/mariadb-versus-mysql-compatibility/



다음엔 기존 MySQL과의 호환성여부를 체크해 보도록 하겠습니다.




MySQL 이 오라클로 넘어가면서 MySQL을 개발한 유명한 개발자 몬티 와이드니우스가 나와서 새롭게 만들어 발전시키고 있는  MariaDB 에 대해 알아봐야할것 같습니다.

 

- KTH 개발자 블로그에 소개된 MariaDB 입니다.

http://dev.kthcorp.com/2012/06/21/mariadb-mysql-twins/

 

- 최근 몬티 와이드니우스와 인터뷰한 내용입니다.

http://www.bloter.net/archives/142487

 

- MariaDB 홈페이지입니다.

https://mariadb.org/

 

정체되어 있는 MySQL과 다르게 이미 성능면에서도 MySQL을 앞서가고 있는 듯 합니다.

사용법은 기존 MySQL과 거의 동일하다고 하니 기존 MySQL을 썼던 많은 사이트들이 옮겨가지 않을까 생각합니다.

한번 사용해 봐야겠습니다.

 

한편으로는 오라클의 폐쇄적인 정책이 그동안 MySQL의 그늘에서 가려있던 다른 오픈소스 DBMS에게는 더없는 기회가 될수도 있을것 같습니다. MySQL을 버리고 MariaDB가 아닌 다른 DB를 선택하는 사이트도 많을 것이기 때문입니다.


 

'DBMS' 카테고리의 다른 글

MariaDB vs MySQL과의 호환성 체크  (1) 2013.02.06
MariaDB 설치하기  (0) 2013.02.06
Oracle 11g client설치 관련  (0) 2012.06.04
[펌] oracle 11g 설치와 operating, dml, ddl 명령어 요약  (0) 2012.05.10
분산DB에 대한 연구중...  (0) 2010.11.24


원본 : http://dev.mysql.com/doc/refman/5.0/en/procedure-analyse.html

8.8.2. Using PROCEDURE ANALYSE

ANALYSE([max_elements[,max_memory]])

ANALYSE() examines the result from a query and returns an analysis of the results that suggests optimal data types for each column that may help reduce table sizes. To obtain this analysis, append PROCEDURE ANALYSE to the end of a SELECT statement:

SELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])

For example:

SELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);

The results show some statistics for the values returned by the query, and propose an optimal data type for the columns. This can be helpful for checking your existing tables, or after importing new data. You may need to try different settings for the arguments so that PROCEDURE ANALYSE() does not suggest the ENUM data type when it is not appropriate.

The arguments are optional and are used as follows:

  • max_elements (default 256) is the maximum number of distinct values that ANALYSE() notices per column. This is used by ANALYSE() to check whether the optimal data type should be of type ENUM; if there are more than max_elements distinct values, then ENUM is not a suggested type.

  • max_memory (default 8192) is the maximum amount of memory that ANALYSE() should allocate per column while trying to find all distinct values.

 

처음 DB를 구성해서 일정기간 사용하다보면 특정 테이블에 데이터가 편중되고, 그러다 보면 해당 테이블 때문에 병목현상이 발생하는 경우가 종종 있다. 그때부터 해당 테이블을 어떻게 커스터마이징 해야할까 고민하게 되고 각 컬럼이 제대로 사용되는지 체크해보고 싶은 욕구가 생긴다. 가령 VARCHAR(100) 으로 선언했음에도 불구하고  실제 데이터는 20 byte 미만으로 사용된다면 해당 컬럼의 선언은 굳이 varchar(100) 이 아니라 varchar(20)으로 하는것이 좋다는 것은 누구나 아는 사실이다.

이를 분석하기 위한 방법이 바로 PROCEDURE ANALYSE 이다.

 

 



« PREV : 1 : ··· : 3 : 4 : 5 : 6 : 7 : 8 : 9 : ··· : 22 : NEXT »