本文共 1943 字,大约阅读时间需要 6 分钟。
CentOS 6.8搭建mysql cluster(7.3):
注:
共5台,1台管理节点(10.0.0.21),2台SQL节点(10.0.0.22、10.0.0.23),2台数据节点(10.0.0.24、10.0.0.25)参考网址:
下载网址(选择Red Hat的tar包并进行解压):
5台都执行:
MySQL-Cluster-client-gpl-7.3.24-1.el6.x86_64.rpm
MySQL-Cluster-devel-gpl-7.3.24-1.el6.x86_64.rpm MySQL-Cluster-embedded-gpl-7.3.24-1.el6.x86_64.rpm MySQL-Cluster-server-gpl-7.3.24-1.el6.x86_64.rpm MySQL-Cluster-shared-compat-gpl-7.3.24-1.el6.x86_64.rpm MySQL-Cluster-shared-gpl-7.3.24-1.el6.x86_64.rpmMySQL-Cluster-test-gpl-7.3.24-1.el6.x86_64.rpm
管理节点:
[ndbd default]
NoOfReplicas=2DataMemory=1600MIndexMemory=600M[ndb_mgmd]
NodeId=1hostname=10.0.0.21datadir=/home/mysql-cluster[mysqld]
NodeId=2hostname=10.0.0.22[mysqld]
NodeId=3hostname=10.0.0.23[ndbd]
NodeId=4hostname=10.0.0.24datadir=/home/mysqldbStopOnError=0[ndbd]
NodeId=5hostname=10.0.0.25datadir=/home/mysqldbStopOnError=0:wq
SQL节点:
[mysqld]
datadir=/home/mysqldb/mysqlndbclusterlog-error=/home/mysqldb/logs/mysqld-error.log
[mysql_cluster]
ndb-connectstring=10.0.1.21:wq
数据节点:
[mysqld]
datadir=/home/mysqldbndbcluster[mysql_cluster]
ndb-connectstring=10.0.0.21:wq
启动顺序:管理节点——> 数据节点——> SQL节点
关闭顺序:SQL节点——> 数据节点——> 管理节点启动管理节点:
启动数据节点:
启动SQL节点:
SET PASSWORD for root@'localhost'=password('xxxxxx');
flush privileges;exit
show engines \G; //确保ndbcluster为默认引擎
在管理节点查看集群状态:
show
验证:
在1台SQL节点上新建数据库,另1个SQL节点上会自动同步
转载于:https://blog.51cto.com/yangzhiming/2407500