環境說明
ndbd2:192.168.100.213
sql1:192.168.100.214
sql2:192.168.100.215
一、cluster安裝(五個節點)
安裝相關依賴包
# yum -y install perl libaio ntpdate
關閉防火牆
# service iptables stop
刪除系統自帶mysql:
# rpm -qa | grep mysql
# rpm -e --allmatches --nodeps mysql-libs-5.1.71-1.el6.x86_64
解壓縮軟體
上傳軟體到/main目錄
# cd /main
# tar zxvf mysql-cluster-advanced-7.3.7-linux-glibc2.5-x86_64.tar.gz
# mv mysql-cluster-advanced-7.3.7-linux-glibc2.5-x86_64 mysql
新建mysql使用者及使用者組
# groupadd mysql
# useradd -g mysql -s /usr/sbin/nologin mysql
# chown -r mysql:mysql /main/mysql
安裝cluster
# /main/mysql/scripts/mysql_install_db --user=mysql --basedir=/main/mysql --datadir=/main/mysql/data
二、節點配置
1.配置 mgm (mgm 節點)
刪除自帶的my.cnf檔案
必須要刪除自帶的/etc/my.cnf,如果沒有就不用刪除
# rm -rf /etc/my.cnf
新建配置檔案存放目錄
# mkdir /main/mysql/etc
# chown mysql:mysql /main/mysql/etc
建立配置檔案config.ini
# vi /main/mysql/etc/config.ini
[ndb_mgmd default]
datadir = /main/mysql/data
[ndbd default]
noofreplicas = 2
datamemory = 80m
indexmemory = 18m
datadir = /main/mysql/data
[ndb_mgmd]
nodeid = 1
hostname = 192.168.100.211
[ndbd]
nodeid = 11
hostname = 192.168.100.212
[ndbd]
nodeid = 12
hostname = 192.168.100.213
[mysqld]
nodeid = 81
hostname = 192.168.100.214
[mysqld]
nodeid = 82
hostname = 192.168.100.215
2.配置資料節點(ndbd1和ndbd2節點)
建立配置檔案my.cnf
# vi /etc/my.cnf
[mysqld]
ndbcluster
ndb-connectstring = 192.168.100.211
[mysql_cluster]
ndb-connectstring = 192.168.100.211
3.配置sql節點(sql1和sql2節點)
拷貝檔案
# cp -p /main/mysql/support-files/mysql.server /etc/init.d/mysqld
建立配置檔案my.cnf
# vi /etc/my.cnf
[mysqld]
basedir = /main/mysql
datadir = /main/mysql/data
ndbcluster
ndb-connectstring = 192.168.100.211
[mysql_cluster]
ndb-connectstring = 192.168.100.211
三、啟動節點
啟動需按如下順序進行:mgm > ndbd > sql
如下的啟動方式只適合首次啟動,或者備份、恢復或配置變化後重啟時,否則將清空所有資料
1:啟動 mgm (mgm 節點)
# mkdir -p /usr/local/mysql/mysql-cluster
# ndb_mgmd -f /main/mysql/etc/config.ini --initial
檢視集群狀態
# ndb_mgm -e show12
3456
78910
1112
13connected
to
management server
at
: localhost:1186
cluster configuration
---------------------
[ndbd(ndb)] 2 node(s)
id=11 (
not
connected, accepting
connect
from
192.168.100.212)
id=12 (
not
connected, accepting
connect
from
192.168.100.213)
[ndb_mgmd(mgm)] 1 node(s)
id=1 @192.168.100.211 (mysql-5.6.21 ndb-7.3.7)
[mysqld(api)] 2 node(s)
id=81 (
not
connected, accepting
connect
from
192.168.100.214)
id=82 (
not
connected, accepting
connect
from
192.168.100.215)
2:啟動ndbd(ndbd1和ndbd2節點)
# ndbd --initial
3:啟動sql (sql1和sql2節點)
# service mysqld start
四、關閉集群
在管理節點切換到 /usr/local/mysql/bin目錄
#./ndb_mgm -e shutdown
五、非初次啟動
--啟動管理節點
[root@localhost config]# /cluster/bin/ndb_mgmd -f /cluster_data/config/config.ini
mysql cluster management server mysql-5.6.29 ndb-7.4.11
--啟動資料節點
[root@localhost mysql-cluster-gpl-7.4.11]# /cluster/bin/ndbd
2016-05-15 06:41:36 [ndbd] info -- angel connected to '192.168.78.141:1186'
2016-05-15 06:41:36 [ndbd] info -- angel allocated nodeid: 2
--重啟sql節點
[root@localhost mysql-cluster-gpl-7.4.11]# /cluster/bin/mysqladmin -usystem -p shutdown
[root@localhost mysql-cluster-gpl-7.4.11]# /cluster/bin/mysqld_safe --defaults-file=/etc/my.cnf
mysql安裝指南 MySQL安裝指南
本文僅僅針對mysql在windows 環境下的應用,展開說明。mysql enterprise edition mysql企業版 含了資料庫檔案,不包含其他的工具元件。許多任務具元件,比如notifier,workbench,connector等。安裝了這個,就等於mysql 安裝全了。ga 是穩...
mysql集群安裝面板 mysql集群安裝指南
環境說明 系統環境 centos 6.5 mini 64bit 軟體版本 mysql cluster advanced 7.3.7 linux glibc2.5 x86 64.tar.gz mgm 192.168.100.211 ndbd1 192.168.100.212 ndbd2 192.168...
mysql集群安裝配置 mysql集群安裝配置
groupadd mysql useradd mysql g mysql mv mysql cluster gpl 7.0.8a linux i686 glibc23.tar.gz usr local cd usr local tar zxvf mysql cluster gpl 7.0.8a li...