当前位置:网站首页>Mysql8 NDB cluster installation and deployment
Mysql8 NDB cluster installation and deployment
2022-06-30 17:09:00 【Joyce. Du】
1、NDB Cluster Introduce

MySQL NDB Cluster Use MySQL The server and NDB Storage engine ,NDBCLUSTER ( Also known as NDB) It's a kind of Memory storage engine , Provide high availability and data persistence .NDB Cluster take MySQL The server and NDB The memory cluster storage engine is integrated together .NDB The cluster consists of a set of hosts , Each host runs one or more processes . These processes, called nodes, can include MySQL The server ( Used to access the NDB data )、 Data nodes ( For storing data )、 One or more management servers .
(1) The management node (Management node): This type of node is used to manage NDB Cluster Other nodes in , Execute provide configuration data 、 Start and stop the node and run backup . Because this node type manages the configuration of other nodes , So you should start this type of node first , Then start any other nodes . Use command ndb_mgmd Start the management node
(2) Data nodes (Data node):NDB Cluster Core functions , Used to save data 、 Indexes , Control the transaction . The inserted data is stored in different node groups according to the hash value of the primary key ( Each node group holds some data ), In addition, within each node group , Data is replicated to different data nodes for redundancy
(3)SQL node (SQL node): It's equivalent to an increase in NDB Storage engine MySQL The server , Data nodes act as NDB Storage engine use , If you use other MySQL Storage engine , for example InnoDB,MyISAM etc. , The data will be saved in SQL Node ; Application through SQL Nodes access data nodes , The method of use is the same as the usual MySQL equally ,SQL The node will automatically find the correct data node to retrieve the data
2、 Environmental planning
Node type | IP | Host name | Occupied port |
The management node | 172.16.80.56 | mgr0 | 1186 |
Data nodes | 172.16.80.57 172.16.80.58 | mgr1 mgr2 | 2202 |
SQL node | 172.16.80.59 | mgr3 | 3306,33060 |
3、 download MySQL NDB Cluster
Community Edition :MySQL :: Download MySQL Cluster

Business Edition :https://edelivery.oracle.com/osdc/faces/SoftwareDelivery

choice glibc Binary installation package :

4、 All nodes are initialized
(1) Uninstall existing mysql client
rpm -qa|grep mysql rpm -qa|grep mariadb rpm -e *** uninstall |
(2) establish mysql Catalog
lvcreate -L 300G -n lvmysql vgtest mkfs.xfs /dev/vgtest/lvmysql mount /dev/vgtest/lvmysql /mysql |
(3) establish mysql Users and groups
groupadd -g 512 mysql useradd -u 512 -g 512 -d /mysql mysql chown -R mysql.mysql /mysql |
(4) decompression glibc Package to /mysql
su - mysql cd /mysql tar -xvf /soft/mysql-cluster-commercial-8.0.29-linux-glibc2.12-x86_64.tar.gz mv mysql-cluster-commercial-8.0.29-linux-glibc2.12-x86_64 mysql-cluster-8.0.29 mkdir /mysql/data |
(5) Configure environment variables
vi /etc/profile export MYSQL_CLUSTER_HOME=/mysql/mysql-cluster-8.0.29 export PATH="$PATH:${MYSQL_CLUSTER_HOME}/bin" |
5、 Manage node configuration
(1) To configure config.ini
cat /mysql/config.ini [ndbd default] # Options affecting ndbd processes on all data nodes: NoOfReplicas=2 # Number of fragment replicas, Specifies the number of copies of each piece of data that are redundantly stored on different nodes , # This parameter is one General should at least be set to 2, The number of segments is the total number of data nodes divided by NoOfReplicas DataMemory=98M # How much memory to allocate for data storage BackupDataDir=/mysql/backup # Data node backup directory [ndb_mgmd] # The management node : HostName=172.16.80.56 DataDir=/mysql/data [ndbd] # Data nodes "A": HostName=172.16.80.57 NodeId=2 DataDir=/mysql/data [ndbd] # Data nodes "B": HostName=172.16.80.58 NodeId=3 DataDir=/mysql/data [mysqld] # SQL node : HostName=172.16.80.59 |
(2) To configure my.cnf
cat /mysql/my.cnf [mysqld] # Options for mysqld process: ndbcluster # run NDB storage engine datadir=/mysql/data basedir=/mysql/mysql-cluster-8.0.29 [mysql_cluster] # Options for NDB Cluster processes: ndb-connectstring=172.16.80.56 # location of management server |
(3) Initialize and start the management node
ndb_mgmd --defaults-file=/mysql/my.cnf --initial --config-file /mysql/config.ini --configdir=/mysql |
(4) Restart the management node and view the cluster status
ndb_mgm show shutdown exit Start the management node normally : ndb_mgmd --defaults-file=/mysql/my.cnf --config-file /mysql/config.ini --configdir=/mysql
|
6、 Data node configuration ( Both data nodes execute )
(1) To configure my.cnf
cat /mysql/my.cnf [mysql_cluster] # Options for NDB Cluster processes: ndb-connectstring=172.16.80.56 # location of management server |
(2) Start two ndbd Data nodes
ndbd --defaults-file=/mysql/my.cnf
|
7、MySQL Node configuration
(1) Create the necessary Directory
su - mysql mkdir -p /mysql/log |
(2) establish my.cnf
cat /mysql/my.cnf [mysqld] # Options for mysqld process: ndbcluster # run NDB storage engine datadir=/mysql/data basedir=/mysql/mysql-cluster-8.0.29 log-error=/mysql/log/mysqld.log pid-file=/mysql/mysqld.pid [mysql_cluster] # Options for NDB Cluster processes: ndb-connectstring=172.16.80.56 # location of management server |
(3) establish /etc/my.cnf Soft link
ln -s /mysql/my.cnf /etc/my.cnf |
(4) establish mysqld Service and start
cp /mysql/mysql-cluster-8.0.29/support-files/mysql.server /etc/init.d/mysqld service mysqld status service mysqld start |
(5) Reset root password
Check the temporary password /mysql/log/mysqld.log

