mysql cluster 启动_Mysql_cluster 部署(精华版)

本文详细介绍了如何在Linux环境中部署MySQL Cluster。首先从官方下载MySQL Cluster 7.1.15的安装包,然后创建用户和组,解压并移动安装文件。接着配置MGM管理节点、NDB数据节点和SQL数据节点,包括设置数据存储路径、配置文件和启动脚本。最后,文章提到了启动和关闭顺序以及常见问题。
摘要由CSDN通过智能技术生成

Mysql_cluster 部署(精华版)

目录

一、安装包及说明

1.1、下载地址

http://www.mysql.com/downloads/cluster/7.1.html#downloads

mysql-cluster-gpl-7.1.15-linux-x86_64-glibc23.tar.gz(200M)

1.2、环境说明

MGM:--192.168.8.20

SQL :--192.168.8.20

NDB1:--192.168.8.21

NDB1:--192.168.8.21

1.3、安装MYSQL_Cluster

在MGM管理节点、SQL节点、NDB节点执行同一操作

#:groupadd mysql

#:useradd mysql–g mysql–s/sbin/nologin

#: tar–xvfmysql-cluster-gpl-7.1.15-linux-x86_64-glibc23.tar.gz

#:mvmysql-cluster-gpl-7.1.15-linux-x86_64-glibc23/usr/local/mysql_cluster

#:#:vim /etc/profile

MYSQL_CLUSTER=/usr/local/mysql_cluster/bin

PATH=$PATH:$HOME/bin:$MYSQL_CLUSTER

export PATH

1.4、安装MGM管理节点

#:mkdir -p /opt/mgm/logs

#:mkdir /opt/conf

#: cp /soft/mgm-conf/config.ini/opt/conf/

#:vim /opt/conf

# Options affecting ndbd processes on all home/data nodes:

[ndbd default]

NoOfReplicas=2

DataMemory=200M  # How much memory to allocate for home/data storage

IndexMemory=18M  # How much memory to allocate for index storage

# For DataMemory and IndexMemory, we have used the

# default values. Since the "world" home/database takes up

# only about 500KB, this should be more than enough for

# this example Cluster setup.

MaxNoOfAttributes=999999

MaxNoOfConcurrentTransactions=10240

LogLevelStatistic=15

LogLevelCheckpoint=15

LogLevelConnection=15

LogLevelError=15

LogLevelInfo=15

[ndb_mgmd]

NodeId=1

Hostname=192.168.8.20

Datadir=/opt/mgm/logs

LogDestination=FILE:filename=ndb_1_cluster.log,maxsize=10000000,maxfiles=6

ArbitrationRank=0

[ndbd]

NodeId=10

Hostname=192.168.8.21

Datadir=/opt/db1/data

backupdatadir=/opt/db1/databak

[ndbd]

NodeId=11

Hostname=192.168.8.21

Datadir=/opt/db2/data

backupdatadir=/opt/db2/databak

[mysqld]

NodeId=20

[api]

[api]

[api]

[api]

[api]

启动管理节点

1.5、安装NDB数据节点

#:mkdir -p /opt/db1/data && mkdir /opt/db1/databak

#:mkdir -p /opt/db2/data && mkdir /opt/db2/databak

#:mkdir /opt/conf

#:cp /soft/ndb-conf/my.cnf /opt/conf

#:vim /opt/conf/my.cnf

[mysqld]

ndbcluster

ndb-connectstring=192.168.8.20

[mysql_cluster]

ndb-connectstring=192.168.8.20

启动NDB节点

1.6、安装SQL数据节点

#:cp /opt/soft/slq-conf/my.cnf /usr/local/mysql_cluster

#:cp/usr/local/mysqlcluster/support-files/mysql.server/etc/init.d/mysql

#:vim /etc/init.d/mysql

basedir=/usr/local/mysql_cluster

datadir=/opt/sql/data

#:vim/usr/local/mysql_cluster/my.cnf

# Options for mysqld process:

[mysqld]

max_connections=200000

datadir=/opt/sql/data/

port=3307

socket=/tmp/mysql.sock

character-set-server=utf8

default-storage-engine=ndbcluster

server-id=20

ndbcluster

# run NDB storage engine

ndb-connectstring=192.168.8.20

ndb-force-send=1

ndb-use-exact-count=0

ndb-extra-logging=1

ndb-autoincrement-prefetch-sz=512

engine-condition-pushdown=1

ndb-cluster-connection-pool=1

key_buffer_size=16M

max_allowed_packet=10M

sort_buffer_size=256K

read_buffer_size=128K

read_rnd_buffer_size=256K

table_lock_wait_timeout=16

memlock

sysdate_is_now

thread-cache-size=512

table-open_cache=512

max_prepared_stmt_count=24576

lower-case-table-names=0

# Timeout

interactive_timeout=43200

wait_timeout=43200

connect_timeout=60

skip-name-resolve

[ndbd]

connect-string=192.168.8.21

[ndbd_mgm]

connect-string=192.168.8.20

[mysql_cluster]

ndb-connectstring=192.168.8.20

# location of management server

#:初始化

cripts/mysql_install_db --user=mysql --basedir=/usr/local/services/mysql_cluster/ --datadir=/opt/sql/data/

启动SQL节点

#:/etc/init.d/mysql start

1.7、常见问题及启动顺序

启动顺序

MGM-->NDBD-->SQL

关闭顺序

关闭

SQL-->MGM(NDBD)

当关闭掉MGM后。NDBD也会停掉

关闭MGM

ndb_mgm–e shutdown

测试:

ndbd_mgm–e show

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值