Installation and Configuration MySQL Cluster 7.2 on CentOS 5 (include MySQL 5.5)
Architecture
Manager Node
mysql-mag1 192.168.1.31
mysql-mag2 192.168.1.32
SQL Node
mysql-sql1 192.168.1.33
mysql-sql2 192.168.1.34
NDB Node
mysql-ndb1 192.168.1.35
mysql-ndb2 192.168.1.36
[root@mysql-mag1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6 #manager node
192.168.1.31 mysql-mag1
192.168.1.32 mysql-mag2 #sql node
192.168.1.33 mysql-sql1
192.168.1.34 mysql-sql2 #ndb node
192.168.1.35 mysql-ndb1
192.168.1.36 mysql-ndb2
MySQL Cluster7.2 JAVA must be installed configuration environment
[root@mysql-mag1 ~]# chmod u+x jdk-6u13-linux-x64.bin
[root@mysql-mag1 ~]# ./jdk-6u13-linux-x64.bin
[root@mysql-mag1 ~]# mv jdk1.6.0_13 /usr/local/
[root@mysql-mag1 ~]# echo "export JAVA_HOME=/usr/local/jdk1.6.0_13" >> /etc/profile
[root@mysql-mag1 ~]# echo "export CLASSPATH=.:$JAVA_HOME/lib/tools.jar" >> /etc/profile
[root@mysql-mag1 ~]# echo "export PATH=$JAVA_HOME/bin:$PATH" >> /etc/profile
[root@mysql-mag1 ~]# source /etc/profile
[root@mysql-mag1 ~]# java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
[root@mysql-mag1 ~]#
[root@mysql-mag1 ~]# javac -version
javac 1.6.0_13
Installation Manager Node1
[root@mysql-mag1 ~]# tar -zxvf mysql-cluster-gpl-7.2.10.tar.gz
[root@mysql-mag1 ~]# cd mysql-cluster-gpl-7.2.10
[root@mysql-mag1 mysql-cluster-gpl-7.2.10]#
[root@mysql-mag1 mysql-cluster-gpl-7.2.10]# cmake . -DCMAKE_INSTALL_PREFIX=/service/mysql -DSYSCONFDIR=/etc/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DCOMPILATION_COMMENT=Mysql-Cluster -DCMAKE_BUILD_TYPE=Release -DMYSQL_USER=mysql -DWITH_MYSQLMANAGER=ON -DWITH_EMBEDDED_SERVER=ON -DWITH_NDB_TEST=ON -DWITH_DEBUG=ON -DWITH_NDB_DEBUG=ON
[root@mysql-mag1 mysql-cluster-gpl-7.2.10]# make && make install
[root@mysql-mag1 mysql-cluster-gpl-7.2.10]# du -sh /service/mysql/
1017M /service/mysql/
[root@mysql-mag1 mysql-cluster-gpl-7.2.10]# cd /service/mysql/
[root@mysql-mag1 mysql]# mkdir mysql-cluster
[root@mysql-mag1 mysql]# chown -R mysql.mysql /service/mysql
[root@mysql-mag1 mysql]# mkdir -p /etc/mysql
[root@mysql-mag1 mysql]# cp /root/mysql-cluster-gpl-7.2.10/support-files/config.huge.ini /etc/mysql/config.ini
[root@mysql-mag1 mysql]# cat config.ini
[NDBD DEFAULT]
NoOfReplicas: 2
DataDir: /service/mysql/mysql-cluster
FileSystemPath: /service/mysql/data LockPagesInMainMemory: 1 DataMemory: 128M
IndexMemory: 64M [MGM DEFAULT]
PortNumber: 1186
DataDir: /service/mysql/mysql-cluster [TCP DEFAULT]
SendBufferMemory: 2M
ReceiveBufferMemory: 2M [NDB_MGMD]
NodeId: 1
HostName: 192.168.1.31
ArbitrationRank: 1 [NDB_MGMD]
NodeId: 2
HostName: 192.168.1.32
ArbitrationRank: 1 [NDBD]
NodeId: 3
HostName: 192.168.1.35 [NDBD]
NodeId: 4
HostName: 192.168.1.36 [API]
NodeId: 5
HostName: 192.168.1.33 [API]
NodeId: 6
HostName: 192.168.1.34
Installation Manager Node2
From manager node1 copy "config.ini,MYSQL_HOME/bin/*" to manager node2 and give permission.
[root@mysql-mag1 mysql]# scp /etc/mysql/config.ini mysql-mag2:/etc/mysql/
[root@mysql-mag1 mysql]# scp -rp /service/mysql/* mysql-mag2:/service/mysql/
On manager node2 give permission.
[root@mysql-mag2 mysql]# chown -R mysql.mysql /etc/mysql /service/mysql
Start Manager Node
The first time on the manager node to start the manager serverThe first time on the manager node to start the manager server.
On manager node1
[root@mysql-mag1 ~]# /service/mysql/bin/ndb_mgmd -f /etc/mysql/config.ini --config-dir=/service/mysql/mysql-cluster/ --initial
MySQL Cluster Management Server mysql-5.5.29 ndb-7.2.10
On manager node2
[root@mysql-mag2 mysql]# /service/mysql/bin/ndb_mgmd -f /etc/mysql/config.ini --config-dir=/service/mysql/mysql-cluster/ --initial
MySQL Cluster Management Server mysql-5.5.29 ndb-7.2.10
Start using reload parameters again
/service/mysql/bin/ndb_mgmd -f /etc/mysql/config.ini --config-dir=/service/mysql/mysql-cluster/ --reload
[root@mysql-mag1 ~]# /service/mysql/bin/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=3 (not connected, accepting connect from 192.168.1.35)
id=4 (not connected, accepting connect from 192.168.1.36) [ndb_mgmd(MGM)] 2 node(s)
id=1 @192.168.1.31 (mysql-5.5.29 ndb-7.2.10)
id=2 @192.168.1.32 (mysql-5.5.29 ndb-7.2.10) [mysqld(API)] 2 node(s)
id=5 (not connected, accepting connect from 192.168.1.33)
id=6 (not connected, accepting connect from 192.168.1.34)
Installation NDB Node1
Create my.cnf
[root@mysql-ndb1 ~]# cat /etc/mysql/my.cnf
[mysqld]
datadir=/service/mysql/data
basedir=/service/mysql
socket=/service/mysql/mysql.sock
default_storage_engine=NDBCLUSTER
ndbcluster
ndb-connectstring=mysql-mag1,mysql-mag2 [mysql_cluster]
ndb-connectstring=mysql-mag1,mysql-mag2
From manager node1 copy "MYSQL_HOME/bin/*" to ndb node1 and give permission.
[root@mysql-mag1 ~]# scp -rp /service/mysql/* mysql-ndb1:/service/mysql
On NDB node1
give permission.
[root@mysql-ndb1 mysql]# chown -R mysql.mysql /etc/mysql /service/mysql
Installation NDB Node2
From ndb node1 copy "my.cnf,MYSQL_HOME/bin/*" to ndb node2 and give permission.
[root@mysql-ndb1 mysql]# scp -rp /etc/mysql/my.cnf mysql-ndb2:/etc/mysql/
[root@mysql-ndb1 mysql]# scp -rp /service/mysql/* mysql-ndb2:/service/mysql/
On NDB node2
give permission.
[root@mysql-ndb2 mysql]# chown -R mysql.mysql /etc/mysql /service/mysql
Start NDB Node
[root@mysql-ndb1 ~]# /service/mysql/bin/ndbd --initial
2013-11-19 22:50:40 [ndbd] INFO -- Angel connected to 'mysql-mag1:1186'
2013-11-19 22:50:40 [ndbd] INFO -- Angel allocated nodeid: 3
[root@mysql-ndb2 ~]# /service/mysql/bin/ndbd --initial
2013-11-19 23:02:26 [ndbd] INFO -- Angel connected to 'mysql-mag1:1186'
2013-11-19 23:02:26 [ndbd] INFO -- Angel allocated nodeid: 4
NDB nodes "ndbd --initial" starting up only when the first time you start or need to recover from a backup database needs, other times as long as the executive "ndbd -d"
View Manager Node
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=3 @192.168.1.35 (mysql-5.5.29 ndb-7.2.10, Nodegroup: 0, Master)
id=4 @192.168.1.36 (mysql-5.5.29 ndb-7.2.10, Nodegroup: 0) [ndb_mgmd(MGM)] 2 node(s)
id=1 @192.168.1.31 (mysql-5.5.29 ndb-7.2.10)
id=2 @192.168.1.32 (mysql-5.5.29 ndb-7.2.10) [mysqld(API)] 5 node(s)
id=5 (not connected, accepting connect from 192.168.1.33)
id=6 (not connected, accepting connect from 192.168.1.34)
id=7 (not connected, accepting connect from any host)
id=8 (not connected, accepting connect from any host)
id=9 (not connected, accepting connect from any host)
Installation SQL Node1
[root@mysql-sql1 mysql-cluster-gpl-7.2.10]# cmake . -DCMAKE_INSTALL_PREFIX=/service/mysql -DMEMCACHED_HOME=/service/mysql/memcached -DSYSCONFDIR=/etc/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DCOMPILATION_COMMENT=Mysql-Cluster -DCMAKE_BUILD_TYPE=Release -DMYSQL_USER=mysql -DWITH_MYSQLMANAGER=ON -DBACKUP_TEST=OFF -DWITH_DEBUG=ON -DWITH_NDB_DEBUG=ON
[root@mysql-sql1 mysql-cluster-gpl-7.2.10]# make && make install
[root@mysql-sql1 mysql-cluster-gpl-7.2.10]# cp support-files/my-huge.cnf /etc/mysql/my.cnf
[root@mysql-sql1 mysql-cluster-gpl-7.2.10]# cat /etc/mysql/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock [mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 128M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8 ndbcluster
ndb-connectstring=mysql-mag1,mysql-mag2
user=mysql log-bin=mysql-bin
log-error [mysql_cluster]
ndb-connectstring=mysql-mag1,mysql-mag2 [mysqldump]
quick
max_allowed_packet = 16M [mysql]
no-auto-rehash [myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M [mysqlhotcopy]
interactive-timeout [root@mysql-sql1 mysql-cluster-gpl-7.2.10]# chown -R mysql.mysql /etc/mysql /service/mysql
[root@mysql-sql1 mysql-cluster-gpl-7.2.10]# cp support-files/mysql.server /etc/init.d/mysql
[root@mysql-sql1 mysql-cluster-gpl-7.2.10]# /service/mysql/scripts/mysql_install_db --user=mysql --basedir=/service/mysql
Installing MySQL system tables...
OK
Filling help tables...
OK To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands: /service/mysql/bin/mysqladmin -u root password 'new-password'
/service/mysql/bin/mysqladmin -u root -h mysql-sql1 password 'new-password' Alternatively you can run:
/service/mysql/bin/mysql_secure_installation which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with:
cd /service/mysql ; /service/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl
cd /service/mysql/mysql-test ; perl mysql-test-run.pl Please report any problems with the /service/mysql/scripts/mysqlbug script! [root@mysql-sql1 mysql-cluster-gpl-7.2.10]#
Installation SQL Node2
Installation is the same as the SQL Node1
Start SQL Node
On SQL Node1
[root@mysql-sql1 mysql-cluster-gpl-7.2.10]# /etc/init.d/mysql start
Starting MySQL....[ OK ]
On SQL Node2
[root@mysql-sql2 mysql]# /etc/init.d/mysql start
Starting MySQL.....[ OK ]
View Manager Node
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=3 @192.168.1.35 (mysql-5.5.29 ndb-7.2.10, Nodegroup: 0, Master)
id=4 @192.168.1.36 (mysql-5.5.29 ndb-7.2.10, Nodegroup: 0) [ndb_mgmd(MGM)] 2 node(s)
id=1 @192.168.1.31 (mysql-5.5.29 ndb-7.2.10)
id=2 @192.168.1.32 (mysql-5.5.29 ndb-7.2.10) [mysqld(API)] 5 node(s)
id=5 @192.168.1.33 (mysql-5.5.29 ndb-7.2.10)
id=6 @192.168.1.34 (mysql-5.5.29 ndb-7.2.10)
id=7 (not connected, accepting connect from any host)
id=8 (not connected, accepting connect from any host)
id=9 (not connected, accepting connect from any host)
Test MySQL Cluster
[root@mysql-sql2 mysql]# /service/mysql/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.29-ndb-7.2.10-debug-log Mysql-Cluster Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| ndbcluster | YES | Clustered, fault-tolerant tables | YES | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| ndbinfo | YES | MySQL Cluster system information storage engine | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
11 rows in set (0.01 sec) mysql> select @@version;
+-----------------------------+
| @@version |
+-----------------------------+
| 5.5.29-ndb-7.2.10-debug-log |
+-----------------------------+
1 row in set (0.00 sec) mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| ndbinfo |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec) mysql> use test
Database changed
mysql> show tables;
Empty set (0.06 sec) mysql> create table t_test(
-> id int(5) primary key,
-> name varchar(20)
-> )engine=ndb comment='ndb test';
Query OK, 0 rows affected (0.24 sec) mysql> show create table t_test\G
*************************** 1. row ***************************
Table: t_test
Create Table: CREATE TABLE `t_test` (
`id` int(5) NOT NULL,
`name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8 COMMENT='ndb test'
1 row in set (0.00 sec) mysql> insert into t_test values(1,'zwc');
Query OK, 1 row affected (0.00 sec)
Installation and Configuration MySQL Cluster 7.2 on CentOS 5 (include MySQL 5.5)的更多相关文章
- Scalable MySQL Cluster with Master-Slave Replication, ProxySQL Load Balancing and Orchestrator
MySQL is one of the most popular open-source relational databases, used by lots of projects around t ...
- MySQL Cluster搭建与测试
MySQL Cluster是一个基于NDB Cluster存储引擎的完整的分布式数据库系统.不仅仅具有高可用性,而且可以自动切分数据,冗余数据等高级功能.和Oracle Real Cluster Ap ...
- MySQL Cluster 集群
本文转载 http://www.cnblogs.com/gomysql/p/3664783.html MySQL Cluster是一个基于NDB Cluster存储引擎的完整的分布式数据库系统.不仅仅 ...
- mysql cluster 名词概念解读
Node Group [number_of_node_groups] = number_of_data_nodes / NoOfReplicas Partition When using ndbd, ...
- Mysql Cluster 集群 windows版本
VM1:192.168.220.102 管理节点(MGM) VM2:192.168.220.103 数据节点(NDBD1),SQL节点(SQL1) VM3:192.168.220.104 数据节点(N ...
- 第 16 章 MySQL Cluster
前言: MySQL Cluster 是一个基于 NDB Cluster 存储引擎的完整的分布式数据库系统.不仅仅具有高可用性,而且可以自动切分数据,冗余数据等高级功能.和 Oracle Real Cl ...
- MySql(十六):MySql架构设计——MySQL Cluster
前言: MySQL Cluster 是一个基于 NDB Cluster 存储引擎的完整的分布式数据库系统.不仅仅具有高可用性,而且可以自动切分数据,冗余数据等高级功能.和 Oracle Real Cl ...
- MySQL性能调优与架构设计——第 16 章 MySQL Cluster
第 16 章 MySQL Cluster 前言: MySQL Cluster 是一个基于 NDB Cluster 存储引擎的完整的分布式数据库系统.不仅仅具有高可用性,而且可以自动切分数据,冗余数据等 ...
- MySQL Cluster 配置文件(config.ini)详解
MySQL Cluster 配置文件(config.ini)详解 ################################################################### ...
随机推荐
- Objective-c 数据类型
这里列出Objective-c中独有数据类型: 一.字符串 在Objective-c中,字符串常量是由@和一对从引号括起的字符串序列.比如:@"China".@"obje ...
- Webform中Repeater控件--绑定嵌入C#代码四种方式
网页里面嵌入C#代码用的是<% %>,嵌入php代码<?php ?> 绑定数据的四种方式: 1.直接绑定 <%#Eval("Code") %> ...
- JSPatch技术文档
一.背景需求介绍 为什么我们需要一个热修复(hot-fix)技术? 工作中容易犯错.bug难以避免. 开发和测试人力有限. 苹果Appstore审核周期太长,一旦出现严重bug难以快速上线新版本. 作 ...
- iOS开发中遇到的bug
报错:The operation couldn’t be completed. (LaunchServicesError error 0.) 解决办法:重置模拟器
- C# Best Practices - Creating Good Methods
How to Define a Method Identify the problem => Define the single purpose => Specify the inputs ...
- MVC DI
using System;using Microsoft.Practices.Unity; public class BizInstanceFactory { private static reado ...
- URAL 1225 Flags
题目:click here #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int n; ll ...
- BZOJ 1295: [SCOI2009]最长距离( 最短路 )
把障碍点看做点(边)权为1, 其他为0. 对于每个点跑spfa, 然后和它距离在T以内的就可以更新答案 ------------------------------------------------ ...
- MongoDB Linux下的安装和启动(转)
1. 下载MongoDB,此处下载的版本是:mongodb-linux-i686-1.8.1.tgz.tar. http://fastdl.mongodb.org/linux/mongodb-linu ...
- Oracle 创建用户并且授权
以sysdba登陆 创建用户:CREATE USER username IDENTIFIED BY password; 授予(角色)权限:GRANT CONNECT,RESOURCE TO usern ...