极速手机网

Centos下MYSQL Cluster NDB7.2部署实践教程

试验需求,OneCoder打算亲身布置一下MySQLCluster环境。VMware环境中,虚拟化三台CentOS5.4 x64虚拟机。

10.4.44.201 SQL
10.4.44.202 Data
10.4.44.203 Manager

用于布置。

官方文档自然是最好的布置手册,先简略了解一下。

MySQLCluster构成

Centos下MYSQL Cluster NDB7.2部署实践教程

Centos下MYSQL Cluster NDB7.2部署实践教程图1

Each MySQL Cluster host computer must have the correct executable programs installed. A host running an SQL node must have installed on it a MySQL Server binary (mysqld). Management nodes require the management server daemon (ndb_mgmd); data nodes require the data node daemon (ndbd or ndbmtd). It is not necessary to install the MySQL Server binary on management node hosts and data node hosts. It is recommended that you also install the management client (ndb_mgm) on the management server host.

SQL节点,必须布置MySQL Server binary(mysqld);办理(Management) 节点,需求布置management server daemon(ndb_mgmd);数据(data)节点,需求布置data node daemon(ndbd 或许 ndbmtd)。无需在办理和数据节点上布置MySQL Server binary。推荐在办理节点上,也布置management client(ndb_mgm)。

MySQL Cluster装备(翻译自官方文档)

每个data和SQL节点都需求一个my.cnf文件,其中包含了两条重要的信息:一个链接串指明management节点方位,一条针对data节点,告知MySQL服务器敞开NDBCLUSTER存储引擎。
management节点需求config.ini装备文件,里面保存着它需求办理的集群节点的信息、保存数据和各data节点数据索引所需的内存信息,data节点的方位信息,
有了这些理论基础,下面咱们来动手操作一下

先布置data和SQL节点, 下载MysQL Cluster压缩包 ,通过putty自带的pscp工具,复制到各个节点linux虚拟机中。

Centos下MYSQL Cluster NDB7.2部署实践教程

Centos下MYSQL Cluster NDB7.2部署实践教程图2

解压。

先装备SQL和Data节点。在/etc下放置my.cnf装备文件。内容如下:

view sourceprint?

1.[ndbcluster]

2.ndb-connectstring=10.4.44.203

3.[mysql_cluster]

4.ndb-connectstring=10.4.44.203

再装备Manager

相同先将压缩包复制,然后在/var/lib/mysql-cluster/config.ini 装备:[ndbd default]

view sourceprint?

01.# Options affecting ndbd processes on all data nodes:

02.NoOfReplicas=1 # Number of replicas

03.DataMemory=80M # How much memory to allocate for data storage

04.IndexMemory=18M # How much memory to allocate for index storage

05.# For DataMemory and IndexMemory,we have used the

06.# default values. Since the "world" database takes up

07.# only about 500KB,this should be more than enough for

08.# this example Cluster setup.

09.

10.[ndb_mgmd]

11.# Management process options:

12.hostname=10.4.44.203 # Hostname or IP address of MGM node

13.datadir=/var/lib/mysql-cluster # Directory for MGM node log files

14.

15.[ndbd]

16.# Options for data node "A":

17.# (one [ndbd] section per data node)

18.hostname=10.4.44.202 # Hostname or IP address

19.datadir=/usr/local/mysql/data # Directory for this data node's data files

20.

21.[mysqld]

22.# SQL node options:

23.hostname=10.4.44.201 # Hostname or IP address

24.# (additional mysqld connections can be

25.# specified for this node for various

26.# purposes such as running ndb_restore)

发动MySQL Cluster:

先发动Management节点:

view sourceprint?

1.shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini

再发动data

view sourceprint?

1.shell>ndbd

和SQL节点shell> groupadd mysql

view sourceprint?

01.shell>useradd-r -g mysql mysql

02.shell>cd/usr/local

03.shell>tarzxvf /path/to/mysql-VERSION-OS.tar.gz

04.shell>ln-s full-path-to-mysql-VERSION-OS mysql

05.shell>cdmysql

06.shell>chown-R mysql .

07.shell>chgrp-R mysql .

08.shell> scripts/mysql_install_db

09.shell> bin>mysqld

成功。在management节点,利用./ndb_mgm查看状况。 www.it165.net

view sourceprint?

1.ndb_mgm>show.

Centos下MYSQL Cluster NDB7.2部署实践教程

Centos下MYSQL Cluster NDB7.2部署实践教程图3

布置成功。

OneCoder注:这里一开始有一个误区,就是我根据文档误以为SQL节点布置的MySQL Server版别而不是Cluster版别,导致耽误了很多时刻。今日看一个错误出神的时候,才忽然醒悟,我是不是搞错了。急速替换了版别,这才成功。

相关下载

下载Linux Kernel

Linux Kernel

大小:97.46 MB

相关文章

大家都在找