MySQL installation-MySQL INODB Cluster(8)

The operating system is CentOS 7-64bit.
5 CentOS servers or virtual machines. I will use the host name and IP address as follows:
Management node
MySQL1.test.com = 192.168.1.51
SQL node
MySQL2.test.com = 192.168.1.52
MySQL3.test.com = 192.168.1.53
data node
MySQL4.test.com = 192.168.1.54
MySQL5.test.com = 192.168.1.55
Download the installation package
MySQL installation-MySQL INODB Cluster(8)
https://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.18-1.el 7. x86_64.rpm- bundle.tar
Installation and Settings
Management Node
MySQL1.test.com = 192.168.1.51
SQL Node
MySQL2.test.com = 192.168.1.52
MySQL3.test.com = 192.168.1.53
Data Node
MySQL4.test.com = 192.168.1.51 1.54
MySQL5.test.com = 192.168.1.55
Management node installation settings
Download the software package and unzip
[root@MySQL1 ~]# wget wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar

[root@MySQL1 ~]# mkdir MySQL
[root@MySQL1 ~]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar -C MySQL/

Install the necessary software
[root@MySQL1 ~]#yum -y install net-tools
[root@MySQL1 ~]#yum -y install perl-Data-Dumper
Install to
see if MySQL or mariadb is already installed
[root@MySQLcluster1 MySQL]# rpm -qa |grep mariadb*
[root@MySQL1 ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64
rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1 .el7.x86_64.rpm
rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm

MySQL installation-MySQL INODB Cluster(8)
MySQL installation-MySQL INODB Cluster(8)
Set
up the configuration folder
[root@MySQL1 MySQL]# mkdir -p /var/lib/MySQL-cluster
MySQL installation-MySQL INODB Cluster(8)
set up the configuration file
according to the following steps to set and save
[root@MySQL1 MySQL]# cd /var/lib/MySQL-cluster
[ root@MySQL1 MySQL-cluster]# vi config.ini

[ndb_mgmd default]
DataDir=/var/lib/MySQL-cluster

[ndb_mgmd]
#Management Node db1
HostName=192.168.1.51

[ndbd default]
NoOfReplicas=2 # Number of replicas
DataMemory=256M # Memory allocate for data storage
IndexMemory=128M # Memory allocate for index storage
#Directory for Data Node
DataDir=/var/lib/MySQL-cluster

[MySQLd]
#SQL Node db2
HostName=192.168.1.52

[MySQLd]
#SQL Node db3
HostName=192.168.1.53

[ndbd]
#Data Node db4
HostName=192.168.1.54

[ndbd]
#Data Node db5
HostName=192.168.1.55
MySQL installation-MySQL INODB Cluster(8)
Start the management node and view the status
Start the management node
Next, use the following command to start the management node:
[root@MySQL1 MySQL-cluster]# ndb_mgmd --config-file=/var/ lib/MySQL-cluster/config.ini
MySQL installation-MySQL INODB Cluster(8)
view status
[root@MySQL1 MySQL-cluster]# ndb_mgm
ndb_mgm> show
MySQL installation-MySQL INODB Cluster(8)
DATA NODE node installation and setting
installation steps are the same as management node
DATANODE1 installation setting
installation
[root@MySQL4 ~]# wget http:/ /dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 ~l]# tar -xvf MySQL -Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL4 MySQL]# yum -y install net-tools
[root@MySQL4 MySQL]# yum -y remove mariadb-libs
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64. RPM
2.2.6.3.2.1.2 setting configuration file
[the root @ MySQL4 the MySQL] #vi /etc/my.cnf
[the MySQLd]
NDBCLUSTER
NDB-ConnectString # = 192.168.1.51 the IP address of the Node Management
[mysql_cluster]
NDB-ConnectString = 192.168 .1.51 # IP address of Management Node
MySQL installation-MySQL INODB Cluster(8)
Create a new database folder
[root@MySQL4 MySQL]# mkdir -p /var/lib/MySQL-cluster
MySQL installation-MySQL INODB Cluster(8)
start
[root@MySQL4 MySQL]# ndbd
MySQL installation-MySQL INODB Cluster(8)
DATANODE2 installation settings are the
same as data node 1
installation
[root@MySQL4 ~]# wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 ~l]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL4 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL4 MySQL]# yum -y install net-tools
[root@MySQL4 MySQL]# yum -y remove mariadb-libs
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL4 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm
设置配置文件
[root@MySQL5 MySQL]#vi /etc/my.cnf
[MySQLd]
ndbcluster
ndb-connectstring=192.168.1.51 # IP address of Management Node
[MySQL_cluster]
ndb-connectstring=192.168.1.51 # IP address of Management Node
MySQL installation-MySQL INODB Cluster(8)
New database folder
[root@MySQL5 MySQL]# mkdir -p /var/lib/MySQL- cluster
MySQL installation-MySQL INODB Cluster(8)
start
[root@MySQL5 MySQL]# ndbd
MySQL installation-MySQL INODB Cluster(8)
SQL NODE installation and
installation steps are the same as the management node
SQL NODE1 installation settings
installation
[root@MySQL2 ~]# wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster- 7.4/MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL2 ~l]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64. rpm-
bundle.tar [root@MySQL2 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL2 MySQL]# yum -y install net-tools
[root@MySQL2 MySQL]# yum -y remove mariadb-libs
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-client-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10-1.el7.x86_64.rpm
2.2.6.3.3.1.2设置
[root@MySQL2 MySQL]# vi /etc/my.cnf
[MySQLd]
ndbcluster
ndb-connectstring=192.168.1.51 # IP address for server management node
default_storage_engine=ndbcluster # Define default Storage Engine used by MySQL

[MySQL_cluster]
ndb-connectstring=192.168.1.51 # IP address for server management node
MySQL installation-MySQL INODB Cluster(8)
Create database folder
[root@MySQL2 MySQL]# mkdir -p /var/lib/MySQL-cluster
MySQL installation-MySQL INODB Cluster(8)
start
[root@MySQL2 MySQL]# service MySQL start
MySQL installation-MySQL INODB Cluster(8)
SQL NODE2 installation is the
same as SQL node 1
installation
[root@MySQL2 ~]# wget http://dev.MySQL.com/get/Downloads/MySQL-Cluster-7.4/MySQL-Cluster-gpl-7.4.10-1.el7 .x86_64.rpm-bundle.tar
[root@MySQL2 ~l]# tar -xvf MySQL-Cluster-gpl-7.4.10-1.el7.x86_64.rpm-bundle.tar
[root@MySQL2 MySQL]# yum -y install perl-Data-Dumper
[root@MySQL2 MySQL]# yum -y install net-tools
[root@MySQL2 MySQL]# yum -y remove mariadb-libs
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-client- gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-server-gpl-7.4.10-1.el7.x86_64.rpm
[root@MySQL2 MySQL]# rpm -Uvh MySQL-Cluster-shared-gpl-7.4.10 -1.el7.x86_64.rpm
2.2.6.3.3.2.2 configuration settings
[@ MySQL3 the MySQL the root] # VI /etc/my.cnf
[the MySQLd]
NDBCLUSTER
NDB-ConnectString # = 192.168.1.51 the IP address for Node Management Server
default_storage_engine =ndbcluster # Define default Storage Engine used by MySQL
[MySQL_cluster]
ndb-connectstring=192.168.1.51 # IP address for server management node
MySQL installation-MySQL INODB Cluster(8)
Create database folder
[root@MySQL3 MySQL]# mkdir -p /var/lib/MySQL-cluster
MySQL installation-MySQL INODB Cluster(8)
start
[root@MySQL3 MySQL]# service MySQL start The
MySQL installation-MySQL INODB Cluster(8)
management node monitors the cluster to
view the cluster status
[root@MySQL1 ~]# ndb_mgm
ndb_mgm> show
MySQL installation-MySQL INODB Cluster(8)
In this case, the cluster has completed the
data test status without logging in
[root@MySQL1 ~]# ndb_mgm -e "all status"
[root@MySQL1 ~]# ndb_mgm -e "all report memory"
MySQL installation-MySQL INODB Cluster(8)
Modify the password and test the
modified password
Find the password to
log in to Check the password on sql node1, the password has been reminded in .MySQL_secret during the previous installation
MySQL installation-MySQL INODB Cluster(8)
[root@MySQL2 ~]# cat .MySQL_secret
MySQL installation-MySQL INODB Cluster(8)
initialize MySQL change MySQL password
[root@MySQL2 ~]# MySQL_secure_installation
MySQL installation-MySQL INODB Cluster(8)
fix the login password
MySQL installation-MySQL INODB Cluster(8)
delete all users
MySQL installation-MySQL INODB Cluster(8)
refuse root remote Login select no
MySQL installation-MySQL INODB Cluster(8)
whether to delete the test database no
MySQL installation-MySQL INODB Cluster(8)
re-import permission configuration
MySQL installation-MySQL INODB Cluster(8)
add account and grant remote login read and write database permissions
[root@MySQL2 ~]# MySQL -uroot -pP@ssw0rd
MySQL installation-MySQL INODB Cluster(8)
Create an external account for remote login
MySQL> CREATE USER'stonehu '@'%' IDENTIFIED BY'P@ssw0rd';
MySQL installation-MySQL INODB Cluster(8)
view the user permission table
MySQL> select user, host, password from MySQL.user;
MySQL installation-MySQL INODB Cluster(8)
and grant the new stonehu user read and write permissions from the remote node
MySQL> GRANT ALL PRIVILEGES ON . TO 'stonehu'@'%' IDENTIFIED BY PASSWORD '*8232A1298A49F710DBEE0B330C42EEC825D4190A' WITH GRANT OPTION;
MySQL installation-MySQL INODB Cluster(8)

Guess you like

Origin blog.51cto.com/huxiaoqiu/2539804