RHEL5.7上MySQL-Cluster-7.2.13双机集群安装部署手册

本文档详细介绍了在RHEL5.7环境下,如何配置一个基于两台服务器的高可用MySQL-Cluster。集群配置包括Data node、Daemon node和Management node,确保即使单台服务器故障,数据库服务仍能正常运行。文中涵盖了安装、配置、初始化、启动管理节点、加入mysqld节点、设置数据库权限以及功能和破坏性测试的全过程。
摘要由CSDN通过智能技术生成

一、介绍

这篇文档旨在介绍如何安装配置基于2台服务器的MySQL集群。并且实现任意一台服务器出现问题或宕机时MySql集群依然能够继续运行。

1.MySQL-Cluster简介

MySQL-Cluster主要有三种类型节点:

Data node,数据节点将保存数据库,它会自动复制所有的数据节点;

Daemon node,守护节点相当于是SQL数据库和客户端之间的接口,它提供从数据节点查询等操作,类似于"网关";

Management node,管理节点,用以监控和管理整个集群。

2.安装环境及软件包

2台PC机,通过VMWare创建虚拟机,然后安装操作系统

软件包:MySQL-Cluster-client-gpl-7.2.13-1.rhel5.i386.rpm

                MySQL-Cluster-server-gpl-7.2.13-1.rhel5.i386.rpm

操作系统:Redhat.Enterprise.Linux.v5.UPDATE.7.X86.DVD-HOTiSO.iso

serverA:192.168.0.180

serverB:192.168.0.181

数据库管理节点:192.168.0.180,192.168.0.181

数据库数据节点:192.168.0.180,192.168.0.181

数据库SQL节点(API节点):192.168.0.180,192.168.0.181

 

二、在serverA和serverB上安装MySQL-cluster

以下步骤需要在serverA和serverB上各做一次

1.首先检查linux操作系统中是否安装了自带的mysql数据库

一般linux自带mysql版本都比较低一些,因此要安装比较新的版本需要先将自带的低版本卸载。

检查操作系统中是否安装了mysql的命令:rpm -qa |grep -i mysql

卸载mysql的命令:rpm -e mysqlXXXX

或者使用yum -remove mysqlXXX来删除,这样可以避免卸载过程中由于各个包之间的依赖造成卸载停止

2.创建mysql用户和组

groupadd mysql

useradd -g mysqlmysql

usermod-d /home/mysql mysql

3.将MySQL-Cluster上传到/home/mysql/目录下,开始安装MySQL-Cluster

[root@serverAsbin]# rpm -ivh MySQL-Cluster-server-gpl-7.2.13-1.rhel5.i386.rpm

InstallingMySQL system tables...

13102811:00:50 [Warning] Forcing shutdown of 3 plugins

OK

Fillinghelp tables...

13102811:00:50 [Warning] Forcing shutdown of 3 plugins

OK

To startmysqld at boot time you have to copy

support-files/mysql.serverto the right place for your system

 

PLEASEREMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so,start the server, then issue the following commands:

 

./bin/mysqladmin-u root password 'new-password'

./bin/mysqladmin-u root -h serverB password 'new-password'

 

Alternativelyyou can run:

./bin/mysql_secure_installation

 

whichwill also give you the option of removing the test

databasesand anonymous user created by default. This is

stronglyrecommended for production servers.

 

See themanual for more instructions.

 

You canstart the MySQL daemon with:

cd . ;./bin/mysqld_safe &

 

You cantest the MySQL daemon with mysql-test-run.pl

cd./mysql-test ; perl mysql-test-run.pl

 

Pleasereport any problems with the ./bin/mysqlbug script!

 

Thelatest information about MySQL is available at http://www.mysql.com/

SupportMySQL by buying support/licenses from http://shop.mysql.com/

 

[root@serverAsbin]# rpm -ivh MySQL-Cluster-client-gpl-7.2.13-1.rhel5.i386.rpm

Preparing...               ########################################### [100%]

   1:MySQL-Cluster-client-gp ###########################################[100%]

4.安装完成之后创建连接

#ln -s /usr/sbin/ndbd /usr/bin

#ln -s /usr/sbin/ndb_mgmd /usr/bin

#ln -s /usr/sbin/mysqld /usr/bin


三、安装并配置节点

以下步骤需要在serverA和serverB上各做一次

1.配置管理节点配置文件

# mkdir /var/lib/mysql-cluster

# cd/var/lib/mysql-cluster

# vi config.ini

在config.ini中添加如下内容:

[ndbd default]

NoOfReplicas= 2

MaxNoOfConcurrentOperations=10000

# Amount of memoryrequired=(SizeofDatabase * NumberOfReplicas * 1.1 ) / NumberOfDataNodes

DataMemory= 128M

IndexMemory= 24M

TimeBetweenWatchDogCheck=30000

DataDir=/usr/local/mysql/data

MaxNoOfOrderedIndexes=512

StartPartialTimeout=100

StartPartitionedTimeout=100

  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值