【mysql集群】mysql集群配置,本人已测试
一下安装过程本人已经测试,准确的,如有问题,请Q我:420332292
在网上找这样的资料挺难找的,哥也是找了2天才找到一份比较不错的教程,悲剧哇
MySql-Cluster安装
系统 centos5.1 32位(如何是64位下相应64位的rpm包)
http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.0和下面的包名对应
一共有5个包:
MySQL-Cluster-gpl-client-7.1.3-1.rhel5.i386.rpm
MySQL-Cluster-gpl-management-7.1.3-1.rhel5.i386.rpm
MySQL-Cluster-gpl-server-7.1.3-1.rhel5.i386.rpm
MySQL-Cluster-gpl-storage-7.1.3-1.rhel5.i386.rpm
MySQL-Cluster-gpl-tools-7.1.3-1.rhel5.i386.rpm
3台centos 服务器:
管理节点(ndb_mgmd):192.168.1.14
SQL节点1(mysqld): 192.168.1.15
SQL节点1(mysqld): 192.168.1.11
数据节点(ndbd): 192.168.1.15
数据节点(ndbd): 192.168.1.11
//------------------------------以这个开始(七台机子都这个操做)
首先要做的是把这七台机子的防火墙关掉(如何不关的话每个节点都连不通)
关闭防火墙:
Service iptables stop;
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
如何这样关闭成功;
创建文件夹:
存储节点:mkdir /var/lib/mysql/data
管理结点:mkdir /var/lib/mysql-cluster
Sql结点:要不要都行
给两个文件赋权限:
chmod -R 1777 /var/lib/mysql
chmod -R 1777 /var/lib/ mysql-cluster
//------------------------------以这个结束
管理节点安装:
MySQL-Cluster-gpl-management-7.0.9-0.rhel4.x86_64.rpm;
MySQL-Cluster-gpl-tools-7.0.9-0.rhel4.x86_64.rpm;
Rpm –ivh MySQL-Cluster-gpl-management-7.0.9-0.rhel4.x86_64.rpm
Rpm –ivh MySQL-Cluster-gpl-tools-7.0.9-0.rhel4.x86_64.rpm
vi /var/lib/mysql-cluster/config.ini
[ndbd default]
NoOfReplicas=2
DataMemory=80M
IndexMemory=18M
[tcp default]
SendBufferMemory=2M
ReceiveBufferMemory=2M
[NDB_MGMD DEFAULT]
PortNumber=1186
Datadir=/var/lib/mysql-cluster
[ndb_mgmd]
Id=1
HostName= 192.168.1.14
[ndbd]
Id=2
HostName=192.168.1.15
datadir=/var/lib/mysql/data
[ndbd]
Id=3
HostName= 192.168.1.11
datadir=/var/lib/mysql/data
[mysqld]
Id=14
HostName=192.168.1.15
[mysqld]
Id=15
HostName=192.168.1.11
[mysqld]
Id=16
//启动管理节点
ndb_mgmd -f /var/lib/mysql-cluster/config.ini
/*********************以上是安装管理节点**************************/
存储节点安装
MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.x86_64.rpm
Rpm –ivh MySQL-Cluster-gpl-storage-7.0.9-0.rhel4.x86_64.rpm
vi /etc/my.cnf //确认添加修改了如下部分
[mysqld]
max_connections = 100
slow_query_log = /var/lib/mysql-cluster/slow_query.log
long_query_time = 1
datadir = /var/lib/mysql-cluster
ndbcluster
ndb-connectstring=192.168.1.14
[mysql_cluster]
ndb-connectstring= 192.168.1.14
初始化启动数据节点的数据库,
注意://ndbd –initial 不能同时在所有数据节点机器上执行,否者会删除所有数据.即该命令只能在其中一台数据节点中执行
ndbd –initial
如何这样:
[ndbd] INFO -- Configuration fetched from '10.50.8.8:1186', generation: 1
sql节点的安装:
MySQL-Cluster-gpl-client-7.0.9-0.rhel4.x86_64.rpm
MySQL-Cluster-gpl-server-7.0.9-0.rhel4.x86_64.rpm
Rpm –ivh MySQL-Cluster-gpl-server-7.0.9-0.rhel4.x86_64.rpm
Rpm –ivh MySQL-C