情况说明: CentOs6.5 + MySQL-Cluster 7.3.4 (最新GA版本),筹划2台呆板,一台做节制处事器 + 负载平衡处事器 + 数据节点处事器, 另一台做 负载平衡处事器 + 数据节点处事器;
一、下载,这里为了利便安装进程,这里直接利用了RPM包来安装,避开了编译安装的疾苦:
首先先到www.msyql.com下载如下的RPM安装包
(http://dev.mysql.com/downloads/cluster/),日本游戏代理
欧洲服务器,记得选择 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.
---------------------------------------------------------------------------------------------------------------------
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
[mysql_cluster]
ndb-connectstring=10.10.0.1
---------------------------------------------------------------------------------------------------------------------------