'Adding MySQL Cluster Data Nodes Online'에 해당되는 글 1건



Adding MySQL Cluster Data Nodes Online

   

  • MySQL 클러스터 온라인 데이터 노드 추가가 가능하도록 지원을 시작하고 있다.
  • MySQL Cluster Data Nodes Online 추가가 가능한 버전은 MySQL Cluster NDB 6.4.0 (This capability is available in MySQL Cluster NDB 7.0 (beginning with MySQL Cluster NDB 6.4.0) and later MySQL Cluster release series.) 이상부터 가능한 것으로 확인되며 공식문서를 참고하여 문서를 정리하였습니다.

       

Step 1: Update configuration file.

the cluster uses a config.ini file

   

[ndbd default]

…..

[ndbd]

….

Id = 7

HostName = *.*.*.4 (TEST IP)

datadir=/usr/local/mysql-cluster/ndbd-data

ArbitrationRank=3

   

Id = 8

HostName = *.*.*.5 (TEST IP)

datadir=/usr/local/mysql-cluster/ndbd-data

ArbitrationRank=4

   

Step 2: Restart the management server

1) Stop the management server using the management client STOP command, as shown here:

   

ndb_mgm> 10 STOP

Node 10 has shut down.

Disconnecting to allow Management Server to shutdown

   

shell>

   

2) Because shutting down the management server causes the management client to terminate, you must start the management server from the system shell.

shell> ndb_mgmd -f config.ini --reload

2008-12-08 17:29:23 [MgmSrvr] INFO -- NDB Cluster Management Server. 5.1.73-ndb-7.1.36

2008-12-08 17:29:23 [MgmSrvr] INFO -- Reading cluster configuration from 'config.ini'

   

3) status check

   

ndb_mgm> show

Cluster Configuration

---------------------

[ndbd(NDB)] 2 node(s)

id=3 @*.*.*.1 (mysql-5.1.34 ndb-6.3.25, Nodegroup: 0)

id=4 @*.*.*.2 (mysql-5.1.34 ndb-6.3.25, Nodegroup: 0, Master)

id=7 (not connected, accepting connect from 10.0.0.4)

id=8 (not connected, accepting connect from 10.0.0.5)

   

[ndb_mgmd(MGM)] 1 node(s)

id=1 @*.*.*.3 (mysql-5.1.34 ndb-6.3.25)

   

[mysqld(API)] 2 node(s)

id=5 @*.*.*.1 (mysql-5.1.34 ndb-6.3.25)

id=6 @*.*.*.2 (mysql-5.1.34 ndb-6.3.25)

 

Step 3: Perform a rolling restart of the existing data nodes.

ndb_mgm> 1 RESTART

Node 1: Node shutdown initiated

Node 1: Node shutdown completed, restarting, no start.

Node 1 is being restarted

   

ndb_mgm> Node 1: Start initiated (version 7.1.36)

Node 1: Started (version 7.1.36)

   

ndb_mgm> 2 RESTART

Node 2: Node shutdown initiated

Node 2: Node shutdown completed, restarting, no start.

Node 2 is being restarted

   

ndb_mgm> Node 2: Start initiated (version 7.1.36)

   

ndb_mgm> Node 2: Started (version 7.1.36)

   

Step 4: Perform a rolling restart of all cluster API nodes.

shell> mysqladmin -uroot -ppassword shutdown

081208 20:19:56 mysqld_safe mysqld from pid file

/usr/local/mysql/var/tonfisk.pid ended

   

shell> mysqld_safe --ndbcluster --ndb-connectstring=*.*.*.3 &

081208 20:20:06 mysqld_safe Logging to '/usr/local/mysql/var/tonfisk.err'.

081208 20:20:06 mysqld_safe Starting mysqld daemon with databases

from /usr/local/mysql/var

   

Step 5: Perform an initial start of the new data nodes.

shell> ndbd -c 10.0.0.3 --initial

ndb_mgm> show

Cluster Configuration

---------------------

[ndbd(NDB)] 2 node(s)

id=3 @*.*.*.1 (mysql-5.1.34 ndb-6.3.25, Nodegroup: 0)

id=4 @*.*.*.2 (mysql-5.1.34 ndb-6.3.25, Nodegroup: 0, Master)

