下文主要給大家?guī)?lái)MySQL-Cluster-7.4 安裝centos 6.9 64bit具體方法,希望這些內(nèi)容能夠帶給大家實(shí)際用處,這也是我編輯MySQL-Cluster-7.4 安裝centos 6.9 64bit具體方法這篇文章的主要目的。好了,廢話不多說(shuō),大家直接看下文吧。
創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的隴南網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
一、安裝要求
1、安裝環(huán)境:
系統(tǒng)環(huán)境:CentOS release 6.9 64bit
軟件名稱(chēng):MySQL-Cluster-server-gpl-7.4.15-1.el6.x86_64.rpm,MySQL-Cluster-client-gpl-7.4.15-1.el6.x86_64.rpm
軟件安裝位置:/usr/bin/mysql
數(shù)據(jù)存放位置:/var/lib/mysql
日志存放位置:/var/log/mysql
二、集群設(shè)計(jì)
首先設(shè)計(jì)集群的安裝分配方式,共需要5臺(tái)云服務(wù)器,云服務(wù)器分配如下:
管理節(jié)點(diǎn): 192.168.99.35
數(shù)據(jù)節(jié)點(diǎn)1: 192.168.99.36
數(shù)據(jù)節(jié)點(diǎn)2: 192.168.99.37
sql節(jié)點(diǎn)1: 192.168.99.38
sql節(jié)點(diǎn)2: 192.168.99.39
注意:目前這種設(shè)計(jì)存在的問(wèn)題是管理節(jié)點(diǎn)是單點(diǎn)的。
三、安裝部署
1、在五臺(tái)云服務(wù)器上/home創(chuàng)建mysql目錄,下載如下兩個(gè)軟件包,建議下載后直接scp過(guò)去
[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、清除五臺(tái)云服務(wù)器上的舊版本mysql
查詢遺留了哪些mysql
rpm -qa | grep mysql
通過(guò)yum方式清除mysql
yum -y remove mysql*
查詢清除是否完成
rpm -qa | grep mysql
3、在五臺(tái)云服務(wù)器上安裝MySQL-Cluster-server-gpl-7.4.15-1.el6.x86_64及MySQL-Cluster-client-gpl-7.4.15-1.el6.x86_64
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
備注:整個(gè)cluster安裝后的初次超級(jí)賬戶密碼存在/root/.mysql_secret這個(gè)文件當(dāng)中
4、創(chuàng)建文件夾及進(jìn)行授權(quán)
管理節(jié)點(diǎn)創(chuàng)建文件夾并授權(quán)
mkdir /var/lib/mysql-cluster /var/run/mysqld/
chown mysql.mysql -R /var/lib/mysql-cluster /var/run/mysqld/
數(shù)據(jù)節(jié)點(diǎn)創(chuàng)建文件夾并授權(quán):
mkdir /var/run/mysqld
chown mysql.mysql -R /var/lib/mysql /var/run/mysqld/
SQL節(jié)點(diǎn)創(chuàng)建文件夾并授權(quán)
mkdir /var/run/mysqld
chown mysql.mysql -R /var/lib/mysql /var/run/mysqld/
5、配置管理節(jié)點(diǎn)配置文件
vim /var/lib/mysql-cluster/config.ini
[ndbd default]
NoOfReplicas=2 #數(shù)據(jù)寫(xiě)入數(shù)量。2表示兩份
DataMemory=500M #配置數(shù)據(jù)存儲(chǔ)可使用的內(nèi)存
IndexMemory=100M #索引給100M
#manager options: #管理節(jié)點(diǎn)
[ndb_mgmd]
id=1
datadir=/var/lib/mysql-cluster #管理節(jié)點(diǎn)的日志
HostName=192.168.99.35 #管理節(jié)點(diǎn)的IP地址。本機(jī)IP
#data node options: #數(shù)據(jù)存儲(chǔ)節(jié)點(diǎn)
[ndbd]
HostName=192.168.99.36
DataDir=/var/lib/mysql #mysql數(shù)據(jù)存儲(chǔ)路徑
id=2
[ndbd]
HostName=192.168.99.37
DataDir=/var/lib/mysql #mysql數(shù)據(jù)存儲(chǔ)路徑
id=3
#SQLnode options: #關(guān)于SQL節(jié)點(diǎn)
[mysqld]
HostName=192.168.99.38
id=4
[mysqld]
HostName=192.168.99.39
id=5
6、配置數(shù)據(jù)節(jié)點(diǎn)配置文件
vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql #mysql數(shù)據(jù)存儲(chǔ)路徑
ndbcluster #啟動(dòng)ndb引擎
ndb-connectstring=192.168.99.35 # 管理節(jié)點(diǎn)IP地址
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql_cluster]
ndb-connectstring=192.168.99.35 #管理節(jié)點(diǎn)IP地址
7、配置sql節(jié)點(diǎn)配置文件
vim /etc/my.cnf
[mysqld]
ndbcluster #啟動(dòng)ndb引擎
ndb-connectstring=192.168.99.35 # 管理節(jié)點(diǎn)IP地址
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql_cluster]
ndb-connectstring=192.168.99.35 #管理節(jié)點(diǎn)IP地址
說(shuō)明:數(shù)據(jù)節(jié)點(diǎn)和SQL結(jié)點(diǎn)配置文件區(qū)別 ,就多一行
數(shù)據(jù)結(jié)點(diǎn)有:datadir=/var/lib/mysql #mysql數(shù)據(jù)存儲(chǔ)路徑。
四、啟動(dòng)mysql集群
初次啟動(dòng)命令以及用戶密碼更改調(diào)整:(請(qǐng)嚴(yán)格按照次序啟動(dòng))
先啟動(dòng):管理結(jié)點(diǎn)服務(wù)->數(shù)據(jù)結(jié)點(diǎn)服務(wù)->sql結(jié)點(diǎn)服務(wù)
關(guān)閉:關(guān)閉管理結(jié)點(diǎn)服務(wù),關(guān)閉管理結(jié)點(diǎn)服務(wù)后,nbdb數(shù)據(jù)結(jié)點(diǎn)服務(wù)會(huì)自動(dòng)關(guān)閉->手動(dòng)把sql結(jié)點(diǎn)服務(wù)關(guān)了。
執(zhí)行初次啟動(dòng)前請(qǐng)先確認(rèn) 將兩臺(tái)機(jī)器的防火墻關(guān)閉(service iptables stop 或者 設(shè)定 防火墻端口可通,兩個(gè)端口即通訊端口1186、數(shù)據(jù)端口3306 )
1、在99.35上啟動(dòng)管理節(jié)點(diǎn)
ndb_mgmd -f/var/lib/mysql-cluster/config.ini # mysql cluster 后臺(tái)運(yùn)行進(jìn)程
[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
查看啟動(dòng)是否成功
[root@centos-6 mysql-cluster]# netstat -antup | grep 1186
tcp 0 0 0.0.0.0:1186 0.0.0.0:* LISTEN 5075/ndb_mgmd
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、在99.36及99.37上啟動(dòng)數(shù)據(jù)節(jié)點(diǎn),第一次啟動(dòng)記得帶上初始化參數(shù)initial
[root@Centos-6-99 mysql]# ndbd --initial
2017-06-05 20:21:28 [ndbd] INFO -- Angel connected to '192.168.99.35: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:1186'
2017-06-05 20:21:47 [ndbd] INFO -- Angel allocated nodeid: 3
[root@Centos-6-99 mysql]#
3、在99.38及99.39上啟動(dòng)sql節(jié)點(diǎn)
[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、在99.35上登錄管理節(jié)點(diǎn)查看集群狀態(tài)
[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、在99.38及99.39sql節(jié)點(diǎn)添加mysql用戶
[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、外部鏈接99.38sql節(jié)點(diǎn)進(jìn)行創(chuàng)建數(shù)據(jù)庫(kù)及數(shù)據(jù)表測(cè)試
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、外部鏈接登錄99.39進(jìn)行查看及插入數(shù)據(jù)測(cè)試
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.01 sec)
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.01 sec)
mysql>
五、關(guān)閉mysql集群
關(guān)閉mysql集群順序: 關(guān)閉管理節(jié)點(diǎn)服務(wù)-》 關(guān)閉管理節(jié)點(diǎn)時(shí),數(shù)據(jù)結(jié)點(diǎn)服務(wù)自動(dòng)關(guān)閉 –》 需要手動(dòng)關(guān)閉SQL結(jié)點(diǎn)服務(wù)
1、關(guān)閉管理節(jié)點(diǎn)
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.
查看管理節(jié)點(diǎn)是否已關(guān)閉
[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 0.0 103328 876 pts/0 S+ 20:44 0:00 grep ndbd
[root@centos-6 mysql-cluster]#
查看數(shù)據(jù)節(jié)點(diǎn)是否關(guān)閉
[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 0.0 103328 872 pts/0 S+ 21:09 0:00 grep ndbd
[root@Centos-6-99 mysql]#
2、手動(dòng)關(guān)閉sql節(jié)點(diǎn)
[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
或方法二采用暴力kill方式關(guān)閉
ps -axu |grep mysql
kill -9
kill -9
ps -axu |grep mysql
六、再次啟動(dòng)mysql集群進(jìn)行故障切換測(cè)試
1、啟動(dòng)管理節(jié)點(diǎn)
[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、啟動(dòng)數(shù)據(jù)節(jié)點(diǎn)
[root@Centos-6-99 mysql]# ndbd
2017-06-05 20:47:25 [ndbd] INFO -- Angel connected to '192.168.99.35: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:1186'
2017-06-05 20:47:28 [ndbd] INFO -- Angel allocated nodeid: 3
[root@Centos-6-99 mysql]#
注意:非初始化啟動(dòng)記得不要加initial參數(shù)
3、啟動(dòng)sql節(jié)點(diǎn)
[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、通過(guò)外部云服務(wù)器分別登錄兩臺(tái)sql節(jié)點(diǎn)進(jìn)行查詢
[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、模擬數(shù)據(jù)節(jié)點(diǎn)99.36故障,在管理節(jié)點(diǎn)查詢集群狀態(tài)并在兩臺(tái)sql節(jié)點(diǎn)進(jìn)行查詢
[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 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
在管理節(jié)點(diǎn)查看可以看到99.36這臺(tái)數(shù)據(jù)節(jié)點(diǎn)斷開(kāi)了鏈接
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節(jié)點(diǎn)查詢顯示正常
[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、重新啟動(dòng)數(shù)據(jù)節(jié)點(diǎn)99.36,并在管理節(jié)點(diǎn)查看狀態(tài)
[root@Centos-6-99 mysql]# ndbd
2017-06-05 20:58:05 [ndbd] INFO -- Angel connected to '192.168.99.35: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) #顯示在初始化狀態(tài)
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)
已完成初始化的狀態(tài)
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、模擬sql節(jié)點(diǎn)99.38故障,在管理節(jié)點(diǎn)查詢集群狀態(tài)并在99.39sql節(jié)點(diǎn)進(jìn)行查詢
在99.38關(guān)閉sql節(jié)點(diǎn)
[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]#
在管理節(jié)點(diǎn)查看集群狀態(tài),顯示99.38sql節(jié)點(diǎn)斷開(kāi)鏈接
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>
遠(yuǎn)程登錄99.39節(jié)點(diǎn)查詢
[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>
對(duì)于以上關(guān)于MySQL-Cluster-7.4 安裝centos 6.9 64bit具體方法,大家是不是覺(jué)得非常有幫助。如果需要了解更多內(nèi)容,請(qǐng)繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會(huì)喜歡上這些內(nèi)容的。
新聞標(biāo)題:MySQL-Cluster-7.4安裝centos6.964bit具體方法
當(dāng)前地址:http://jinyejixie.com/article24/peooje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航、網(wǎng)頁(yè)設(shè)計(jì)公司、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)