mysql ndb安装_MySQL NDB源码安装

MYSQL-5.1.19-BETA 安装 mysql-cluster 步骤

1。下载源代码包, 目前最新包为MYSQL-5.1.23-BETA.TAR.GZ 安装方式同本文档。

主机 IP : 192.168.74.4 192.168.74.3

2。检查系统是否已经安装一下RPM包。 目前OS 为LINUX AS 4 UPDATE 4

> rpm -qa |grep libstdc++ ## 目前已经查明的如果没有这几个RPM包,将无法把CLUSTER 编译进MYSQLD 中。

compat-libstdc++-33-3.2.3-47.3

libstdc++-devel-3.4.6-3

compat-libstdc++-296-2.96-132.7.2

libstdc++-3.4.6-3

如果没有安装以上RPM 请自行安装。

3.解压缩

tar -zxvf mysql-5.1.19.tar.gz

4.安装

cd /data/mysql-5.1.19-beta

./configure

--with-charset=utf8

--with-collation=utf8_bin

--with-extra-charsets=gbk,gb2312,big5,utf8,binary,ascii

--prefix=/data/mysql

--with-plugins=partition,ndbcluster

--with-ndb-docs

--with-ndb-test

make

make install

5.

groupadd mysql

useradd -g mysql mysql

passwd mysql

cd /data/mysql

chown -R root.mysql .

bin/mysql_install_db --user=mysql ## 在执行本步骤时有可能会报错

5.1 错误信息;

[email=root@localhost]root@localhost[/email] mysql]# bin/mysql_install_db --user=mysql

Installing MySQL system tables...

080226 11:05:30 [ERROR] /data/mysql/libexec/mysqld: unknown option '--~'

080226 11:05:30 [ERROR] Aborting

080226 11:05:30 [Note] /data/mysql/libexec/mysqld: Shutdown complete

Installation of system tables failed!

出现这个错误一般情况下是主机上GCC的相关的一些开发包没有安装上,本人尚未确认具体缺那些包。

5.2 错误信息:

[root@test232 mysql]# bin/mysql_install_db --user=mysql

Installing MySQL system tables...

080226 11:20:29 [Warning] /data/mysql/libexec/mysqld: unknown option '--loose-skip-innodb'

OK

Filling help tables...

080226 11:20:29 [Warning] /data/mysql/libexec/mysqld: unknown option '--loose-skip-innodb'

OK

出现这个错误,尚不明白原因,但不影响数据库的启动和CLUSETER 的启用。目前只遇到此两种情况。

6。构建CLUSTER 。

6。1 在两台主机上分别运行1-5步骤,

6。2 在其中一台主机上: (74.4)

cd /data/mysql/libexec

vi config.ini

添加一下内容:

[NDBD DEFAULT]

NoOfReplicas= 2

DataDir= /data/mysql/libexec

[NDB_MGMD]

Hostname= 192.168.74.4

DataDir= /data/mysql/var

[NDBD]

HostName= 192.168.74.3

[NDBD]

HostName= 192.168.74.4

[MYSQLD]

HostName=192.168.74.3

[MYSQLD]

HostName=192.168.74.4

6。3 在两台主机上分别:

su -

vi /etc/my.cnf

增加或修改一下内容:

[MYSQLD]

ndbcluster # run NDB engine

ndb-connectstring=192.168.74.4 # location of MGM node

# Options for ndbd process:

[MYSQL_CLUSTER]

ndb-connectstring=192.168.74.4 # location of MGM node

6。4 在74。4上

cd /data/mysql/libexec

./ndb_mgmd -f config.ini

cd /data/mysql-5.1.19-beta/storage/ndb/src/kernel

./ndbd --initial

在74。3 上

cd /data/mysql-5.1.19-beta/storage/ndb/src/kernel

./ndbd --initial

在74。4上

cd /data/mysql

bin/ndb_mgm

show [root@test232 libexec]# ../bin/ndb_mgm

-- NDB Cluster -- Management Client --

ndb_mgm> show

Connected to Management Server at: 192.168.74.4:1186

Cluster Configuration

---------------------

[ndbd(NDB)] 2 node(s)

id=2 @192.168.74.3 (Version: 5.1.19, Nodegroup: 0, Master)

id=3 @192.168.74.4 (Version: 5.1.19, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)

id=1 @192.168.74.4 (Version: 5.1.19)

[mysqld(API)] 2 node(s)

id=4 (not connected, accepting connect from 192.168.74.3)

id=5 @192.168.74.4 (Version: 5.1.19)

6。5 在两台主机上

cd /data/mysql

bin/mysqld_safe --user=mysql

机群数据库启动完成。

7。验证:

SQL> SHOW ENGINES ;

mysql> SHOW ENGINES ;

+------------+---------+-----------------------------------------------------------+--------------+----+------------+

| Engine | Support | Comment | Transactions | XA | Savepoints |

+------------+---------+-----------------------------------------------------------+--------------+----+------------+

| ndbcluster | YES | Clustered, fault-tolerant tables | YES | NO | NO |

| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |

| CSV | YES | CSV storage engine | NO | NO | NO |

| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |

| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |

+------------+---------+-----------------------------------------------------------+--------------+----+------------+

5 rows in set (0.00 sec)

在其中一台主机上

create database dbtest ;

use dbtest ;

create table abc (id int ) engine=ndbcluster ;

insert into abc values(1) ;

commit;

在另一台主机上

creat database dbtest;

flush tables ;

show tables;

mysql> show tables;

+------------------+

| Tables_in_dbtest |

+------------------+

| ab |

+------------------+

1 row in set (0.00 sec)

8 . oK 到此为止,一个MYSQL-CLUSTER 就初步完成了。其他的my.cnf参数请自行修改,添加。[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23721637/viewspace-1048944/,如需转载,请注明出处,否则将追究法律责任。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值