UbuntuServer部署MysqlCluster集群_MySQL
发布网友
发布时间:2024-10-24 16:11
我来回答
共1个回答
热心网友
时间:2024-10-24 23:55
Ubuntu Server部署 MySQL Cluster 集群
部署环境包括:
系统:ubuntu-12.04.1-server-i386.iso
MySQL Cluster:mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz
部署步骤:
一、管理节点安装:
解压文件:tar -zvxf mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz
创建安装目录与配置文件:mkdir -p /usr/local/mysql/ndbdata; mkdir -p /usr/local/mysql/cluster-conf
配置文件内容如下:
[ndbd default]
NoOfReplicas=2
DataMemory=80M
IndexMemory=18M
[ndb_mgmd]
id=1
HostName=192.168.21.183
DataDir=/var/lib/mysql-cluster
[ndbd]
id=11
HostName=192.168.21.60
DataDir=/usr/local/mysql/ndbdata
[ndbd]
[mysqld]
id=21
HostName=192.168.21.19
二、数据节点安装:
解压文件:tar -zvxf mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz
创建安装目录与配置文件:mkdir -p /usr/local/mysql/bin; mkdir -p /usr/local/mysql/ndbdata; vi /etc/my.cnf
添加如下内容:
[mysql_cluster]
ndb-connectstring=192.168.21.183
三、SQL节点安装:
解压文件:tar -zvxf mysql-cluster-gpl-7.0.37-linux-i686-glibc23.tar.gz
添加mysql用户:groupadd mysql; useradd -g mysql mysql
更改权限与添加执行文件路径:chown -R mysql:mysql /usr/local/mysql; vi ~/.bash_profile; PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
初始化数据库与配置守护进程:cd /usr/local/mysql/scripts/mysql_install_db --user=mysql; cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld; chkconfig –add mysqld; chkconfig –level 35 mysqld on
编辑配置文件与连接参数:vi /etc/my.cnf; [mysqld] port = 3306 socket = /tmp/mysql.sock; ndbcluster ndb-connectstring=192.168.21.183
四、启动与关闭 Cluster:
启动顺序:管理节点 → 数据节点 → SQL节点
启动管理节点:cd /usr/local/bin; ndb_mgmd -f /usr/local/mysql/cluster-conf/config.ini; db_mgm
启动数据节点:/usr/local/mysql/bin/ndbd --initial; /usr/local/mysql/bin/ndbd
启动SQL节点:/usr/local/mysql/bin/mysqld_safe --user=mysql &