Home > Database > Mysql Tutorial > Ubuntu Server部署MysqlCluster集群_MySQL

Ubuntu Server部署MysqlCluster集群_MySQL

WBOY
Release: 2016-06-01 13:31:12
Original
1124 people have browsed it

UbuntuServerUbuntuMysql集群

bitsCN.com

Ubuntu Server部署MysqlCluster集群

 

部署环境:

 

系统:ubuntu-12.04.1-server-i386.iso

 

Cluster:mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz

 

说明:

 

1、部署之前不要装Mysql,有的人部署是用Mysql部署的,但是如果你使用cluster二进制,就不要装Mysql

 

2、有的系统有些命令使用不了,所以这些也要注意

 

准备:

 

三台电脑

 

Mgm节点:192.168.21.183

 

Data节点:192.168.21.60

 

SQL节点:192.168.21.19

 

 

(一)安装管理节点

 

1、解压文件tar -zvxf mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz2、创建安装目录mkdir -p /usr/local/mysql/ndbdatacd mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gzcp bin/ndb_mgmd /usr/local/bincp bin/ndb_mgm /usr/local/bin3、配置日志文件存储目录mkdir /var/lib/mysql-cluster4、创建配置文件目录及文件mkdir /usr/local/mysql/cluster-confvi /usr/local/mysql/cluster-conf/config.ini
Copy after login

==================配置文件内容===================[ndbd default] NoOfReplicas=2 #复制成员个数DataMemory=80M  #数据存储可以分配的内存IndexMemory=18M #索引存储可以分配的内存 [ndb_mgmd] #定义管理节点的IP地址或主机名id=1HostName=192.168.21.183DataDir=/var/lib/mysql-cluster [ndbd]  #定义数据节点id=11 HostName=192.168.21.60DataDir=/usr/local/mysql/ndbdata  [ndbd]  [mysqld]#定义SQL节点id=21 HostName=192.168.21.19====================================================
Copy after login

(二)安装数据节点

解压文件tar -zvxf mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz创建安装目录mkdir -p /usr/local/mysql/binmkdir -p /usr/local/mysql/ndbdata拷贝执行文件cp mysql-cluster-gpl-7.0.37-linux-i686-glibc23/bin/ndbd /usr/local/mysql/bin添加执行文件路径vi ~/.bash_profilePATH=$PATH:$HOME/bin:/usr/local/mysql/bin创建配置文件:vi /etc/my.cnf分别在主机添加如下内容:[mysql_cluster] #配置数据节点连接管理节点ndb-connectstring=192.168.21.183
Copy after login

(三)安装SQL节点

解压文件tar -zvxf mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz拷贝安装文件mv mysql-cluster-gpl-7.0.37-linux-i686-glibc23 /usr/local/mysql添加mysql用户groupadd mysqluseradd -g mysql mysql添加权限chown -R mysql:mysql /usr/local/mysql拷贝配置文件cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf初始化数据库cd /usr/local/mysqlscripts/mysql_install_db --user=mysql拷贝守护进程所需文件cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld配置守护进程chkconfig –add mysqldchkconfig –level 35 mysqld on添加执行文件路径vi ~/.bash_profilePATH=$PATH:$HOME/bin:/usr/local/mysql/bin更改配置文件vi /etc/my.cnf分别编辑如下信息:[mysqld]  #配置SQL节点与管理节点连接port            = 3306socket          = /tmp/mysql.sockndbclusterndb-connectstring=192.168.21.183
Copy after login

(四)启动及关闭Cluster

启动循序:管理节点--->数据节点--->SQL节点

1,启动管理节点cd /usr/local/bin/ndb_mgmd -f /usr/local/mysql/cluster-conf/config.inindb_mgm(查看节点连接情况)2,启动数据节点/usr/local/mysql/bin/ndbd --initial(第一次启动是用这个命令)/usr/local/mysql/bin/ndbd(以后用这个命令)3,启动SQL节点/usr/local/mysql/bin/mysqld_safe --user=mysql &
Copy after login

 

 

bitsCN.com
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template