分类: Mysql/postgreSQL
2007-01-24 17:16:51
|
简单mysql-cluster
安装手册
目前的测试环境如图:
其中
管理节点:
数据节点:
数据节点:
SQL节点: 172.19.148.202对应图中的 192.168.0.35
数据节点的配置是
CPU: 3.20GHz 2个双核
硬盘:
内存:
操作系统:Red Hat Enterprise Linux AS release 4 (Nahant)
实际测试中希望能使用如下配置:
HP
ProLiant DL |
4 |
2
个英特尔® 至强™ 5150 双核处理器 2.66GHz/1333MHz |
1
x 4MB |
DDR2-667
SDRAM |
4
* 72GB |
1. 检查是系统是否安装过mysql, 如果有安装,需要删除安装目录的文件.通过ps afx |grep mysql 查看到mysql的配置文件,数据库目录,pid,port,socket 等信息,要将这些信息全部清除.一般而言,删除 /usr/local/mysql* /var/lib/mysql*就可以
# service mysql.server stop
#rm -rf /usr/local/mysql* /var/lib/mysql*
2. 检查mysql组和用户,如果没有用进行下述添加
# groupadd mysql
#useradd -g mysql mysql
3. 下载安装文件
#mkdir -p /home/meil/soft
#cd /home/meil/soft
#scp -r
4. 解压安装
# tar zxvf
mysql-max-
# cd mysql-max-
# cp -rf ./ndb* /usr/local/bin
# cd /usr/local/bin
#chmod +x ndb*
5. 配置启动
# mkdir -p /var/lib/mysql-cluster
# cd /var/lib/mysql-cluster
#vi config.ini
# Example Ndbcluster storage engine config file.
#
[NDBD DEFAULT]
# 2 replicas (min. for redundancy; requires 2 storage nodes min.)
NoOfReplicas=2
# Standard data directory
DataDir=/var/lib/mysql-cluster
# 512mb storage for data, 64mb for primary keys.
DataMemory=
IndexMemory=
# Define MaxNoOfConcurrentOperations; leave
# MaxNoOfLocalOperations as default (1.1*
# MaxNoOfConcurrentOperations)
MaxNoOfConcurrentOperations=10000
# Slightly increase the number of ordered indexes, unique hash
# indexes, tables and attributes allowed from defaults
# When importing tables, set this as high as you can
# Then reduce based on output from ALL DUMP 1000 command
MaxNoOfOrderedIndexes=512
MaxNoOfUniqueHashIndexes=256
MaxNoOfTables=256
MaxNoOfAttributes=1500
TimeBetweenWatchDogCheck= 30000
MaxNoOfOpenFiles=200
[NDB_MGMD DEFAULT]
# Listen on default port, 1186
PortNumber=1186
# Log to console, syslog and also to a file
# cluster-log in /var/log/.
# Store files in /var/lib/mysql-cluster
DataDir=/var/lib/mysql-cluster
#All management nodes should be high priority for arbitration.
ArbitrationRank=1
[ndb_mgmd]
Id=1
HostName=
[ndb_mgmd]
Id=2
HostName=
[ndbd]
Id=11
HostName=
datadir=/var/lib/mysql-cluster
[ndbd]
Id= 12
HostName=
datadir=/var/lib/mysql-cluster
[mysqld]
HostName=172.19.148.202
Id= 21
[mysqld]
HostName=
Id= 22
# choose an unused port number
# in this configuration 63132, 63133, and 63134
# will be used
[tcp default]
PortNumber= 63132
Nodeid是指本机的id, 在不同的机器需要不同的配置.由于需要多管理节点, 所有节点必须在/etc/my.cnf中制定nodeid, 包含管理节点.
[root@Meil_88 mysql-cluster]# vi /etc/my.cnf
[mysqld]
ndbcluster
ndb-connectstring=
[mysql_cluster]
ndb-connectstring=
nodeid=1,
# vi /etc/rc.local
Add following:
ndb_mgmd -f /var/lib/mysql-cluster/config.ini
# ndb_mgmd -f /var/lib/mysql-cluster/config.ini
1. 检查是系统是否安装过mysql, 如果有安装,需要删除安装目录的文件.通过ps afx |grep mysql 查看到mysql的配置文件,数据库目录,pid,port,socket 等信息,要将这些信息全部清除.一般而言,删除 /usr/local/mysql* /var/lib/mysql*就可以
# service mysql.server stop
#rm -rf /usr/local/mysql* /var/lib/mysql*
2. 检查mysql组和用户,如果没有用进行下述添加
# groupadd mysql
#useradd -g mysql mysql
3. 下载安装文件
#mkdir -p /home/meil/soft
#cd /home/meil/soft
#scp -r
4. 解压安装和配置
# tar zxvf
mysql-max-
# mv -f
mysql-max-
# cd /usr/local
# ln -s
mysql-max-
# cd mysql/support-files/
# cp my-large.cnf /etc/my.cnf
# vi /etc/my.cnf 确认添加修改了如下部分
[mysqld]
max_connections = 2000
thread_concurrency = 2
log_slow_queries = /var/log/mysql/slow_query.log
log = /var/log/mysql/query.log
long_query_time = 1
datadir = /var/lib/mysql_data
ndbcluster
ndb-connectstring=
bind-address = 127.0.0.1
[mysql_cluster]
ndb-connectstring= nodeid=11,
# mkdir -p /var/log/mysql
# mkdir -p /var/lib/mysql-cluster
# mkdir -p /var/lib/mysql_data
# chmod +x /var/log/mysql /var/lib/mysql-cluster /var/lib/mysql_data
# chown -R mysql.mysql /var/log/mysql /var/lib/mysql-cluster /var/lib/mysql_data
# cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql
# chown -R root . && chown -R mysql data && chgrp -R mysql .
5. 设置自动启动和环境变量
#cp support-files/mysql.server /etc/rc.d/init.d/
#chmod +x /etc/rc.d/init.d/mysql.server
# chkconfig --add mysql.server
# cd
# vi .bash_profile
Modify following:
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
6. 初始化启动
/usr/local/mysql/bin/ndbd --initial
请参考数据节点的安装, 最后一步改为:
service mysql.server start
需要在
[mysqld]下面配置nodeid
比如:
ndbcluster
ndb-connectstring= nodeid=22,
1,建议安装linux的时候不要选择任何防火墙
2,安装mysql确保网络工作正常,尤其是有域名解析的机器,务必能正常解析,否则建议去掉域名解析.
3,参考了现在3003,875板子对mysql的部分要求:
只允许本机mysql客户端连接mysql.
Mysql 安装目录,数据目录,cluster目录,日志目录分开.
4,增加了一些数据节点的配置值,但是需要在实际使用中修改.
5,MYSQL使用Version: