引言:
本文会先对MySQL集群稍作一点介绍,然后会提供一个安装过程。
介绍:
MySQL集群是一种在无共享架构系统里应用内存数据库集群的技术。这种无共享的架构可以使得系统使用非常便宜的并且是最小配置的硬件。
MySQL集群是一种分布式设计,目标是要达到没有任何单点故障点。因此,任何组成部分都应该拥有自己的内存和磁盘。任何共享存储方案如网络共享,网络文件系统和SAN设备是不推荐或不支持的。通过这种冗余设计,MySQL声称数据的可用度可以达到99。999%。
实际上,MySQL集群是把一个叫做NDB的内存集群存储引擎集成与标准的MySQL服务器集成。它包含一组计算机,每个都跑一个或者多个进程,这可能包括一个MySQL服务器,一个数据节点,一个管理服务器和一个专有的一个数据访问程序。它们之间的关系如下图所示:
安装
准备:
机器: 全部安装Red Hat Linux AS 5且关闭防火墙
软件: mysql-cluster-gpl-6.3.20-linux-i686-glibc23.tar.gz
四台机器分别分配如下IP及用途:
IP |
Description |
192.168.99.80 |
Management Node |
192.168.99.88 |
SQL Node |
192.168.99.89 |
Data Node |
192.168.99.90 |
Data Node |
安装节点,四台机器,需要重复四次:
[root@candyshop ~]#groupadd mysql [root@candyshop ~]#useradd –g mysql mysql [root@candyshop ~]#tar zxvf mysql-cluster-gpl-6.3.20-linux-i686-glibc23.tar.gz [root@candyshop ~]#chown mysql:mysql mysql-cluster-gpl-6.3.20-linux-i686-glibc23 [root@candyshop ~]#mv mysql-cluster-gpl-6.3.20-linux-i686-glibc23 /usr/local/mysql |
上述命令先创建mysql组和mysql用户,并且把mysql分配到mysql组,然后将安装文件解压,把它放置到/usr/local/mysql目录。
配置
配置管理节点[192.168.99.80]:
创建以下文件/usr/local/mysql/cluster-conf/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.
# Management process options: [ndb_mgmd] Id=1 Hostname=192.168.99.80 # Hostname or IP address of management node Datadir=/usr/local/mysql/logs # Directory for management node log files
# Options for data node "A": [ndbd] Id=2 Hostname=192.168.99.89 # Hostname or IP address Datadir=/usr/local/mysql/ndbdata # Directory for this data node's data files
# Options for data node "B": [ndbd] Id=3 Hostname=192.168.99.90 # Hostname or IP address Datadir=/usr/local/mysql/ndbdata # Directory for this data node's data files
# SQL node options: [mysqld] Id=4 Hostname=192.168.99.88 # Hostname or IP address # (additional mysqld connections can be # specified for this node for various # purposes such as running ndb_restore)
|
在这个文件里,我们分别给四个节点分配了ID,这有利于更好的管理和区分各个节点。当然,要是不指定,MySQL也会动态分配一个。上述几个Datadir如果还不存在的需要手动创建。用mkdir –p命令即可。
配置数据节点[192.168.99.89, 192.168.99.90]:
创建/etc/my.cnf文件,内容如下
# Options for mysqld process: [mysqld] Datadir=/usr/local/mysql/ndbdata ndbcluster # run NDB storage engine ndb-connectstring=192.168.99.80 # location of management server
# Options for ndbd process: [mysql_cluster] ndb-connectstring=192.168.99.80 # location of management server |
配置SQL节点[192.168.99.88]
创建/etc/my.cnf文件,内容如下
# Options for mysqld process: [mysqld] ndbcluster # run NDB storage engine ndb-connectstring=192.168.99.80 # location of management server
# Options for ndbd process: [mysql_cluster] ndb-connectstring=192.168.99.80 # location of management server |
[root@server88 mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --ldata=/usr/local/mysql/data/ Installing MySQL system tables... OK Filling help tables... OK |
到这里,所有配置已经完成了。
启动
启动管节点[192.168.99.80]:
[root@candyshop mysql]# ./bin/ndb_mgmd -f cluster-conf/config.ini [root@candyshop mysql]# ./bin/ndb_mgm -- NDB Cluster -- Management Client -- ndb_mgm> show Connected to Management Server at: 192.168.99.80:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 (not connected, accepting connect from 192.168.99.89) id=3 (not connected, accepting connect from 192.168.99.90)
[ndb_mgmd(MGM)] 1 node(s) id=1 @192.168.99.80 (mysql-5.1.30 ndb-6.3.20)
[mysqld(API)] 1 node(s) id=4 (not connected, accepting connect from 192.168.99.88) |
我们可以看到集群的状态都还没有启动,都是not connected状态。
[root@candyshop mysql]# ./bin/ndb_mgmd -f cluster-conf/config.ini [root@candyshop mysql]# ./bin/ndb_mgm -- NDB Cluster -- Management Client -- ndb_mgm> show Connected to Management Server at: 192.168.99.80:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 (not connected, accepting connect from 192.168.99.89) id=3 (not connected, accepting connect from 192.168.99.90)
[ndb_mgmd(MGM)] 1 node(s) id=1 @192.168.99.80 (mysql-5.1.30 ndb-6.3.20)
[mysqld(API)] 1 node(s) id=4 (not connected, accepting connect from 192.168.99.88) |
启动数据节点[192.168.99.89, 192.168.99.90]:
[root@server89 ~]#cd /usr/local/mysql [root@server89 mysql]#./bin/ndbd |
启动SQL节点[192.168.99.88]:
[root@server88 mysql]# ./bin/mysqld_safe & |
至此,所有节点已经启动完成,让我们来查看系统状态:
ndb_mgm> show Connected to Management Server at: localhost:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 @192.168.99.89 (mysql-5.1.30 ndb-6.3.20, Nodegroup: 0, Master) id=3 @192.168.99.90 (mysql-5.1.30 ndb-6.3.20, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s) id=1 @192.168.99.80 (mysql-5.1.30 ndb-6.3.20)
[mysqld(API)] 1 node(s) id=4 @192.168.99.88 (mysql-5.1.30 ndb-6.3.20)
|
相关推荐
Create and run a real-time, highly-available, and high-redundancy version of the world's most popular open-source database, MySQL....Chapter 20: MySQL NDB Cluster and Application Performance Tuning
The book has been written for database administrators who are looking into deploying MySQL NDB Cluster or already have a cluster in production and want to increase their knowledge to be able to handle...
MySQL Cluster(MySQL 集群) 测试环境: CentOS4.6 数据库版本: mysql-cluster-gpl-6.3.20
MySQL NDB Cluster实践.pdf
通过学习mysql官方文档,在实验中形成的一份简明扼要的笔记性质文档,适合MySQL NDB集群感兴趣的同学参考。
官网下载,安全可靠权威,没做任何改动,方便好用,当大家在了解了mysql基础上看英文版的一定会比中文版的有收获,很高兴和大家分享这个手册,官网的下载地址为http://dev.mysql.com/doc/,不过希望根据我的介绍到...
CentOS8部署Mysql NDB Cluster8+Mysql Router8方案及应用~~~~
MySQL Cluster 是专门用来做MySQL集群的程序,简单来讲它是一种技术,该技术能够在无共享的系统中部署内存中数据库的“Cluster”,通过无共享体系结构,系统能够使用各种廉价的硬件,并对所有硬件没有任何特殊的要求...
MySQL 8.0参考手册 Including MySQL NDB Cluster 8.0
Pro MySQL NDB Cluster 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
01.about_me.pdf 02.mysql_concept.pdf 03.mysql_myisam_archive.pdf 04.innodb_concept.pdf 05.innodb_lock.pdf ... 18.mysql_HA_NDB.pdf 19.mysql_scale.pdf 20.mysql_Fabric.pdf 21.mysql_cache.pdf
For infor mation about MySQL Cluster, please see MySQL NDB Cluster 7.5 and NDB Cluster 7.6. MySQL 8.0 features. This manual describes features that are not included in every edition of MySQL 8.0; ...
MySQL NDB Cluster安装
Pro MySQL NDB Cluster 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在...
MySQL Cluster NDB 7.2. MySQL 5.6 features. This manual describes features that are not included in every edition of MySQL 5.6; such features may not be included in the edition of MySQL 5.6 licensed to...
关于MySQL集群的信息,请参阅7.5、MySQL NDB Cluster NDB簇7.6 MySQL 8的特点。本手册介绍了不包含在MySQL 8的每一个版本的功能;这种功能可能不包含在MySQL 8版授权给你。如果你有任何问题的特征包含在你的MySQL...
如果集群配置有更新了:rm /usr/local/mysql/mysql-cluster/ndb_1_config.bin.1 3)停止SQL节点的命令:/usr/local/mysql/bin/mysqladmin -uroot shutdown 4)SQL Node上连接MySQL:/usr/local/mysql/bin/mysql -u ...
2.3.14. 在Windows环境下对MySQL安装的故障诊断与排除 2.3.15. 在Windows下升级MySQL 2.3.16. Windows版MySQL同Unix版MySQL对比 2.4. 在Linux下安装MySQL 2.5.在Mac OS X中安装MySQL 2.6. 在NetWare中安装MySQL 2.7....
please see MySQL NDB Cluster 7.5 and NDB Cluster 7.6. MySQL 8.0 features. This manual describes features that are not included in every edition of MySQL 8.0; such features may not be included in ...
详细描述MySQL NDB CLUSTER的安装部署应用!国际上唯一的专注书籍!