当前位置:网站首页>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 |
边栏推荐
- js 从原型链到继承
- [wechat applet] the hosting environment of the applet
- 几个跨端开发神器
- Dart: string replace related methods
- Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column
- Internet R & D efficiency practice qunar core field Devops landing practice
- leetcode:787. K 站中转内最便宜的航班【k步最短路 + dfs记忆化 + defaultdict(dict)】
- addmodule_ allmerge_ ams_ im
- Mathematical modeling for war preparation 36 time series model 2
- 深度学习——(2)几种常见的损失函数
猜你喜欢

Research on helmet wearing detection algorithm

leetcode:1042. 不邻接植花【随机填入符合要求的 + 后面不会形成矛盾 + set.pop】

Tutoriel etcd - chapitre 8 API compacte, Watch et lease pour etcd

Undistorted resize using pil

Multi terminal collaboration of Huawei accounts to create a better internet life

博士毕业去县城工作,如何是你,怎么选?

每日刷题记录 (九)

Etcd教程 — 第九章 Etcd之实现分布式锁

利用PIL进行不失真的resize

基于SSM实现毕业设计管理系统
随机推荐
Additional: (not written yet, don't look at ~ ~ ~) webmvcconfigurer interface;
博士毕业去县城工作,如何是你,怎么选?
Construction schedule of intelligent management and control platform in Shanxi Chemical Industry Park
[demo] write file circularly
声网自研传输层协议 AUT 的落地实践丨Dev for Dev 专栏
TCP Socket与TCP 连接
Data mining knowledge points sorting (final review version)
Etcd tutorial - Chapter 8 compact, watch, and lease APIs for etcd
[200 opencv routines] 215 Drawing approximate ellipse based on polyline
STL教程7-set、pair对组和仿函数
Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"
【JVM】类加载相关面试题——类加载过程、双亲委派模型
Several cross end development artifacts
安全帽佩戴检测算法研究
nodejs学习笔记二
Niuke.com: minimum cost of climbing stairs
CGR 21 (D,E,F)
Go micro tutorial - Chapter 1 getting started
基于51单片机的计件器设计
HMS Core音频编辑服务3D音频技术,助力打造沉浸式听觉盛宴