id=7 @*.*.*.7 (mysql-5.1.34 ndb-6.3.25, no nodegroup)

id=8 @*.*.*.8 (mysql-5.1.34 ndb-6.3.25, no nodegroup)

   

[ndb_mgmd(MGM)] 1 node(s)

id=1 @*.*.*.3 (mysql-5.1.34 ndb-6.3.25)

   

[mysqld(API)] 2 node(s)

id=5 @*.*.*.1 (mysql-5.1.34 ndb-6.3.25)

id=6 @*.*.*.2 (mysql-5.1.34 ndb-6.3.25)

   

Step 6: Create a new node group

ndb_mgm> CREATE NODEGROUP 7,8

Nodegroup 1 created

   

ndb_mgm> show

Cluster Configuration

---------------------

[ndbd(NDB)] 2 node(s)

id=3 @*.*.*.1 (mysql-5.1.34 ndb-6.3.25, Nodegroup: 0)

id=4 @*.*.*.2 (mysql-5.1.34 ndb-6.3.25, Nodegroup: 0, Master)

id=7 @*.*.*.7 (mysql-5.1.34 ndb-6.3.25, 1)

id=8 @*.*.*.8 (mysql-5.1.34 ndb-6.3.25, 1)

   

[ndb_mgmd(MGM)] 1 node(s)

id=1 @*.*.*.3 (mysql-5.1.34 ndb-6.3.25)

   

[mysqld(API)] 2 node(s)

id=5 @*.*.*.1 (mysql-5.1.34 ndb-6.3.25)

id=6 @*.*.*.2 (mysql-5.1.34 ndb-6.3.25)

   

Step 7: Redistribute cluster data.

ndb_mgm> all report mem

  Node 2: Data usage is 5%(176 32K pages of total 3200)

  Node 2: Index usage is 0%(76 8K pages of total 12832)

  Node 3: Data usage is 5%(176 32K pages of total 3200)

  Node 3: Index usage is 0%(76 8K pages of total 12832)

   

Node 7: Data usage is 0%(0 32K pages of total 192000)

Node 7: Index usage is 0%(0 8K pages of total 192032)

Node 8: Data usage is 0%(0 32K pages of total 192000)

Node 8: Index usage is 0%(0 8K pages of total 192032)

   

shell> ndb_desc -c *.*.*.3 -d n ips -p

- ips --

Version: 1

Fragment type: 9

K Value: 6

Min load factor: 78

Max load factor: 80

...

   

-- Per partition info --

Partition Row count Commit count Frag fixed memory Frag varsized memory

0 26086 26086 1572864 557056

1 26329 26329 1605632 557056

   

   

1) Table Redistribute

- 대상 테이블명 확인

SELECT TABLE_SCHEMA, TABLE_NAME

FROM INFORMATION_SCHEMA.TABLES

WHERE ENGINE = 'NDBCLUSTER';

   

- 테이블 복제

mysql> ALTER ONLINE TABLE [DB명].[테이블명] REORGANIZE PARTITION;

   

- Redistribute 확인

shell> ndb_desc -d [DB명] [테이블명] -c *.*.*.3:port -pn

shell> ndb_desc -c *.*.*.10 -d n ips -p

-- ips --

Version: 16777217

Fragment type: 9

K Value: 6

Min load factor: 78

Max load factor: 80

-- Per partition info --

Partition Row count Commit count Frag fixed memory Frag varsized memory

0 12981 52296 1572864 557056

1 13236 52515 1605632 557056

2 13105 13105 819200 294912

3 13093 13093 819200 294912

   

ndb_mgm> all report mem

Node 2: Data usage is 5%(176 32K pages of total 3200)

Node 2: Index usage is 0%(76 8K pages of total 12832)

Node 3: Data usage is 5%(176 32K pages of total 3200)

Node 3: Index usage is 0%(76 8K pages of total 12832)

Node 7: Data usage is 2%(80 32K pages of total 3200)

Node 7: Index usage is 0%(51 8K pages of total 12832)

Node 8: Data usage is 2%(80 32K pages of total 3200)

  Node 8: Index usage is 0%(50 8K pages of total 12832)

   

   

[참고 사이트]

원본 위치 <https://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-online-add-node.html>


블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,