当前位置:Gxlcms > mysql > CentOS6.5上安装MySQL-Cluster7.3.4过程笔记

CentOS6.5上安装MySQL-Cluster7.3.4过程笔记

时间:2021-07-01 10:21:17 帮助过:29人阅读

CentOS6.5上安装MySQL-Cluster 7.3.4过程笔记,(历时2天查找各种资料亲身试验结果)。CentOS6.5 + MySQL-Cluster 7.3.4 (最新GA

CentOS6.5上安装MySQL-Cluster 7.3.4过程笔记,(历时2天查找各种资料亲身试验结果)。

为了安装这个Cluster,研究了2天才彻底搞定,因此将此次研究经验记录下来供大家参考学习,,避免重复走弯路,安装分为如下几个阶段:

环境说明: CentOS6.5 + MySQL-Cluster 7.3.4 (最新GA版本),规划2台机器,一台做控制服务器 + 负载均衡服务器 + 数据节点服务器, 另一台做 负载均衡服务器 + 数据节点服务器;

一、下载,这里为了方便安装过程,这里直接使用了RPM包来安装,避开了编译安装的痛苦:
首先先到下载如下的RPM安装包 (),记得选择 Red Hat Enterprise Linux/Oracle Linux 下面的 MySQL-Cluster-gpl-7.3.4-1.el6.x86_64.rpm-bundle.tar 这个安装包,避免一个接一个下载的痛苦;

二、环境清理以及安装:
1. mysql旧版本清除:
首先使用如下命令来清理之前操作系统自带的mysql安装:yum -y remove mysql
然后使用如下命令:
rpm -qa | grep mysql*
对于找到的2个剩余mysql包,请按照如下的命令格式予以删除:
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

2. mysql cluster版本安装准备:将MySQL-Cluster-gpl-7.3.4-1.el6.x86_64.rpm-bundle.tar放到某个目录下(譬如/package) 下面,并且执行如下命令解压:
tar -xvf MySQL-Cluster-gpl-7.3.4-1.el6.x86_64.rpm-bundle.tar
得到如下文件清单:
MySQL-Cluster-client-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-devel-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-embedded-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-server-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-shared-compat-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-shared-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-test-gpl-7.3.4-1.el6.x86_64.rpm

3. mysql cluster版本安装:
创建文件夹(分如下3个类来创建对应的文件夹)
存储节点:mkdir /var/lib/mysql/data
管理节点:mkdir /var/lib/mysql-cluster SQL节点:可不用 文件夹授权
进程DIR: mkdir /var/run/mysqld

使用如下的命令来变更权限保证可写入:
chmod -R 1777 /var/lib/mysql
chmod -R 1777 /var/run/mysqld
chmod -R 1777 /var/lib/mysql-cluster

rpm -ivh MySQL-Cluster-server-gpl-7.3.4-1.el6.x86_64.rpm
rpm -ivh MySQL-Cluster-client-gpl-7.3.4-1.el6.x86_64.rpm
特别注意,当安装完毕server gpl包后,将出现如下提示信息,提醒我们整个cluster安装后的初次超级账户密码存在/root/.mysql_secret这个文件当中。
---------------------------------------------------------------------------------------------------------------------
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
-----------------------------------------------------------

MySQL Cluster 备份与恢复

MySQL Cluster安装配置

MySQL Cluster 3台机器搭建集群环境 DOC

MySQL Cluster7.2在线增加数据节点存在重大弊端

搭建MySQL-Cluster集群架构

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

4. 配置文件撰写与调整:
cd /var/lib/mysql-cluster
vi config.ini
---------------------------------------------------------------------------------------------------------------------------
[computer]
Id=mgr-server-01
HostName=10.10.0.1

[mgm default]
datadir=/var/lib/mysql-cluster

[mgm]
HostName=10.10.0.1
NodeId=60
ExecuteOnComputer=mgr-server-01
PortNumber=1186
ArbitrationRank=2

[ndbd default]
NoOfReplicas=2
DataMemory=8G
IndexMemory=2G

[ndbd]
HostName=10.10.0.1
DataDir=/var/lib/mysql
NodeId=1

[ndbd]
HostName=10.10.0.2
DataDir=/var/lib/mysql
NodeId=2

[mysqld]
HostName=10.10.0.1
NodeId=81

[mysqld]
HostName=10.10.0.2
NodeId=82
---------------------------------------------------------------------------------------------------------------------------
5. 配置Mysql文件:
vi /etc/my.cnf
[client]
socket=/var/lib/mysql/mysql.sock

[mysqld]
max_connections=100
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
ndbcluster
ndb-connectstring=10.10.0.1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

人气教程排行