一臺主機上配置MySQL Cluster
一個管理節點 ndb_mgmd(MGM)
兩個資料節點 ndbd(NDB)
兩個SQL節點 mysqld(API)
[root@oel5 tmp]# tar xvfz mysql-cluster-gpl-7.1.4b-linux-x86_64-glibc23.tar.gz
[root@oel5 tmp]# mv mysql-cluster-gpl-7.1.4b-linux-x86_64-glibc23 mysqlc
建立資料檔案目錄:
[root@oel5 /]# cd /mysqlc
[root@oel5 mysqlc]# mkdir data1
[root@oel5 mysqlc]# mkdir data2
[root@oel5 /]# chown -R mysql:dba mysqlc/
建立cluster配置檔案:
[root@oel5 mysqlc]# vi config.ini
-----------------------------------------
[NDBD DEFAULT]
NoOfReplicas: 2
[MGM DEFAULT]
PortNumber: 1186
[NDB_MGMD]
Id: 1
HostName: localhost
ArbitrationRank: 1
[NDBD]
Id: 2
HostName: localhost
[NDBD]
Id: 3
HostName: localhost
[mysqld]
Id: 5
HostName: localhost
[mysqld]
Id: 6
HostName: localhost
-----------------------------------------
初始化管理節點(ndb_mgmd):
[root@oel5 /]# cd /mysqlc
[root@oel5 mysqlc]# bin/ndb_mgmd --initial -f config.ini --configdir=/mysqlc
2010-07-27 09:42:49 [MgmtSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.44 ndb-7.1.4b
2010-07-27 09:42:49 [MgmtSrvr] INFO -- Reading cluster configuration from 'config.ini'
初始化資料節點(ndbd):
[root@oel5 mysqlc]# bin/ndbd --initial -c localhost:1186
2010-07-27 09:47:42 [ndbd] INFO -- Configuration fetched from 'localhost:1186', generation: 1
[root@oel5 mysqlc]# bin/ndbd --initial -c localhost:1186
2010-07-27 09:48:32 [ndbd] INFO -- Configuration fetched from 'localhost:1186', generation: 1
建立兩個mysqld(API)節點配置檔案:
[root@oel5 mysqlc]# vi my1.cnf
-----------------------------------------
[mysqld]
ndb-nodeid=5
ndbcluster
port = 9306
datadir = /mysqlc/data1
basedir = /mysqlc
server-id = 1
log-bin
socket = /tmp/mysql5.sock
-----------------------------------------
[root@oel5 mysqlc]# vi my2.cnf
-----------------------------------------
[mysqld]
ndb-nodeid=6
ndbcluster
port = 9307
datadir = /mysqlc/data2
basedir = /mysqlc
server-id = 2
log-bin
socket = /tmp/mysql6.sock
-----------------------------------------
初始化mysqld(API)節點:
[root@oel5 mysqlc]# scripts/mysql_install_db --basedir=/mysqlc --datadir=/mysqlc/data1
[root@oel5 mysqlc]# scripts/mysql_install_db --basedir=/mysqlc --datadir=/mysqlc/data2
啟動mysqld(API)節點:
su - mysql
[mysql@oel5 mysqlc]$ bin/mysqld --defaults-file=my1.cnf &
[1] 8040
[mysql@oel5 mysqlc]$ 100727 10:31:53 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=oel5-bin' to avoid this problem.
100727 10:31:53 [Note] Plugin 'FEDERATED' is disabled.
100727 10:31:53 InnoDB: Started; log sequence number 0 44233
100727 10:31:53 [Note] NDB: NodeID is 5, management server 'localhost:1186'
100727 10:31:53 [Note] NDB[0]: NodeID: 5, all storage nodes connected
100727 10:31:53 [Note] Starting Cluster Binlog Thread
100727 10:31:53 [Note] Event Scheduler: Loaded 0 events
100727 10:31:54 [Note] NDB Binlog: Ndb tables initially read only.
100727 10:31:54 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_schema
100727 10:31:54 [Note] NDB Binlog: logging ./mysql/ndb_schema (UPDATED,USE_WRITE)
100727 10:31:54 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_apply_status
100727 10:31:54 [Note] NDB Binlog: logging ./mysql/ndb_apply_status (UPDATED,USE_WRITE)
100727 10:31:54 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$test/t_ndb
100727 10:31:54 [Note] NDB Binlog: logging ./test/t_ndb (UPDATED,USE_WRITE)
2010-07-27 10:31:55 [NdbApi] INFO -- Flushing incomplete GCI:s < 1264/7
2010-07-27 10:31:55 [NdbApi] INFO -- Flushing incomplete GCI:s < 1264/7
100727 10:31:55 [Note] NDB Binlog: starting log at epoch 1264/7
100727 10:31:55 [Note] NDB Binlog: ndb tables writable
100727 10:31:55 [Note] bin/mysqld: ready for connections.
Version: '5.1.44-ndb-7.1.4b-cluster-gpl-log' socket: '/tmp/mysql5.sock' port: 9306 MySQL Cluster Server (GPL)
[mysql@oel5 mysqlc]$ bin/mysqld --defaults-file=my2.cnf &
[2] 8060
[mysql@oel5 mysqlc]$ 100727 10:31:58 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=oel5-bin' to avoid this problem.
100727 10:31:58 [Note] Plugin 'FEDERATED' is disabled.
100727 10:31:59 InnoDB: Started; log sequence number 0 44233
100727 10:31:59 [Note] NDB: NodeID is 6, management server 'localhost:1186'
100727 10:31:59 [Note] NDB[0]: NodeID: 6, all storage nodes connected
100727 10:31:59 [Note] Starting Cluster Binlog Thread
100727 10:31:59 [Note] Event Scheduler: Loaded 0 events
100727 10:32:00 [Note] NDB Binlog: Ndb tables initially read only.
100727 10:32:00 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_schema
100727 10:32:00 [Note] NDB Binlog: logging ./mysql/ndb_schema (UPDATED,USE_WRITE)
100727 10:32:00 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$mysql/ndb_apply_status
100727 10:32:00 [Note] NDB Binlog: logging ./mysql/ndb_apply_status (UPDATED,USE_WRITE)
100727 10:32:00 [Note] NDB Binlog: Node: 2, subscribe from node 6, Subscriber bitmask 040
100727 10:32:00 [Note] NDB Binlog: Node: 3, subscribe from node 6, Subscriber bitmask 040
100727 10:32:00 [Note] NDB Binlog: DISCOVER TABLE Event: REPL$test/t_ndb
100727 10:32:00 [Note] NDB Binlog: logging ./test/t_ndb (UPDATED,USE_WRITE)
2010-07-27 10:32:00 [NdbApi] INFO -- Flushing incomplete GCI:s < 1267/2
2010-07-27 10:32:00 [NdbApi] INFO -- Flushing incomplete GCI:s < 1267/2
100727 10:32:00 [Note] NDB Binlog: starting log at epoch 1267/2
100727 10:32:00 [Note] NDB Binlog: ndb tables writable
100727 10:32:00 [Note] bin/mysqld: ready for connections.
Version: '5.1.44-ndb-7.1.4b-cluster-gpl-log' socket: '/tmp/mysql6.sock' port: 9307 MySQL Cluster Server (GPL)
檢視cluster狀態:
[mysql@oel5 mysqlc]$ bin/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 @127.0.0.1 (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0, Master)
id=3 @127.0.0.1 (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @127.0.0.1 (mysql-5.1.44 ndb-7.1.4)
[mysqld(API)] 2 node(s)
id=5 @127.0.0.1 (mysql-5.1.44 ndb-7.1.4)
id=6 @127.0.0.1 (mysql-5.1.44 ndb-7.1.4)
建表測試:
[mysql@oel5 ~]$ mysql -S /tmp/mysql5.sock
mysql> use test;
mysql> create table t5 (id int);
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| t5 |
+----------------+
mysql> create table t_ndb (id int) engine=ndb;
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| t5 |
| t_ndb |
+----------------+
[mysql@oel5 ~]$ mysql -S /tmp/mysql6.sock
mysql> use test;
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| t_ndb |
+----------------+
mysql> create table t6 (id int);
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| t6 |
| t_ndb |
+----------------+
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17997/viewspace-669579/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【轉】在同一臺主機配置MySQL ClusterMySql
- 一臺server上安裝mysql cluster(轉)ServerMySql
- 請教在同一臺機器上配置weblogic的clusterWeb
- mysql cluster 一臺server安裝MySqlServer
- mysql cluster 簡單配置MySql
- MySQL Cluster 配置檔案MySql
- MySQL 主從配置-之-一主一從MySql
- MySQL 5.6同一物理主機配置多例項MySql
- 【DATAGUARD 學習】同一臺主機上的dataguard
- 一臺機器上安裝兩個MysqlMySql
- 一臺windows主機上執行2個tomcatWindowsTomcat
- MySQL cluster 7.2叢集部署配置MySql
- 在同一臺主機上建立複製資料庫資料庫
- Window 10 單機配置MYSQL主從同步MySql主從同步
- Linux—一臺主機部署多版本mysql服務和mysql例項LinuxMySql
- 【DataGuard】同一臺主機實現物理Data Guard配置安裝
- mysql主從配置MySql
- mysql 主從配置MySql
- mysql配置主從MySql
- 配置tomcat,使得一臺主機執行多個tomcat容器Tomcat
- MySQL 配置多主一從 ( 8.0.18 版本 )MySql
- MySQL5.7在滴滴雲主機上的主從複製MySql
- MySQL主從同步配置MySql主從同步
- docker mysql 主從配置DockerMySql
- MySQL ClusterMySql
- Cluster for MySQLMySql
- MySQL主從同步(一主一從、一主多從、主從從)等結構的概述與配置MySql主從同步
- 利用rman在同一臺機器上主庫online搭建standby
- Mysql主主同步-配置資料同步MySql
- Mysql ndb-cluster centos6.4 簡單配置MySqlCentOS
- centos7上配置mysql8的主從複製CentOSMySql
- centos7上配置mysql8的雙主互寫CentOSMySql
- 漫畫:htts是如何保證一臺主機把資料安全發給另一臺主機TTS
- 使用 Cobbler 安裝一臺 CentOS 主機CentOS
- 一臺主機虛擬多個ip
- 【DG】同一臺主機實現物理Data Guard配置安裝(精簡版)
- redis cluster 配置Redis
- mysql之 mysql 5.6不停機主從搭建(一主一從基於GTID複製)MySql