Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install centos 6.9 64bit in MySQL-Cluster-7.4

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following mainly brings you the specific methods of MySQL-Cluster-7.4 installing centos 6.9 64bit. I hope these contents can bring you practical use, which is also the main purpose of this article when I edit the specific methods of MySQL-Cluster-7.4 installation centos 6.9 64bit. All right, don't talk too much nonsense, let's just read the following.

I. installation requirements

1. Installation environment:

System environment: CentOS release 6.9 64bit

Software name: MySQL-Cluster-server-gpl-7.4.15-1.el6.x86copyright 64.rpm, MySQL house, club house, client house, gplink 7.4.15-1.el6.x86_64.rpm

Software installation location: / usr/bin/mysql

Data storage location: / var/lib/mysql

Log location: / var/log/mysql

Second, cluster design

First of all, design the installation and allocation method of the cluster. A total of 5 CVMs are required. The CVM is assigned as follows:

Management node: 192.168.99.35

Data Node 1: 192.168.99.36

Data Node 2: 192.168.99.37

Sql Node 1: 192.168.99.38

Sql Node 2: 192.168.99.39

Note: the problem with the current design is that the management node is a single point.

III. Installation and deployment

1. Create a mysql directory on five CVMs / home, and download the following two software packages. It is recommended to download them and scp them directly.

[root@centos-6 ~] # mkdir / home/mysql

[root@centos-6 ~] # cd / home/mysql/

[root@centos-6 mysql] # wget http://mirrors.sohu.com/mysql/MySQL-Cluster-7.4/MySQL-Cluster-server-gpl-7.4.15-1.el6.x86_64.rpm

[root@centos-6 mysql] # wget http://mirrors.sohu.com/mysql/MySQL-Cluster-7.4/MySQL-Cluster-client-gpl-7.4.15-1.el6.x86_64.rpm

2. Clear the old version of mysql on five CVM

Query which mysql is left behind

Rpm-qa | grep mysql

Clear mysql by yum

Yum-y remove mysql*

Query whether the cleanup is complete

Rpm-qa | grep mysql

3. Install MySQL-Cluster-server-gpl-7.4.15-1.el6.x86_64 and MySQL-Cluster-client-gpl-7.4.15-1.el6.x86_64 on five CVMs

Yum-y install MySQL-Cluster-server-gpl-7.4.15-1.el6.x86_64.rpm MySQL-Cluster-client-gpl-7.4.15-1.el6.x86_64.rpm

Note: the password of the first super account after the installation of cluster is stored in the file / root/.mysql_secret.

4. Create a folder and authorize it

The administrative node creates a folder and authorizes

Mkdir / var/lib/mysql-cluster / var/run/mysqld/

Chown mysql.mysql-R / var/lib/mysql-cluster / var/run/mysqld/

The data node creates a folder and authorizes:

Mkdir / var/run/mysqld

Chown mysql.mysql-R / var/lib/mysql / var/run/mysqld/

The SQL node creates a folder and authorizes

Mkdir / var/run/mysqld

Chown mysql.mysql-R / var/lib/mysql / var/run/mysqld/

5. Configuration management node configuration file

Vim / var/lib/mysql-cluster/config.ini

[ndbd default]

The number of NoOfReplicas=2 # data writes. 2 means two copies

DataMemory=500M # memory available for configuring data stores

IndexMemory=100M # index to 100m

# manager options: # Management Node

[ndb_mgmd]

Id=1

Datadir=/var/lib/mysql-cluster # manage the log of the node

HostName=192.168.99.35 # the IP address of the management node. Native IP

# data node options: # data storage node

[ndbd]

HostName=192.168.99.36

DataDir=/var/lib/mysql # mysql data storage path

Id=2

[ndbd]

HostName=192.168.99.37

DataDir=/var/lib/mysql # mysql data storage path

Id=3

# SQLnode options: # about SQL nodes

[mysqld]

HostName=192.168.99.38

Id=4

[mysqld]

HostName=192.168.99.39

Id=5

