免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1875 | 回复: 3

mysql cluster的配置问题 [复制链接]

论坛徽章:
0
发表于 2004-12-20 11:43 |显示全部楼层
这两天尝试用两台linux服务器安装mysql cluster,安装方法参照新闻组上某人的信息,如下:

######################### My Setup ####################################

Here is my setup:

I have two machines, Machine A and Machine B, that have requests and
updates to the db balanced by a router.  There is one IP address that
clients use to access the db.  The router distributes 50% of the
requests to Machine A and the remaining 50% to Machine B.  Therefore,
the db on both Machine A and Machine B must be exactly the same at all
times.  To achieve this I used MySQL Cluster.



I am running Redhat Linux 9 on both machines, and the machines are
physically identical.



Machine A ip = 10.0.2.39

Machine B ip = 10.0.2.38

########################### Installing ################################

I did the following on both machines:



- I installed MySql-Max (Linux (x86, glibc-2.2, static, gcc) 4.1.7

http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-max-4.1.7-pc-linux-i6
86.tar.gz/from/pick



- I extracted the tar file into the root folder, and installed the mysql
db by running the mysql_install_db script in the scripts directory.  (In
the mysql directory type-  ./scripts/mysql_install_db)



- I then created a config.ini file which I placed in the mysql
directory.  I also created a my.cnf file which I placed in the
mysql/data directory.

################### Config.ini #######################################

[NDBD DEFAULT]

NoOfReplicas= 2



[MYSQLD DEFAULT]

[NDB_MGMD DEFAULT]

[TCP DEFAULT]



[NDB_MGMD]

HostName= 10.0.2.39      (10.0.2.38 on machine B)



[NDBD]

HostName= 10.0.2.38

DataDir= /root/mysql/data



[NDBD]

HostName= 10.0.2.39

DataDir= /root/mysql/data



[MYSQLD]

[MYSQLD]

[MYSQLD]

###################### My.cnf ##########################

The my.cnf file on both machines is:

[mysqld]

ndbcluster

###################### Starting the cluster #############

To start the cluster I did the following:

(please note that MySQL is installed in the /root/mysql directory)



Machine A:

- opened a terminal.

- typed-   cd mysql

- typed-   ./bin/ndb_mgmd

       - starts the cluster manager

- typed-   ./bin/ndbd --initial

       - please note, only use the '--initial' parameter if it is the

        first time you are starting the node.  

- typed- ./bin/mysqld_safe --user=root &

       - starts mysql.  The terminal may stick here so use ctrl-c to get

         a new prompt.

- typed- ./bin/mysql

       - starts the mysql monitor.

- typed-  use test;

       - to use the test database.



Machine B:

- follow the same steps as Machine A:

###################### Testing the cluster #############

On Machine A:

- at the mysql monitor prompt

- type-  use test;

      - to use the test database.

- type-  create table cluster_test (i int) engine=ndbcluster;

      - this should create a clustered table called cluster_test.



On Machine B:

- at the mysql monitor prompt

- type-  use test;

- type-  show tables;

      -  this should show the cluster_test table created on Machine A.



Inserting

Subsequent inserts etc. can be done at the mysql monitor prompt.

Example:

On Machine A:

-        type- insert into cluster_test values(314159);



On Machine B:

-        type- select * from cluster_test;

    - should display the value 314159.

##########################################################


以上是基本安装过程,我已经完成并测试通过.

于是作进一步测试:
1.在两台机器正常运行的时候直接拔掉机器B的网线
2.在机器A作一些数据增删操作
3.将机器B的网线插上,并查看数据内容,数据不能统一
4.将机器B的ndbd_mgm,ndbd,mysqld进程全部重启,查看数据库内容,仍然不能统一

这应该属于配置问题吧?请有这方面经验的大侠给点提示?

论坛徽章:
0
发表于 2004-12-21 11:45 |显示全部楼层

mysql cluster的配置问题

翻阅文档后解决了问题,收工

论坛徽章:
0
发表于 2004-12-21 15:13 |显示全部楼层

mysql cluster的配置问题

说说你是怎么解决的呀?

论坛徽章:
0
发表于 2004-12-21 15:32 |显示全部楼层

mysql cluster的配置问题

实际上就是配置问题

[NDBD DEFAULT]
NoOfReplicas= 2

这个选项定义了两个db节点为一组,每个组只要有一个节点能连上,就不会影响整个cluster;另外运行ndb_mgm的这台服务器是不能停的,停了大家一块玩完.

最后一点是上面的安装办法有些小问题,机器B只要运行ndbd和mysqld就可以了,并在my.cnf指明ndb-connectstring和ndbd的connect-string
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP