MySQL群集双机模拟
2007-02-13 10:53:43 来源:WEB开发网shell>ndbd –initial (note:--initial选项只能在第一次启动的时候使用)
shell>/etc/init.d/mysql.server start
测试
在主机ndb1_mgmd_sqld1上执行如下过程
shell> 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.0.100 (Version: 4.1.12, Nodegroup: 0, Master)
id=3 @192.168.0.200 (Version: 4.1.12, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.100 (Version: 4.1.12)
[mysqld(SQL)] 1 node(s)
id=4 (Version: 4.1.12)
出现如上信息则表示mysql群集安装成功
数据抽样测试
在主机ndb1_mgmd_sqld1上执行如下过程
shell>/usr/local/mysql/bin/mysql -u root test
MySQL>DROP TABLE IF EXISTS City;
CREATE TABLE City (
ID int(11) NOT NULL auto_increment,
Name char(35) NOT NULL default '',
CountryCode char(3) NOT NULL default '',
District char(20) NOT NULL default '',
Population int(11) NOT NULL default '0',
PRIMARY KEY (ID)
) ENGINE=NDBCLUSTER;
MySQL>INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
更多精彩
赞助商链接