Home > Database > Mysql Tutorial > body text

Ubuntu 10.10下MySQL 5.1集群配置

WBOY
Release: 2016-06-07 16:59:33
Original
938 people have browsed it

shellgt; sudo groupadd mysqlshellgt; sudo useradd -g mysql mysqlshellgt; sudo cd /usr/localshellgt; sudo tar -xvf my

一、环境
server1:192.85.1.5
server2:192.85.1.4
server3:192.85.1.9

二、集群方案
1.管理节点:server1
2.存储节点:server2,server3
3.SQL节点:server2,server3
三、在下载mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz,将该文件上传到服务器上,比如/home/zichen/下

四、安装,配置

shell> sudo groupadd mysql

shell> sudo useradd -g mysql mysql

shell> sudo cd /usr/local

shell> sudo tar -xvf mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz

shell> sudo ln -s mysql-cluster-gpl-7.1.9a-linux-i686-glibc23.tar.gz mysql #ln命令生成到该目录的一个符号链接

shell> cd mysql

shell> sudo scripts/mysql_install_db --user=mysql #mysql_install_db脚本, 用来初始化mysql数据库的 授权表,其中贮存了服务器访问允许。

shell> sudo chown -R root  .   #将文件的所有属性改为root用户

shell> sudo chown -R mysql data  #将数据目录的所有属性改为mysql用户

shell> sudo chgrp -R mysql .    #将组属性改为mysql组

在server2,server3上上配置my.cnf

sudo nano /etc/my.cnf

在结尾增加:

程序代码
[mysqld]
ndbcluster
ndb-connectstring=192.85.1.5
[MYSQL_CLUSTER]
ndb-connectstring=  192.85.1.5
在管理节点:server1:192.85.1.5上进行配置
 程序代码
#mkdir –p /usr/local/mysql/mysql-cluster/
#cd /usr/local/mysql/mysql-cluster
#vim config.ini
[NDBD DEFAULT]
NoOfReplicas=2
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]

#设置管理节点服务器
[NDB_MGMD]
hostname=192.85.1.5
#MGM上保存日志的目录
datadir=/usr/local/mysql/mysql-cluster/

#设置存储节点服务器(NDB节点)
[NDBD]
hostname=192.85.1.4
datadir=/var/lib/mysql-cluster
#第二个NDB节点
[NDBD]
hostname=192.85.1.9
datadir=/var/lib/mysql-cluster/

#设置SQL节点服务器[MYSQLD]
[MYSQLD]

在server2。server3上创建mysql-cluster目录,,

sudo mkdir -p /var/lib/mysql-cluster

五、启动

1.启动管理:
server1:192.85.1.5

 程序代码
#/usr/local/mysql/bin/ndb_mgmd -f /usr/local/mysql/mysql-cluster/config.ini
2.启动存储节点
server2:192.85.1.4
server3:192.85.1.9
 程序代码
# /usr/local/mysql/bin/ndbd –initial (第一次启动或管理节点的config.ini发生改变)
#/usr/local/mysql/bin/ndbd (以后启动用这条)
3.启动SQL节点
server2:192.85.1.4
server3:192.85.1.9
# /usr/local/mysql/bin/mysqld_safe --user=mysql &

linux

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