This article mainly introduces the installation of Mysql-cluster, first to understand briefly: (Linux users, I Debian)
MySQL Cluster is a technology that allows the Cluster of an "in-memory" database to be deployed in a system that is not shared. With no shared architecture, the system can use inexpensive hardware and has no special requirements for hardware and software. In addition, because each component has its own memory and disk, there is no single point of failure. (Baidu paste-_-)
First, Introduction
Mysql-cluster is divided into:
1. Management node: manage Other nodes within MySQL Cluster, such as providing configuration data, starting and stopping nodes, running backups, etc.
2. Data node: data for saving Cluster
3. SQL node: the node used to access Cluster data
Second, installation
This installation is for 1 management nodes, 2 data nodes, 2 SQL nodes, installed on two machines, one machine: Management node, data node, SQL node, another: Data node, SQL node
Node name |
Ip |
Management node |
192.168.1.111 |
Data Node 1 |
192.168.1.111 |
Data Node 2 |
192.168.1.112 |
SQL Node 1 |
192.168.1.111 |
SQL Node 2 |
192.168.1.112 |
Third, installation steps
1. To add a login user group for MYSQLD, both servers need
# Groupadd MySQL
# useradd–g Mysqlmysql
2. Install the Management node
# tar ZXVF mysql-cluster-gpl-7.3.7-linux-glibc2.5-x86_64.tar.gz
# MV Mysql-cluster-gpl-7.3.7-linux-glibc2.5-x86_64/*/opt/mysql–r
Create the Mysql-cluster directory and configure the Config.ini
# Mkdir/apps/mysql/mysql-cluster
# Cd/apps/mysql/mysql-cluster
# VI Config.ini
The contents are as follows:
[Ndbddefault]
Noofreplicas=2 (represents the number of SQL nodes)
datamemory=500m
indexmemory=300m
[Tcpdefault]
Sendbuffermemory=2m
Receivebuffermemory=2m
[Ndb_mgmddefault]
portnumber=1186
Datadir=/apps/mysql/mysql-cluster
[NDB_MGMD]
Nodeid=1
hostname=192.168.1.111
[NDBD]
nodeid=2
hostname=192.168.1.111
Datadir=/apps/mysql/data
[NDBD]
nodeid=2
hostname=192.168.1.112
Datadir=/apps/mysql/data
[Mysqld]
Nodeid=3
hostname=192.168.1.111
[Mysqld]
Nodeid=3
hostname=192.168.1.112
3. Installing the Data node
Vi/etc/my.cnf
As follows:
[Mysqld]
Datadir=/opt/mysql/ndbdata
Port =3306
Ndbcluster #数据节点 (as in a machine so merge)
ndb-connectstring=192.168.1.111
Port =3307
[Mysql_cluster]
ndb-connectstring = 192.168.1.111
4. Install the SQL node
Vi/etc/my.cnf
As follows:
[Mysqld]
Datadir=/opt/mysql/ndbdata
Port =3306
Ndbcluster #数据节点 (since all merges on one machine)
ndb-connectstring=192.168.1.111
Port =3307
[Mysql_cluster]
ndb-connectstring = 192.168.1.111
Next: (Install mysqld)
# Cd/opt/mysql
#./scripts/mysql_install_db–user=mysql (installed in/opt/mysql/ndbdata)
5. Start Cluster
Open Order: Management node, data node->sql node
Management node Startup
# Cd/opt/mysql
#./bin/ndb_mgmd–f/apps/mysql/mysql-cluster/config.ini--configdir=/apps/mysql/mysql-cluster/--ndb-nodeid=1
Data node start (two nodes will start or SQL node will not start)
# Cd/opt/mysql
#./bin/ndbd–-initial–-ndb-connectstring=192.168.1.111:1186
SQL Node Startup
# Cd/opt/mysql/ndbdata
# .. /bin/mysqld_safe–user=mysql &
6. View
# cd/opt/mysql/
#./bin/ndb_mgm–e Show
Connectedto Management Server at:192.168.1.111:1186
Clusterconfiguration
---------------------
[NDBD (NDB)] 1 node (s)
id=2 @192.168.1.111 (mysql-5.6.21 ndb-7.3.7, nodegroup:0, *)
Id=3 @192.168.1.112 (mysql-5.6.21 ndb-7.3.7, nodegroup:0, *)
[NDB_MGMD (MGM)] 1 node (s)
Id=1 @192.168.1.111 (mysql-5.6.21 ndb-7.3.7)
[Mysqld (API)] 1 node (s)
Id=4 @192.168.1.112 (mysql-5.6.21 ndb-7.3.7)
Id=5 @192.168.1.112 (mysql-5.6.21 ndb-7.3.7)
The instructions are successful.
7. Questions
The Q:sql node cannot start tablesnot available after seconds. Considerincreasing--ndb-wait-setup Value "
A: Data node not all started
Q:sql node Startup: "Unable to lock./ibdata1, error:11"
A: It's already started.
Q: When logging in to SQL: Mysql–u root-p
1045 Access denied for user ' root ' @ ' localhost ' using password Yes
A: Direct Mysql–u root (need to modify config file)
Note: Welcome to raise questions, common progress!
7. Mysql-cluster cluster-Installation article