6. Configure the data node configuration file

Vim / etc/my.cnf

[mysqld]

Datadir=/var/lib/mysql # mysql data storage path

Ndbcluster # start the ndb engine

Ndb-connectstring=192.168.99.35 # Management Node IP address

[mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

[mysql_cluster]

Ndb-connectstring=192.168.99.35 # Management Node IP address

7. Configure the sql node configuration file

Vim / etc/my.cnf

[mysqld]

Ndbcluster # start the ndb engine

Ndb-connectstring=192.168.99.35 # Management Node IP address

[mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

[mysql_cluster]

Ndb-connectstring=192.168.99.35 # Management Node IP address

Description: the difference between data node and SQL node configuration file is one more line.

The data nodes are: datadir=/var/lib/mysql # mysql data storage path.

Start the mysql cluster

Initial startup command and user password change adjustment: (please start in strict order)

Start first: manage Node Service-> data Node Service-> sql Node Service

Shutdown: after shutting down the management node service and shutting down the management node service, the nbdb data node service will automatically shut down-> manually shut down the sql node service.

Before performing the first boot, please make sure that the firewalls of the two machines are turned off (service iptables stop or set the firewall port to be accessible, the two ports are communication port 1186 and data port 3306)

1. Start the management node on 99.35

Ndb_mgmd-f/var/lib/mysql-cluster/config.ini # mysql cluster background running process

[root@centos-6 mysql-cluster] # ndb_mgmd-f/var/lib/mysql-cluster/config.ini

MySQL Cluster Management Server mysql-5.6.36 ndb-7.4.15

2017-06-05 20:18:55 [MgmtSrvr] INFO-- The default config directory'/ usr/mysql-cluster' does not exist. Trying to create it...

2017-06-05 20:18:55 [MgmtSrvr] INFO-- Sucessfully created config directory

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 8: [MGM] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 16: [DB] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 20: [DB] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 25: [API] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 28: [API] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 8: [MGM] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 16: [DB] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 20: [DB] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 25: [API] id is deprecated, use NodeId instead

2017-06-05 20:18:55 [MgmtSrvr] WARNING-- at line 28: [API] id is deprecated, use NodeId instead

Check to see if the startup is successful

[root@centos-6 mysql-cluster] # netstat-antup | grep 1186

Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 18. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0

Tcp 0 0 127.0.0.1:47322 127.0.0.1:1186 ESTABLISHED 5075/ndb_mgmd

Tcp 0 0 127.0.0.1:1186 127.0.0.1:47322 ESTABLISHED 5075/ndb_mgmd

2. Start the data node on 99.36 and 99.37, and remember to bring the initialization parameter initial when starting for the first time.

[root@Centos-6-99 mysql] # ndbd-initial

2017-06-05 20:21:28 [ndbd] INFO-- Angel connected to '192.168.99.35 purl 1186'

2017-06-05 20:21:28 [ndbd] INFO-- Angel allocated nodeid: 2

[root@Centos-6-99 mysql] #

[root@Centos-6-99 mysql] # ndbd-initial

2017-06-05 20:21:47 [ndbd] INFO-- Angel connected to '192.168.99.35 purl 1186'

2017-06-05 20:21:47 [ndbd] INFO-- Angel allocated nodeid: 3

[root@Centos-6-99 mysql] #

3. Start the sql node on 99.38,99.39

[root@localhost mysql] # 170605 20:23:23 mysqld_safe Logging to'/ var/log/mysqld.log'.

170605 20:23:23 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

[root@localhost mysql] # 170605 20:23:32 mysqld_safe Logging to'/ var/log/mysqld.log'.

170605 20:23:32 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

4. Log in to the management node on 99.35 to view the cluster status

[root@centos-6 mysql-cluster] # ndb_mgm

-NDB Cluster-Management Client--

Ndb_mgm > show

Connected to Management Server at: localhost:1186

Cluster Configuration

-

[ndbd (NDB)] 2 node (s)

Id=2 @ 192.168.99.36 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0, *)

Id=3 @ 192.168.99.37 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0)

