当前位置:网站首页>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] takes you to learn about the garbage collection mechanism (GC) in the JVM -- including diagrams
- 异常类_日志框架
- How to connect the Internet Reading Notes - Summary
- Cmakelists Basics
- Php7.3 centos7.9 installing sqlserver extensions
- 香港回归25周年 香港故宫博物馆正式开放成文化新地标
- pref使用记录
- CMakeLists 基础
- List becomes vector list becomes vector list vector
- TCP Socket与TCP 连接
猜你喜欢

Rong Lianyun launched rphone based on Tongxin UOS to create a new ecology of localization contact center

Eight basic sorting (detailed explanation)

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

Nut cloud - sync files on your mobile hard drive on your new computer

leetcode:787. K 站中转内最便宜的航班【k步最短路 + dfs记忆化 + defaultdict(dict)】

IO stream_ recursion

Raft介绍

基于51单片机的计件器设计

js 从原型链到继承
随机推荐
In order to make remote work unaffected, I wrote an internal chat room | community essay
addmodule_allmerge_ams_im
[wechat applet] the hosting environment of the applet
声网自研传输层协议 AUT 的落地实践丨Dev for Dev 专栏
Raft介绍
泰山OFFICE技术讲座:同一行不同字号的字如何对齐绘制
Delete duplicates in an ordered array ii[double pointers -- unified in multiple cases]
List becomes vector list becomes vector list vector
Nichenet actual silicosis
数据挖掘知识点整理(期末复习版)
dart:字符串replace相关的方法
Talk about telecommuting | community essay solicitation
simpleITK读取nii遇到ITK only supports orthonormal direction cosines的错误
Design of piece counter based on 51 single chip microcomputer
addmodule_ allmerge_ ams_ im
Tutoriel etcd - chapitre 8 API compacte, Watch et lease pour etcd
Go micro tutorial - Chapter 1 getting started
Additional: (not written yet, don't look at ~ ~ ~) webmvcconfigurer interface;
Undistorted resize using pil
More than 20million videos have been played in the business list! Why is the reform of Agricultural Academies urged repeatedly?





