MySQL Cluster Quick Start Guide - LINUX(CentOS), mysql 클러스터 세팅


속도나 비용면에서 mySQL이 좋은거 같고, 그 중에 클러스터 방법이 게임서버에 적절한 DB인거 같다.

설치하기 전에 참고로 내 컴퓨터 제 소프트/하드 웨어 사양이다.


OS: Windows 2008 R2 x64 Enterprise (full) Terminal (Remote User)   V6.01  Build 7601  Service Pack 1

CPU: Intel Core i7 Quad 2600 (Sandy Bridge) 3.40GHz [D2]

RAM: 4.00GB




1. VMware Player 설치 (ver. 5.0.1)

설치 링크: 링크


2. CentOS ISO이미지 다운 받기 (ver. 6.3)

실치 링크: 링크






이 근처에 있는거 아무거나들어가서 6.3을 다운 받으면 됨




3. VMware로 CentOS 설치하기~






Customize Hardware를 누르면 하드웨어 세팅을 할 수 있는데 원한다면 더 고사양이나 저사양으로 세팅하면 됨~


4. CentOS에서 Cluster 돌리기








set.zip에 cmd.txt에 있는 명령어를 한번 실행해주면 된다.

아래 "set.zip"에 실제로 세팅에 사용했던 파일을 업로드 해뒀다. 참고하면 된다.

set.zip


 - cmd.txt -

 -Run-

[user1@localhost ~]$ cd ~

[user1@localhost ~]$ tar xvf Downloads/mysql-cluster-gpl-7.2.10-linux2.6-i686.tar.gz

[user1@localhost ~]$ ln -s mysql-cluster-gpl-7.2.10-linux2.6-i686/ mysqlc

[user1@localhost ~]$ mkdir my_cluster my_cluster/ndb_data my_cluster/mysqld_data my_cluster/conf

[user1@localhost ~]$ vi my_cluster/conf/my.cnf

[user1@localhost ~]$ vi my_cluster/conf/config.ini

[user1@localhost ~]$ chmod 755 my_cluster/conf/my.cnf

[user1@localhost ~]$ cd mysqlc

[user1@localhost mysqlc]$ scripts/mysql_install_db --no-defaults --datadir=/home/user1/my_cluster/mysqld_data/

[user1@localhost my_cluster]$ cd ../my_cluster/

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/ndb_mgmd -f conf/config.ini --initial --configdir=/home/user1/my_cluster/conf/

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/ndbd -c localhost:1186

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/ndbd -c localhost:1186

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/ndb_mgm -e show

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/mysqld --defaults-file=conf/my.cnf &


 -Test-

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/mysql -h 127.0.0.1 -P 5000 -u root

mysql> create database clusterdb;use clusterdb;

mysql> create table simples (id int not null primary key) engine=ndb;

mysql> insert into simples values (1),(2),(3),(4);

mysql> select * from simples;

+----+

| id |

+----+

|  3 |

|  1 |

|  2 |

|  4 |

+----+

4 rows in set (0.03 sec)


 -Safely shut down-

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/mysqladmin -u root -h 127.0.0.1 -P 5000 shutdown

[user1@localhost my_cluster]$ /home/user1/mysqlc/bin/ndb_mgm -e shutdown

 - end cmd.txt -


 - my.cnf -

[mysqld]

ndbcluster

datadir=/home/user1/my_cluster/mysqld_data

basedir=/home/user1/mysqlc

port=5000

 - end my.cnf -

 - config.ini -
[ndb_mgmd]
hostname=localhost
datadir=/home/user1/my_cluster/ndb_data
NodeId=1

[ndbd default]
noofreplicas=2
datadir=/home/user1/my_cluster/ndb_data

[ndbd]
hostname=localhost
NodeId=3

[ndbd]
hostname=localhost
NodeId=4

[mysqld]
NodeId=50
 - end config.ini -


위와 동일한 버전으로 똑같이 따라했다면 아마 별 무리 없이 세팅이 가능할 것이다.








+ Recent posts