[ndb_mgmd (MGM)] 1 node (s)

Id=1 @ 192.168.99.35 (mysql-5.6.36 ndb-7.4.15)

[mysqld (API)] 2 node (s)

Id=4 @ 192.168.99.38 (mysql-5.6.36 ndb-7.4.15)

Id=5 @ 192.168.99.39 (mysql-5.6.36 ndb-7.4.15)

Ndb_mgm >

5. Add mysql users to 99.38and 99.39sql nodes

[root@localhost mysql] # cat / root/.mysql_secret

# The random password set for the root user at Mon Jun 5 19:55:57 2017 (local time): MsIBXVtxWT4He5JF

[root@localhost mysql] # mysql-u root-pMsIBXVtxWT4He5JF

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 2

Server version: 5.6.36-ndb-7.4.15-cluster-gpl

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql > show databases

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

Mysql > set password for 'root'@'localhost'=password (' 123456')

Query OK, 0 rows affected (0.00 sec)

Mysql > quit

Bye

[root@localhost mysql] # mysql-u root-p123456

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 3

Server version: 5.6.36-ndb-7.4.15-cluster-gpl MySQL Cluster Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql > grant all privileges on *. * to cluster@ "%" identified by "123456"

Query OK, 0 rows affected (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.01 sec)

Mysql >

6. External link 99.38sql node for database creation and data table testing

Mysql-ucluster-p123456-h213.106.99.38

Mysql > create database db

Mysql > use db

Mysql > create table test (id int) engine=ndb

Mysql > insert into test values (10)

Mysql > insert into test values (11)

Mysql > select * from test

+-+

| | id |

+-+

| | 11 |

| | 10 |

+-+

2 rows in set (0.00 sec)

Mysql >

7. Log in to 99.39 for viewing and data insertion testing.

Mysql-ucluster-p123456-h213.106.99.39

Mysql > show databases

Mysql > use db

Mysql > insert into test values (12)

Query OK, 1 row affected (0.01sec)

Mysql > insert into test values (13)

Query OK, 1 row affected (0.00 sec)

Mysql > select * from test

+-+

| | id |

+-+

| | 10 |

| | 12 |

| | 13 |

| | 11 |

+-+

4 rows in set (0.01sec)

Mysql >

Shut down the mysql cluster

Turn off mysql cluster order: shut down the management node service-"data node service shuts down automatically when shutting down the management node -" requires manual shutdown of the SQL node service

1. Close the management node

Ndb_mgm

Ndb_mgm > shutdown

Node 2: Cluster shutdown initiated

Node 3: Cluster shutdown initiated

Node 2: Node shutdown completed.

Node 3: Node shutdown completed.

3 NDB Cluster node (s) have shutdown.

Disconnecting to allow management server to shutdown.

Check to see if the management node is closed

[root@centos-6 mysql-cluster] # ps-axu | grep ndbd

Warning: bad syntax, perhaps a bogus'-'? See / usr/share/doc/procps-3.2.8/FAQ

Root 5127 0.0 103328 876 pts/0 S+ 20:44 0:00 grep ndbd

[root@centos-6 mysql-cluster] #

Check to see if the data node is closed

[root@Centos-6-99 mysql] # ps-axu | grep ndbd

Warning: bad syntax, perhaps a bogus'-'? See / usr/share/doc/procps-3.2.8/FAQ

Root 2243 0.0 103328 872 pts/0 S + 21:09 0:00 grep ndbd

[root@Centos-6-99 mysql] #

2. Manually close the sql node

[root@localhost mysql] # mysqladmin-uroot-p123456 shutdown

Warning: Using a password on the command line interface can be insecure.

170605 20:45:02 mysqld_safe mysqld from pid file / var/run/mysqld/mysqld.pid ended

[1] + Done mysqld_safe-- defaults-file=/etc/my.cnf

Or method 2: use violent kill to shut down

Ps-axu | grep mysql

Kill-9

Kill-9

Ps-axu | grep mysql

