亚洲综合社区欧美综合色-欧美逼逼一区二区三区-国产老熟女高潮精品网站-国产日韩最新视频在线看

始創(chuàng)于2000年 股票代碼:831685
咨詢熱線:0371-60135900 注冊(cè)有禮 登錄
  • 掛牌上市企業(yè)
  • 60秒人工響應(yīng)
  • 99.99%連通率
  • 7*24h人工
  • 故障100倍補(bǔ)償
全部產(chǎn)品
您的位置: 網(wǎng)站首頁 > 幫助中心>文章內(nèi)容

MySQL集群mysql-cluster安裝

發(fā)布時(shí)間:  2012/8/30 16:50:27

hostname      IP地址       應(yīng)用服務(wù)
DB1         www.linuxidc.com     MGM
DB2         192.168.6.160     NDBD,MYSQLD
-
 

DB3         192.168.6.188     NDBD2, MYSQLD
DB4         192.168.6.191     MYSQLD一.DB1 管理節(jié)點(diǎn) MGM

./configure --prefix=/usr/local/mysql/ --with-charset=utf8 --with-collation=utf8_general_ci --with-client-ldflags=-all-static -with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-unix-socket-path=/tmp/mysql.sock --sysconfdir=/usr/local/mysql/etc --without-debug --with-mysqld-user=mysql --with-plugin=innobase --with-plugin-ndbcluster --with-plugin-partition
make
make install
cd /usr/local/mysql
mkdir mysql-cluster
cd mysql-cluster
vim config.ini

[ndbd default]
NoOfReplicas= 2
[MYSQLD DEFAULT]
[ndb_mgmd default]
DataDir= /usr/local/mysql/mysql-cluster
[ndb_mgmd]
HostName= www.linuxidc.com
[ndbd]
HostName= 192.168.6.160
DataDir= /usr/local/mysql/mysql-cluster
[ndbd]
HostName= 192.168.6.188
DataDir= /usr/local/mysql/mysql-cluster
[mysqld]
HostName= 192.168.6.160
[mysqld]
HostName= 192.168.6.188
[mysqld]
HostName= 192.168.6.191/usr/local/mysql/libexec/ndb_mgmd -f /usr/local/mysql/mysql-cluster/config.ini/usr/local/mysql/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 (not connected, accepting connect from 192.168.6.160)
id=3 (not connected, accepting connect from 192.168.6.188)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @www.linuxidc.com (Version: 5.1.45)

[mysqld(API)] 3 node(s)
id=4 (not connected, accepting connect from 192.168.6.160)
id=5 (not connected, accepting connect from 192.168.6.188)
id=6 (not connected, accepting connect from 192.168.6.191)可以看到ndb_mgmd 是 連上的,nbd 和 mysqld 還沒有連上~

二.在兩個(gè)ndbd 節(jié)點(diǎn) DB1,DB2 安裝mysql

./configure --prefix=/usr/local/mysql/ --with-charset=utf8 --with-collation=utf8_general_ci --with-client-ldflags=-all-static -with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-unix-socket-path=/tmp/mysql.sock --sysconfdir=/usr/local/mysql/etc --without-debug --with-mysqld-user=mysql --with-plugin=innobase --with-plugin-ndbcluster --with-plugin-partition

groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql
chown root.mysql . -R
/usr/local/mysql/bin/mysql_install_db --user=mysql

vim /usr/local/mysql/etc/my.cnf
[mysqld]
basedir = /usr/local/mysql/
datadir = /usr/local/mysql/var
user = mysql
port = 3306
socket = /tmp/mysql.sock
ndbcluster
ndb-connectstring=www.linuxidc.com
[mysql_cluster]
ndb-connectstring=www.linuxidc.com/usr/local/mysql/libexec/ndbd --initial ### 第一次啟動(dòng)需要 --initial 以后在啟動(dòng)不需要加隨后啟動(dòng)兩臺(tái)ndbd 節(jié)點(diǎn)上的 mysql 服務(wù)

/usr/local/mysql/bin/mysqld_safe --user=mysql &然后在 MGM 服務(wù)器上查看

