当前位置:网站首页>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 |
边栏推荐
- [JVM] class loading related interview questions - class loading process and parental delegation model
- Mathematical modeling for war preparation 34-bp neural network prediction 2
- addmodule_allmerge_ams_im
- 删除有序数组中的重复项 II[双指针--多情况统一]
- Niuke network: longest continuous subarray with positive product
- Jsr303 and common validator implementations
- List announced - outstanding intellectual property service team in China in 2021
- Required plug-ins for idea
- Php7.3 centos7.9 installing sqlserver extensions
- go-micro教程 — 第一章 快速入门
猜你喜欢

阿里云盘分享压缩包

Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column

坚果云-在新电脑上同步移动硬盘的文件

More dragon lizard self-developed features! Production available Anolis OS 8.6 officially released

巩固入门-C#基础变量和常量

Design of piece counter based on 51 single chip microcomputer

Mathematical modeling for war preparation 34-bp neural network prediction 2

Mathematical modeling for war preparation 36 time series model 2

Raft介绍
![[Verilog basics] summary of some concepts about clock signals (clock setup/hold, clock tree, clock skew, clock latency, clock transition..)](/img/54/fd7541dae4aad7e4216bcaabbb146b.png)
[Verilog basics] summary of some concepts about clock signals (clock setup/hold, clock tree, clock skew, clock latency, clock transition..)
随机推荐
列表变成向量 列表变向量 list vector
pref使用记录
互联网研发效能实践之去哪儿网(Qunar)核心领域DevOps落地实践
“推广+搞笑剧情”,如何碰撞出爆款的火花?
leetcode:787. K 站中转内最便宜的航班【k步最短路 + dfs记忆化 + defaultdict(dict)】
differential analysis between different groups nichenet for silicosis成功运行!
restartProcessIfVisible的流程
Niuke: how many different binary search trees are there
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
Several cross end development artifacts
NielsenIQ迎来零售实验室负责人Dawn E. Norvell,将加速扩张全球零售战略
Cmakelists Basics
register_ Chrdev and CDEV_ init cdev_ Add usage differences
CGR 21 (D,E,F)
数据挖掘知识点整理(期末复习版)
Nut cloud - sync files on your mobile hard drive on your new computer
Parler du télétravail
Redis data structure analysis
Mathematical modeling for war preparation 33- grey prediction model 2
Delete duplicates in an ordered array ii[double pointers -- unified in multiple cases]





