Home Database Mysql Tutorial How to install and configure MySQL Cluster on Linux system

How to install and configure MySQL Cluster on Linux system

Apr 20, 2023 am 10:06 AM

MySQL Cluster is a solution for MySQL database cluster that can provide high availability, high reliability, high scalability and low latency. This article will introduce how to install and configure MySQL Cluster on Linux systems.

  1. Download and decompress MySQL Cluster

First, download the latest MySQL Cluster binary installation package from the official MySQL website. After unzipping, copy the tarballs of cluster-server and cluster-manager to all nodes in the cluster. The following are the steps to install MySQL Cluster:

1

2

3

4

5

$wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.6/mysql-cluster-gpl-7.6.12-linux-glibc2.12-x86_64.tar.gz

$tar xzf mysql-cluster-gpl-7.6.12-linux-glibc2.12-x86_64.tar.gz

$cd mysql-cluster-gpl-7.6.12-linux-glibc2.12-x86_64

$cp -r bin/* /usr/local/bin/

$cp -r scripts/* /usr/local/bin/

Copy after login
  1. Create the MySQL Cluster configuration file

Create the my.cnf file on each MySQL Cluster node and set the following in it Parameters to facilitate coordinated management of all nodes:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

[ndbd default]

NoOfReplicas = 2

DataMemory = 1024M

IndexMemory = 128M

DataDir = /var/mysql-cluster/ndb-data

 

[ndb_mgmd]

NodeId = 1

HostName = 172.16.0.10

DataDir = /var/mysql-cluster/ndb-data

 

[ndbd]

NodeId = 2

HostName = 172.16.0.11

 

[ndbd]

NodeId = 3

HostName = 172.16.0.12

 

[mysqld]

NodeId = 4

HostName = 172.16.0.13

Copy after login

Four nodes are set up in the above configuration file, one of which is used as a management node, and data nodes and mysql nodes are defined on other nodes.

  1. Start the management node

In MySQL Cluster, the management node is used to coordinate the entire cluster. To start the management node, you need to specify the path to the my.cnf configuration file. You can use the following command to start:

1

ndb_mgmd -f /usr/local/mysql-cluster/my.cnf

Copy after login

After successful startup, you should see the following output:

1

2

3

4

5

6

7

8

9

10

11

12

13

ndb_mgm> show

Connected to Management Server at: localhost:1186

Cluster Configuration

---------------------

[ndbd(NDB)] 2 node(s)

id=2 (not started, accepting connect from 172.16.0.11)

id=3 (not started, accepting connect from 172.16.0.12)

 

[ndb_mgmd(MGM)] 1 node(s)

id=1    @172.16.0.10  (mysql-5.7.22 ndb-7.6.12)

 

[mysqld(API)]   1 node(s)

id=4    @172.16.0.13  (mysql-5.7.22 ndb-7.6.12)

Copy after login
  1. Start data node

Data nodes are the components that store data in MySQL Cluster. Before starting the data node, you need to create the data directory first, and then use the following command to start the data node:

1

2

mkdir -p /var/mysql-cluster/ndb-data

ndbd --initial

Copy after login
  1. Start the MySQL node

The MySQL node is connected to the MySQL cluster client. To use the MySQL node, the MySQL server must be started. Before starting the MySQL server, you need to specify the corresponding MySQL Cluster node configuration information in the MySQL configuration file. The following is an example of a MySQL node configuration file:

1

2

[mysql_cluster]

ndb-connectstring=172.16.0.10

Copy after login

You can then start the MySQL server using the following command:

1

mysqld_safe --defaults-file=/etc/mysql/my.cnf &

Copy after login
  1. Verify MySQL Cluster

Complete the above steps Finally, you can use the following command to verify whether MySQL Cluster is running normally:

1

mysql -uroot -p -h172.16.0.13

Copy after login

You can connect to the MySQL server through the above method to verify whether MySQL Cluster is working properly.

This article describes how to install and configure MySQL Cluster on Linux systems. MySQL Cluster can provide high availability, high reliability, high scalability and low latency. After completing the above steps, MySQL Cluster will be running and ready for use.

The above is the detailed content of How to install and configure MySQL Cluster on Linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Reduce the use of MySQL memory in Docker Reduce the use of MySQL memory in Docker Mar 04, 2025 pm 03:52 PM

Reduce the use of MySQL memory in Docker

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

How do you alter a table in MySQL using the ALTER TABLE statement?

How to solve the problem of mysql cannot open shared library How to solve the problem of mysql cannot open shared library Mar 04, 2025 pm 04:01 PM

How to solve the problem of mysql cannot open shared library

What is SQLite? Comprehensive overview What is SQLite? Comprehensive overview Mar 04, 2025 pm 03:55 PM

What is SQLite? Comprehensive overview

Run MySQl in Linux (with/without podman container with phpmyadmin) Run MySQl in Linux (with/without podman container with phpmyadmin) Mar 04, 2025 pm 03:54 PM

Run MySQl in Linux (with/without podman container with phpmyadmin)

Running multiple MySQL versions on MacOS: A step-by-step guide Running multiple MySQL versions on MacOS: A step-by-step guide Mar 04, 2025 pm 03:49 PM

Running multiple MySQL versions on MacOS: A step-by-step guide

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

How do I configure SSL/TLS encryption for MySQL connections?

See all articles