/usr/local/mysql/bin/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.6.160 (Version: 5.1.45, Nodegroup: 0)
id=3 @192.168.6.188 (Version: 5.1.45, Nodegroup: 0, Master)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @www.linuxidc.com (Version: 5.1.45)
[mysqld(API)] 3 node(s)
id=4 @192.168.6.160 (Version: 5.1.45)
id=5 @192.168.6.188 (Version: 5.1.45)
id=6 (not connected, accepting connect from 192.168.6.191)從上面可以看出 兩個(gè) ndbd 節(jié)點(diǎn) 和 ndbd 上的兩個(gè)mysql 服務(wù)已經(jīng)連接上了。
三.DB4安裝mysql節(jié)點(diǎn)

./configure --prefix=/usr/local/mysql/ --with-charset=utf8 --with-collation=utf8_general_ci --with-client-ldflags=-all-static -with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-unix-socket-path=/tmp/mysql.sock --sysconfdir=/usr/local/mysql/etc --without-debug --with-mysqld-user=mysql --with-plugin=innobase --with-plugin-ndbcluster --with-plugin-partition
groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql
chown root.mysql . -R
/usr/local/mysql/bin/mysql_install_db --user=mysql
vim /usr/local/mysql/etc/my.cnf
[mysqld]
basedir = /usr/local/mysql/
datadir = /usr/local/mysql/var
user = mysql
port = 3306
socket = /tmp/mysql.sock
ndbcluster
ndb-connectstring=www.linuxidc.com
[mysql_cluster]
ndb-connectstring=www.linuxidc.com啟動(dòng) mysql 服務(wù)

/usr/local/mysql/bin/mysqld_safe --user=mysql &回到 MGM 上查看是否正常

DB1 $> /usr/local/mysql/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 @192.168.6.160 (Version: 5.1.45, Nodegroup: 0)
id=3 @192.168.6.188 (Version: 5.1.45, Nodegroup: 0, Master)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @www.linuxidc.com (Version: 5.1.45)
[mysqld(API)] 3 node(s)
id=4 @192.168.6.160 (Version: 5.1.45)
id=5 @192.168.6.188 (Version: 5.1.45)
id=6 @192.168.6.191 (Version: 5.1.45)好了,一切正常了,現(xiàn)在回到 mysql 節(jié)點(diǎn)上 創(chuàng)建和刪除數(shù)據(jù)看是否同步。
那么就登錄 DB2 的 mysql

DB2 $> /usr/local/mysql/bin/mysql -uroot -p
Mysql >show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
Mysql > create database eric;
Query OK, 1 row affected (0.39 sec)
Mysql >show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| eric |
| mysql |
+--------------------+
3 rows in set (0.01 sec)好了,在看 DB3 DB4 上是否同步

Db3 $> /usr/local/mysql/bin/mysql -uroot -p
Mysql $> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| eric |
| mysql |
+--------------------+DB4 $> /usr/local/mysql/bin/mysql -uroot -p
Mysql $> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| eric |
| mysql |
+--------------------+

都看到了 eric 數(shù)據(jù)庫·結(jié)束


本文出自:億恩科技【1tcdy.com】

服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

  • 您可能在找
  • 億恩北京公司:
  • 經(jīng)營性ICP/ISP證:京B2-20150015
  • 億恩鄭州公司:
  • 經(jīng)營性ICP/ISP/IDC證:豫B1.B2-20060070
  • 億恩南昌公司:
  • 經(jīng)營性ICP/ISP證:贛B2-20080012
  • 服務(wù)器/云主機(jī) 24小時(shí)售后服務(wù)電話:0371-60135900
  • 虛擬主機(jī)/智能建站 24小時(shí)售后服務(wù)電話:0371-60135900
  • 專注服務(wù)器托管17年
    掃掃關(guān)注-微信公眾號(hào)
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權(quán)所有  地址:鄭州市高新區(qū)翠竹街1號(hào)總部企業(yè)基地億恩大廈  法律顧問:河南亞太人律師事務(wù)所郝建鋒、杜慧月律師   京公網(wǎng)安備41019702002023號(hào)
      1
     
     
     
     

    0371-60135900
    7*24小時(shí)客服服務(wù)熱線