Start the mysql cluster again for failover test

1. Start the management node

[root@centos-6 mysql-cluster] # ndb_mgm

-NDB Cluster-Management Client--

Ndb_mgm > show

Connected to Management Server at: localhost:1186

Cluster Configuration

-

[ndbd (NDB)] 2 node (s)

Id=2 (not connected, accepting connect from 192.168.99.36)

Id=3 (not connected, accepting connect from 192.168.99.37)

[ndb_mgmd (MGM)] 1 node (s)

Id=1 @ 192.168.99.35 (mysql-5.6.36 ndb-7.4.15)

[mysqld (API)] 2 node (s)

Id=4 (not connected, accepting connect from 192.168.99.38)

Id=5 (not connected, accepting connect from 192.168.99.39)

2. Start the data node

[root@Centos-6-99 mysql] # ndbd

2017-06-05 20:47:25 [ndbd] INFO-- Angel connected to '192.168.99.35 purl 1186'

2017-06-05 20:47:25 [ndbd] INFO-- Angel allocated nodeid: 2

[root@Centos-6-99 mysql] #

[root@Centos-6-99 mysql] # ndbd

2017-06-05 20:47:28 [ndbd] INFO-- Angel connected to '192.168.99.35 purl 1186'

2017-06-05 20:47:28 [ndbd] INFO-- Angel allocated nodeid: 3

[root@Centos-6-99 mysql] #

Note: remember not to add initial parameter in non-initialization startup.

3. Start the sql node

[root@localhost mysql] # mysqld_safe-- defaults-file=/etc/my.cnf &

[1] 2014

[root@localhost mysql] # 170605 20:49:49 mysqld_safe Logging to'/ var/log/mysqld.log'.

170605 20:49:49 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

[root@localhost mysql] #

[root@localhost mysql] # mysqld_safe-- defaults-file=/etc/my.cnf &

[1] 1740

[root@localhost mysql] # 170605 20:49:57 mysqld_safe Logging to'/ var/log/mysqld.log'.

170605 20:49:57 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

[root@localhost mysql] #

4. Log in to two sql nodes through external CVM to query

[coolner@localhost] $mysql-ucluster-p123456-h213.106.99.38

Mysql > use db

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > select * from test

+-+

| | id |

+-+

| | 12 |

| | 13 |

| | 11 |

| | 10 |

+-+

4 rows in set (0.00 sec)

Mysql >

[coolner@localhost] $mysql-ucluster-p123456-h213.106.99.39

Mysql > use db

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > select * from test

+-+

| | id |

+-+

| | 12 |

| | 13 |

| | 11 |

| | 10 |

+-+

4 rows in set (0.00 sec)

Mysql >

5. Simulate the failure of the data node 99.36, query the cluster status in the management node and query the two sql nodes

[root@Centos-6-99 mysql] # ps-aux | grep ndbd

Warning: bad syntax, perhaps a bogus'-'? See / usr/share/doc/procps-3.2.8/FAQ

Root 2141 0.0 0.0 27292 2640? Ss 20:47 0:00 ndbd

Root 2142 1.0 27.5 3155544 1082592? Sl 20:47 0:04 ndbd

Root 2187 0.0 103328 876 pts/0 S+ 20:54 0:00 grep ndbd

[root@Centos-6-99 mysql] # kill-9 2141

[root@Centos-6-99 mysql] # kill-9 2142

If you look at the management node, you can see that 99.36 this data node is disconnected.

Ndb_mgm > show

Cluster Configuration

-

[ndbd (NDB)] 2 node (s)

Id=2 (not connected, accepting connect from 192.168.99.36)

Id=3 @ 192.168.99.37 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0, *)

[ndb_mgmd (MGM)] 1 node (s)

Id=1 @ 192.168.99.35 (mysql-5.6.36 ndb-7.4.15)

[mysqld (API)] 2 node (s)

Id=4 @ 192.168.99.38 (mysql-5.6.36 ndb-7.4.15)

Id=5 @ 192.168.99.39 (mysql-5.6.36 ndb-7.4.15)

