7. mysql-cluster and mysql-cluster

Source: Internet
Author: User

7. mysql-cluster and mysql-cluster

This article describes how to install Mysql-Cluster. First, let's take a look at the following: (linux User, debian myself)

MySQL Cluster is a technology that allows you to deploy the "in memory" Database Cluster in a non-shared system. Without a shared architecture, the system can use cheap hardware without special requirements for hardware and software. In addition, since each component has its own memory and disk, there is no single point of failure. (Baidu paste -_-)

I. Introduction

Mysql-cluster is divided:

1. manage nodes: manage other nodes in the MySQL Cluster, such as providing configuration data, starting and stopping nodes, and running backups.

2. Data Node: used to save Cluster data

3. SQL node: the node used to access Cluster data




Ii. Installation

This installation is a management node, two data nodes, two SQL nodes, installed on two machines, one machine: Management node, data node, SQL node, and the other: data Node and 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

 

Iii. Installation Steps

1. Add a logon 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

# Music mysql-cluster-gpl-7.3.7-linux-glibc2.5-x86_64/*/opt/mysql-r

 

Create the mysql-cluster directory and configure config. ini

# Mkdir/apps/mysql-cluster

# Cd/apps/mysql-cluster

# Vi config. ini

The content is as follows: 

[Ndbddefault]

NoOfReplicas = 2 (representing the number of SQL nodes)

DataMemory = 500 M

IndexMemory = 300 M

[Tcpdefault]

SendBufferMemory = 2 M

ReceiveBufferMemory = 2 M 

[Ndb_mgmddefault]

PortNumber = 1186

Datadir =/apps/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. Install data nodes

Vi/etc/my. cnf

As follows:

[Mysqld]

Datadir =/opt/mysql/ndbdata

Port = 3306

 

Ndbcluster # data nodes (merged because they are on one machine)

Ndb-connectstring = 192.168.1.111

Port = 3307

[Mysql_cluster]

Ndb-connectstring = 192.168.1.111


4. Install SQL nodes

Vi/etc/my. cnf

As follows:

[Mysqld]

Datadir =/opt/mysql/ndbdata

Port = 3306

 

Ndbcluster # data node (because all data nodes are merged 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

Enable sequence: manage nodes> data nodes> SQL nodes

 

Manage node startup

# Cd/opt/mysql

#./Bin/ndb_mgmd-f/apps/mysql-cluster/config. ini -- configdir =/apps/mysql-cluster/-- ndb-nodeid = 1

 

Start the data node (both nodes must be started, or the SQL node cannot be started)

# 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, Nodegroup: 0 ,*)

Id = 3 @ 192.168.1.112 (mysql-5.6.21, 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)

 

Indicates that the operation is successful.

 

7. Problem

Q: The SQL node cannot start "Tablesnot available after 30 seconds. Considerincreasing -- ndb-wait-setup value"

A: Not all data nodes are started.

Q: When an SQL node is started: "Unable to lock./ibdata1, error: 11"

A: It has been started.

Q: When logging on to SQL: mysql-u root-p

1045 access denied for user 'root' @ 'localhost' using password yes

A: directly run mysql-u root (you need to modify the configuration file)


Note: you are welcome to raise your questions and make progress together!

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.