mysql cluster rpm安装包的选择 安装 配置 测试
2010-01-19 22:45
627 查看
现在新版本的mysql集群已从普通的mysql版本中提取出来了,也就是要做mysql的集群需要选择mysql集群对应的软件包。而且mysql专门提供了针对redhat 操作系统的rpm软件包。可以从http://dev.mysql.com/downloads/获得对应的操作系统的rpm软件包。在这里主要谈谈mysql rpm包的集群
mysql集群的三种类型的节点:
sql node: 这是用来访问集群数据的节点。对于MySQL集群,sql节点是使用NDB簇存储引擎的传统MySQL服务器。典型情况下,SQL节点是使用命令mysqld –ndbcluster启动的,或将ndbcluster添加到my.cnf后使用mysqld启动。(其实启动sql node 就像启动一般的mysql server一样启动,有很多种启动方式,service mysql start或者etc/rc.d/init.d/mysqld start只不过是要在配置好集群的配置文件的前提下)。
data node:这类节点用于保存簇的数据。数据节点的数目与副本的数目相关,是片段的倍数。例如,对于两个副本,每个副本有两个片段,那么就有4个数据节点。没有必要有一个以上的副本。数据节点是用命令ndbd启动的。
MGM node(管理节点):这类节点的作用是管理MySQL簇内的其他节点,如提供配置数据、启动并停止节点、运行备份等。由于这类节点负责管理其他节点的配置,应在启动其他节点之前首先启动这类节点。MGM节点是用命令ndb_mgmd启动的。例如(ndb-mgmd -f /var/lib/mysql-cluster/config.ini).
下面就是rpm包的选择,在不同类型的节点选择对应的rpm包(下只是我的选择,版本不同文件名就不一样):
sql node: MySQL-Cluster-gpl-server-7.0.9-0.rhel4.i386(which supplies the core files needed to run a MySQL Server with NDBCLUSTER storage engine support (that is, as a MySQL Cluster SQL node)).
MySQL-Cluster-gpl-client-7.0.9-0.rhel4.i386(管理mysql server 的客户端,安装了这个RPM包过后才能用mysql命令,进而进行数据库的管理,写sql 语句)
data node:MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.i386(which supplies the MySQL Cluster data node binary(ndbd).)
MGM node:MySQL-Cluster-gpl-management-7.0.9-0.rhel4.i386(which provides the MySQL Cluster management serverbinary (ndb_mgmd),管理集群的data node 和sql noe).
MySQL-Cluster-gpl-tools-7.0.9-0.rhel5.i386(该软件包最重要的就是提供了集群管理的客户端(ndb_mgm)The most important of these is the MySQL Cluster management client (ndb_mgm)
接下来就是安装了,把不同类型的节点的对应的rpm包安装到对应的节点。我在这里选择四台server,官方的推荐也是4台。不过没有4台,3台也行,甚至2或者一台都可以模拟集群的功能,不过台数太少了,做集群也就没什么意义了。安装的路径推荐安装到默认的路径,好像如果不安装的默认的路径还会有一些奇怪的错误,这个具体我也不能肯定。
sql node(16.178.115.200):
rpm -Uhv MySQL-Cluster-gpl-server-7.0.9-0.rhel4.i386
rpm -Uhv MySQL-Cluster-gpl-client-7.0.9-0.rhel4.i386
data node(16.178.115.201) :
rpm -Uhv MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.i386
data node(16.178.115.202) :
rpm -Uhv MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.i386
mgm node (16.178.115.203):
rpm -Uhv MySQL-Cluster-gpl-management-7.0.9-0.rhel4.i386
rpm -Uhv MySQL-Cluster-gpl-tools-7.0.9-0.rhel5.i386
安装完成过后,接下来就是配置了,配置非常重要,因为在linux下面mysql的一些服务不能启动一般都是配置文件的问题。
在sql node 和每个data node 的上都要对/etc/my.cnf.在my.cnf中的都应包括如下类似的内容:
# Options for mysqld process:
[mysqld]
ndbcluster # run NDB storage engine
ndb-connectstring=16.178.115.203(管理节点的ip) # location of management server
# Options for ndbd process:
[mysql_cluster]
ndb-connectstring=16.178.115.203 # location of management server
如果/etc下没有my.cnf 就要到/usr/share/mysql下面copy与你系统对应的配置文件并重命名为my.cnf
参考http://www.kuqin.com/database/20090725/64156.html
在mgm node 的配置
shell> mkdir /var/lib/mysql-cluster
shell> cd /var/lib/mysql-cluster
shell> vi config.ini
配置文件时 config.ini,该文件包括以下类似的内容。
# Options affecting ndbd processes on all data nodes:
[ndbd default]
NoOfReplicas=2 # Number of replicas
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
# TCP/IP options:
[tcp default]
portnumber=2202 # This the default; however, you can use any port that is free
# for all the hosts in the cluster
# Note: It is recommended that you do not specify the port
# number at all and allow the default value to be used instead
# Management process options:
[ndb_mgmd]
hostname=16.178.115.203 # Hostname or IP address of management node
datadir=/var/lib/mysql-cluster # Directory for management node log files
# Options for data node "A":
[ndbd]
# (one [ndbd] section per data node)
hostname=16.178.115.202 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
# Options for data node "B":
[ndbd]
hostname=16.178.116.201 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
# SQL node options:
[mysqld]
hostname=16.78.115.200 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
在配置config.ini时data node 的datadir 可以在自己定义的路径下面。
安装和配置都完成以后,接下来就是启动mysql 集群了看是否成功。
推荐一般是先启动mgm node。
shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini
然后启动data node ,每个data node 都用以下的命令启动
shell> ndbd
启动sql node ,就是启动mysql server 一样的方法,
shell> service mysql start或者 /etc/rc.d/init.d/mysqld start启动。
所有的节点都启动过后,就回到mgm node,执行一些ndb_mgm的管理命令,看是否能成功。
[root@Gssavl23 mysql]# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: 16.178.115.203:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @16.178.115.201 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0, Master)
id=3 @16.178.115.202 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @16.178.115.203 (mysql-5.1.39 ndb-7.0.9)
[mysqld(API)] 1 node(s)
id=4 @16.178.115.200 (mysql-5.1.39 ndb-7.0.9)
如果出现这样类似的界面,可以说差不多成功了。
mysql集群的三种类型的节点:
sql node: 这是用来访问集群数据的节点。对于MySQL集群,sql节点是使用NDB簇存储引擎的传统MySQL服务器。典型情况下,SQL节点是使用命令mysqld –ndbcluster启动的,或将ndbcluster添加到my.cnf后使用mysqld启动。(其实启动sql node 就像启动一般的mysql server一样启动,有很多种启动方式,service mysql start或者etc/rc.d/init.d/mysqld start只不过是要在配置好集群的配置文件的前提下)。
data node:这类节点用于保存簇的数据。数据节点的数目与副本的数目相关,是片段的倍数。例如,对于两个副本,每个副本有两个片段,那么就有4个数据节点。没有必要有一个以上的副本。数据节点是用命令ndbd启动的。
MGM node(管理节点):这类节点的作用是管理MySQL簇内的其他节点,如提供配置数据、启动并停止节点、运行备份等。由于这类节点负责管理其他节点的配置,应在启动其他节点之前首先启动这类节点。MGM节点是用命令ndb_mgmd启动的。例如(ndb-mgmd -f /var/lib/mysql-cluster/config.ini).
下面就是rpm包的选择,在不同类型的节点选择对应的rpm包(下只是我的选择,版本不同文件名就不一样):
sql node: MySQL-Cluster-gpl-server-7.0.9-0.rhel4.i386(which supplies the core files needed to run a MySQL Server with NDBCLUSTER storage engine support (that is, as a MySQL Cluster SQL node)).
MySQL-Cluster-gpl-client-7.0.9-0.rhel4.i386(管理mysql server 的客户端,安装了这个RPM包过后才能用mysql命令,进而进行数据库的管理,写sql 语句)
data node:MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.i386(which supplies the MySQL Cluster data node binary(ndbd).)
MGM node:MySQL-Cluster-gpl-management-7.0.9-0.rhel4.i386(which provides the MySQL Cluster management serverbinary (ndb_mgmd),管理集群的data node 和sql noe).
MySQL-Cluster-gpl-tools-7.0.9-0.rhel5.i386(该软件包最重要的就是提供了集群管理的客户端(ndb_mgm)The most important of these is the MySQL Cluster management client (ndb_mgm)
接下来就是安装了,把不同类型的节点的对应的rpm包安装到对应的节点。我在这里选择四台server,官方的推荐也是4台。不过没有4台,3台也行,甚至2或者一台都可以模拟集群的功能,不过台数太少了,做集群也就没什么意义了。安装的路径推荐安装到默认的路径,好像如果不安装的默认的路径还会有一些奇怪的错误,这个具体我也不能肯定。
sql node(16.178.115.200):
rpm -Uhv MySQL-Cluster-gpl-server-7.0.9-0.rhel4.i386
rpm -Uhv MySQL-Cluster-gpl-client-7.0.9-0.rhel4.i386
data node(16.178.115.201) :
rpm -Uhv MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.i386
data node(16.178.115.202) :
rpm -Uhv MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.i386
mgm node (16.178.115.203):
rpm -Uhv MySQL-Cluster-gpl-management-7.0.9-0.rhel4.i386
rpm -Uhv MySQL-Cluster-gpl-tools-7.0.9-0.rhel5.i386
安装完成过后,接下来就是配置了,配置非常重要,因为在linux下面mysql的一些服务不能启动一般都是配置文件的问题。
在sql node 和每个data node 的上都要对/etc/my.cnf.在my.cnf中的都应包括如下类似的内容:
# Options for mysqld process:
[mysqld]
ndbcluster # run NDB storage engine
ndb-connectstring=16.178.115.203(管理节点的ip) # location of management server
# Options for ndbd process:
[mysql_cluster]
ndb-connectstring=16.178.115.203 # location of management server
如果/etc下没有my.cnf 就要到/usr/share/mysql下面copy与你系统对应的配置文件并重命名为my.cnf
参考http://www.kuqin.com/database/20090725/64156.html
在mgm node 的配置
shell> mkdir /var/lib/mysql-cluster
shell> cd /var/lib/mysql-cluster
shell> vi config.ini
配置文件时 config.ini,该文件包括以下类似的内容。
# Options affecting ndbd processes on all data nodes:
[ndbd default]
NoOfReplicas=2 # Number of replicas
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
# TCP/IP options:
[tcp default]
portnumber=2202 # This the default; however, you can use any port that is free
# for all the hosts in the cluster
# Note: It is recommended that you do not specify the port
# number at all and allow the default value to be used instead
# Management process options:
[ndb_mgmd]
hostname=16.178.115.203 # Hostname or IP address of management node
datadir=/var/lib/mysql-cluster # Directory for management node log files
# Options for data node "A":
[ndbd]
# (one [ndbd] section per data node)
hostname=16.178.115.202 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
# Options for data node "B":
[ndbd]
hostname=16.178.116.201 # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
# SQL node options:
[mysqld]
hostname=16.78.115.200 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
在配置config.ini时data node 的datadir 可以在自己定义的路径下面。
安装和配置都完成以后,接下来就是启动mysql 集群了看是否成功。
推荐一般是先启动mgm node。
shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini
然后启动data node ,每个data node 都用以下的命令启动
shell> ndbd
启动sql node ,就是启动mysql server 一样的方法,
shell> service mysql start或者 /etc/rc.d/init.d/mysqld start启动。
所有的节点都启动过后,就回到mgm node,执行一些ndb_mgm的管理命令,看是否能成功。
[root@Gssavl23 mysql]# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: 16.178.115.203:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @16.178.115.201 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0, Master)
id=3 @16.178.115.202 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @16.178.115.203 (mysql-5.1.39 ndb-7.0.9)
[mysqld(API)] 1 node(s)
id=4 @16.178.115.200 (mysql-5.1.39 ndb-7.0.9)
如果出现这样类似的界面,可以说差不多成功了。
相关文章推荐
- mysql cluster rpm安装包的选择 安装 配置 测试
- MySQL 5.6 for Windows 解压缩版配置安装(win 10 64位亲测)附安装包下载链接
- redhat enterprixe 5.0 下DHCP服务器rpm安装配置及其测试
- mysql源码包手动安装、配置以及测试(亲测可行)
- 8个节点MySQL-cluster安装和配置,含两个管理节点
- mysql-proxy安装配置与测试
- my SQL下载安装,环境配置,以及密码忘记的解决,以及navicat for mysql下载,安装,测试连接
- MySql 服务器安装与配置(rpm)
- 通过rpm包安装、配置及卸载mysql
- mysql-cluster 安装篇(3)---rpm简易安装法
- Ubuntu 安装配置mysql-cluster
- 通过rpm包安装、配置及卸载mysql
- redhat下安装mysql 5.6.20,解压zip包,查看已经安装过的mysql,卸载rpm安装包,安装mysql服务器端和客户端,修改mysql用户名,登陆mysql,启动关闭mysql
- 通过rpm包安装、配置及卸载mysql
- Linux下Mysql的配置(rpm形式安装)
- centos6.5 安装配置mysql5.6-RPM及修改数据目录
- MySQL-Cluster 7.3.2 安装和配置
- 通过rpm包安装、配置及卸载mysql
- 使用rpm包安装mysql及其简要配置
- 通过rpm包安装,配置和拆卸mysql