Ndb_mgm >

Sql node query display is normal

[coolner@localhost] $mysql-ucluster-p123456-h213.106.99.38

Mysql > use db

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > select * from test

+-+

| | id |

+-+

| | 12 |

| | 13 |

| | 11 |

| | 10 |

+-+

4 rows in set (0.00 sec)

[coolner@localhost] $mysql-ucluster-p123456-h213.106.99.39

Mysql > use db

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > select * from test

+-+

| | id |

+-+

| | 12 |

| | 13 |

| | 11 |

| | 10 |

+-+

4 rows in set (0.00 sec)

Mysql >

6. Restart the data node 99.36 and check the status in the management node

[root@Centos-6-99 mysql] # ndbd

2017-06-05 20:58:05 [ndbd] INFO-- Angel connected to '192.168.99.35 purl 1186'

2017-06-05 20:58:05 [ndbd] INFO-- Angel allocated nodeid: 2

[root@Centos-6-99 mysql] #

Ndb_mgm > show

Cluster Configuration

-

[ndbd (NDB)] 2 node (s)

Id=2 @ 192.168.99.36 (mysql-5.6.36 ndb-7.4.15, starting, Nodegroup: 0) # shows in the initialization state

Id=3 @ 192.168.99.37 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0, *)

[ndb_mgmd (MGM)] 1 node (s)

Id=1 @ 192.168.99.35 (mysql-5.6.36 ndb-7.4.15)

[mysqld (API)] 2 node (s)

Id=4 @ 192.168.99.38 (mysql-5.6.36 ndb-7.4.15)

Id=5 @ 192.168.99.39 (mysql-5.6.36 ndb-7.4.15)

The state of having completed initialization.

Ndb_mgm > show

Cluster Configuration

-

[ndbd (NDB)] 2 node (s)

Id=2 @ 192.168.99.36 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0)

Id=3 @ 192.168.99.37 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0, *)

[ndb_mgmd (MGM)] 1 node (s)

Id=1 @ 192.168.99.35 (mysql-5.6.36 ndb-7.4.15)

[mysqld (API)] 2 node (s)

Id=4 @ 192.168.99.38 (mysql-5.6.36 ndb-7.4.15)

Id=5 @ 192.168.99.39 (mysql-5.6.36 ndb-7.4.15)

Ndb_mgm >

7. Simulate the sql node 99.38fault, query the cluster status in the management node and query the 99.39sql node

Shut down the sql node at 99.38

[root@localhost mysql] # mysqladmin-uroot-p123456 shutdown

Warning: Using a password on the command line interface can be insecure.

170605 21:01:02 mysqld_safe mysqld from pid file / var/run/mysqld/mysqld.pid ended

[1] + Done mysqld_safe-- defaults-file=/etc/my.cnf

[root@localhost mysql] #

Check the cluster status in the management node and show that the 99.38sql node is broken.

Ndb_mgm > show

Cluster Configuration

-

[ndbd (NDB)] 2 node (s)

Id=2 @ 192.168.99.36 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0)

Id=3 @ 192.168.99.37 (mysql-5.6.36 ndb-7.4.15, Nodegroup: 0, *)

[ndb_mgmd (MGM)] 1 node (s)

Id=1 @ 192.168.99.35 (mysql-5.6.36 ndb-7.4.15)

[mysqld (API)] 2 node (s)

Id=4 (not connected, accepting connect from 192.168.99.38)

Id=5 @ 192.168.99.39 (mysql-5.6.36 ndb-7.4.15)

Ndb_mgm >

Remote login 99.39 node query

[coolner@localhost] $mysql-ucluster-p123456-h292.168.99.39

Mysql > use db

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > select * from test

+-+

| | id |

+-+

| | 10 |

| | 12 |

| | 13 |

| | 11 |

+-+

4 rows in set (0.00 sec)

Mysql >

For the above specific methods of installing centos 6.9 64bit for MySQL-Cluster-7.4, do you think it is very helpful? If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report