Loading...
MySQL 9.5 Reference Manual 9.5의 25.4.1 Quick Test Setup of NDB Cluster의 한국어 번역본입니다.
아래의 경우에 피드백에서 신고해주신다면 반영하겠습니다.
감사합니다 :)
기본 사항에 익숙해지기 위해, 동작하는 NDB Cluster를 위한 가장 단순한 구성 예를 설명합니다. 이를 통해 이 장의 다른 관련 섹션들에 제공된 정보를 이용하여 원하는 설정을 설계할 수 있게 됩니다.
먼저, 시스템 root 사용자로 다음 명령을 실행하여 /var/lib/mysql-cluster와 같은 설정 디렉터리를 생성해야 합니다:
1$> mkdir /var/lib/mysql-cluster
이 디렉터리 안에 config.ini라는 이름의 파일을 생성하고, 다음 정보를 포함시킵니다. 여러분의 시스템에 맞게 HostName과 DataDir에 적절한 값을 대입하십시오.
1# file "config.ini" - showing minimal setup consisting of 1 data node, 2# 1 management server, and 3 MySQL servers. 3# The empty default sections are not required, and are shown only for 4# the sake of completeness. 5# Data nodes must provide a hostname but MySQL Servers are not required 6# to do so. 7# If you do not know the hostname for your machine, use localhost. 8# The DataDir parameter also has a default value, but it is recommended to 9# set it explicitly. 10# [api] and [mgm] are aliases for [mysqld] and [ndb_mgmd], respectively. 11 12[ndbd default] 13NoOfReplicas= 1 14 15[mysqld default] 16[ndb_mgmd default] 17[tcp default] 18 19[ndb_mgmd] 20HostName= myhost.example.com 21 22[ndbd] 23HostName= myhost.example.com 24DataDir= /var/lib/mysql-cluster 25 26[mysqld] 27[mysqld] 28[mysqld]
이제 ndb_mgmd 관리 서버를 시작할 수 있습니다. 기본적으로 현재 작업 디렉터리에서 config.ini 파일을 읽으려고 시도하므로, 파일이 위치한 디렉터리로 이동한 다음 ndb_mgmd를 실행합니다:
1$> cd /var/lib/mysql-cluster 2$> ndb_mgmd
그런 다음 ndbd를 실행하여 단일 데이터 노드를 시작합니다:
1$> ndbd
기본적으로 ndbd는 localhost의 포트 1186에서 관리 서버를 찾습니다.
참고
MySQL을 바이너리 타르볼로 설치한 경우, ndb_mgmd와 ndbd 서버의 경로를 명시적으로 지정해야 합니다. (보통 이들은 /usr/local/mysql/bin에 있습니다.)
마지막으로 MySQL 데이터 디렉터리(보통 /var/lib/mysql 또는 /usr/local/mysql/data)로 이동하여, my.cnf 파일에 NDB 스토리지 엔진을 활성화하는 데 필요한 옵션이 포함되어 있는지 확인합니다:
1[mysqld] 2ndbcluster
이제 평소처럼 MySQL 서버를 시작할 수 있습니다:
1$> mysqld_safe --user=mysql &
잠시 기다려 MySQL 서버가 제대로 실행되고 있는지 확인하십시오. mysql ended라는 알림이 보이면, 서버의 .err 파일을 확인하여 무엇이 잘못되었는지 확인하십시오.
지금까지 모든 것이 잘 진행되었다면, 이제 클러스터를 사용하기 시작할 수 있습니다. 서버에 접속하여 NDBCLUSTER 스토리지 엔진이 활성화되어 있는지 확인합니다:
1$> mysql 2Welcome to the MySQL monitor. Commands end with ; or \g. 3Your MySQL connection id is 1 to server version: 9.5.0 4 5Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 6 7mysql> SHOW ENGINES\G 8... 9*************************** 12. row *************************** 10Engine: NDBCLUSTER 11Support: YES 12Comment: Clustered, fault-tolerant, memory-based tables 13*************************** 13. row *************************** 14Engine: NDB 15Support: YES 16Comment: Alias for NDBCLUSTER 17...
앞선 예제 출력에 표시된 행 번호는 서버의 설정에 따라 여러분의 시스템에서 보여지는 것과 다를 수 있습니다.
NDBCLUSTER 테이블을 하나 만들어 보십시오:
1$> mysql 2mysql> USE test; 3Database changed 4 5mysql> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER; 6Query OK, 0 rows affected (0.09 sec) 7 8mysql> SHOW CREATE TABLE ctest \G 9*************************** 1. row *************************** 10 Table: ctest 11Create Table: CREATE TABLE `ctest` ( 12 `i` int(11) default NULL 13) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci 141 row in set (0.00 sec)
노드가 올바르게 설정되었는지 확인하려면, 관리 클라이언트를 시작하십시오:
1$> ndb_mgm
관리 클라이언트 내에서 SHOW 명령을 사용하여 클러스터 상태에 대한 보고를 얻습니다:
1ndb_mgm> SHOW 2Cluster Configuration 3--------------------- 4[ndbd(NDB)] 1 node(s) 5id=2 @127.0.0.1 (Version: 9.4.0-ndb-9.4.0, Nodegroup: 0, *) 6 7[ndb_mgmd(MGM)] 1 node(s) 8id=1 @127.0.0.1 (Version: 9.4.0-ndb-9.4.0) 9 10[mysqld(API)] 3 node(s) 11id=3 @127.0.0.1 (Version: 9.4.0-ndb-9.4.0) 12id=4 (not connected, accepting connect from any host) 13id=5 (not connected, accepting connect from any host)
이 시점에서, 동작하는 NDB Cluster를 성공적으로 설정한 것입니다. 이제 ENGINE=NDBCLUSTER 또는 그 별칭인 ENGINE=NDB로 생성된 테이블을 사용하여 클러스터에 데이터를 저장할 수 있습니다.
25.4 Configuration of NDB Cluster
25.4.2 Overview of NDB Cluster Configuration Parameters, Options, and Variables