mysql -uroot -p alter user [email protected] identified by 'R00t_123'; exit mysql -uroot -pR00t_123 show engines;
|
8、 Start stop test
Stop sequence :
SQL node --> Data nodes --> The management node
Startup sequence :
The management node --> Data nodes -->SQL node
Stop the order :
service mysqld stop(SQL node )
ndb_mgm -e shutdown( The management node )
Start command :
ndb_mgmd --defaults-file=/mysql/my.cnf --config-file /mysql/config.ini --configdir=/mysql( The management node )
ndbd --defaults-file=/mysql/my.cnf ( All data nodes )
service mysqld start(SQL node )
9、 establish NDB Table test
(1) establish InnoDB surface
create database ndb_test; use ndb_test; CREATE TABLE `test1` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(10), PRIMARY KEY (`id`) ) ENGINE=InnoDB; |
Find out InnoDB Tables are built on SQL nodes

(2) establish ndb surface
CREATE TABLE `test2` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(10) , PRIMARY KEY (`id`) ) ENGINE=ndbcluster/ndb; |
(3) Test both tables insert/select Speed
DROP PROCEDURE IF EXISTS repeatCourse; DELIMITER $ CREATE PROCEDURE repeatCourse() BEGIN DECLARE i INT DEFAULT 1; WHILE i < 400000 DO insert into ndb_test.test2 values(null,i); SET i = i + 1; END WHILE; END $ DELIMITER ; CALL repeatCourse();
It seems to be ndb Tables are faster |
边栏推荐
- simpleITK读取nii遇到ITK only supports orthonormal direction cosines的错误
- List announced - outstanding intellectual property service team in China in 2021
- addmodule_allmerge_ams_im
- 利用PIL进行不失真的resize
- Halcon knowledge: matrix topic [02]
- Geo read single cell CSV expression matrix single cell column name change Seurat
- Rongsheng biology rushes to the scientific innovation board: it plans to raise 1.25 billion yuan, with an annual revenue of 260million yuan
- More than 20million videos have been played in the business list! Why is the reform of Agricultural Academies urged repeatedly?
- 几个跨端开发神器
- leetcode:1042. 不邻接植花【随机填入符合要求的 + 后面不会形成矛盾 + set.pop】
猜你喜欢

Exception class_ Log frame

“推广+搞笑剧情”,如何碰撞出爆款的火花?

Data security compliance has brought new problems to the risk control team

Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"

期未课程设计:基于SSM的产品销售管理系统
![Delete duplicates in an ordered array ii[double pointers -- unified in multiple cases]](/img/e2/cadfdbe476a86cb2d72c1ae0160a4a.png)
Delete duplicates in an ordered array ii[double pointers -- unified in multiple cases]

数据库系统概论习题册

Mathematical modeling for war preparation 34-bp neural network prediction 2
![[JVM] class loading related interview questions - class loading process and parental delegation model](/img/4a/99fee19828b0c1234cc863db88fda1.png)
[JVM] class loading related interview questions - class loading process and parental delegation model

Niuke: how many different binary search trees are there
随机推荐
Nut cloud - sync files on your mobile hard drive on your new computer
【OpenCV 例程200篇】215. 基于多段线绘制近似椭圆
"Promotion + funny plot", how to collide with the sparks of popular funds?
Home office discussion on the experience of remote assistance to quickly improve efficiency | community essay solicitation
深度学习——(2)几种常见的损失函数
IO stream_ recursion
Parler du télétravail
华为帐号多端协同,打造美好互联生活
Symantec electronic sprint technology innovation board: Tan Jian, the actual controller, is an American who plans to raise 620million yuan
go-micro教程 — 第一章 快速入门
STL教程7-set、pair对组和仿函数
Php7.3 centos7.9 installing sqlserver extensions
Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column
MySQL8 NDB Cluster安装部署
Design of piece counter based on 51 single chip microcomputer
Jsr303 and common validator implementations
Substrate 跨链技术源码级探索: XCVM的概览
博士毕业去县城工作,如何是你,怎么选?
Compile - compile for itop4412 development board makefile
泰山OFFICE技术讲座:同一行不同字号的字如何对齐绘制





