Maison >base de données >tutoriel mysql >MySQLCluster7.2.15安装部署性能测试_MySQL
bitsCN.com
1 下载 Download the cluster tar.gz
wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.2/mysql-cluster-gpl-7.2.15.tar.gz
MySQL Cluster 7.2.15
Select Version: 下拉框选择 7.2.15
Select Platform: 下拉框选择 Linux Generic
然后再下面连接一栏里面选择:
Linux - Generic 2.6 (x86, 64-bit), Compressed TAR Archive
(mysql-cluster-gpl-7.2.15-linux2.6-x86_64.tar.gz)
2 cp to other 3 host
scp mysql-cluster-gpl-7.2.15-linux2.6-x86_64.tar.gz 10.88.49.124:/root
10.88.49.119
10.88.49.122
10.88.49.123
10.88.49.124
3 install management node
tar -xvf mysql-cluster-gpl-7.2.15-linux2.6-x86_64.tar.gz
3.1 install the directory of install
mkdir -p /usr/local/mysql/bin
mkdir -p /usr/local/mysql/ndbdata
3.2 set the path of file run
[root@mysql mysql-cluster-gpl-7.2.15-linux2.6-x86_64]# vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
3.3 copy the run files
cd mysql-cluster-gpl-7.2.15-linux2.6-x86_64
cp bin/ndb_mgmd /usr/local/mysql/bin
cp bin/ndb_mgm /usr/local/mysql/bin
3.4 create the file of log file store
mkdir -p /var/lib/mysql-cluster
3.5 create the config file and reset it
mkdir -p /usr/local/mysql/cluster-conf
vi /usr/local/mysql/cluster-conf/config.ini
[NDBD DEFAULT]
#TotalSendBufferMemory= 256M
NoOfReplicas=2
DataMemory=2500M
IndexMemory=500M
DataDir=/var/lib/mysql-cluster
#FileSystemPath=/data/dbdata
#Redolog
FragmentLogFileSize=32M
InitFragmentLogFiles=SPARSE
NoOfFragmentLogFiles=8
RedoBuffer=1024M
StringMemory=25
LockPagesInMainMemory=1
MaxNoOfTables=4096
MaxNoOfOrderedIndexes=2048
MaxNoOfUniqueHashIndexes=1024
MaxNoOfAttributes=24576
MaxNoOfTriggers=14336
ODirect=1
MaxNoOfConcurrentTransactions=10000
MaxNoOfConcurrentOperations=50000
MaxNoOfLocalOperations=55000
TimeBetweenGlobalCheckpoints=1000
TimeBetweenEpochs=100
TimeBetweenWatchdogCheckInitial=60000
TransactionBufferMemory=10M
DiskCheckpointSpeed=10M
DiskCheckpointSpeedInRestart=100M
TimeBetweenLocalCheckpoints=20
SchedulerSpinTimer=400
SchedulerExecutionTimer=100
RealTimeScheduler=1
BackupMaxWriteSize=1M
BackupDataBufferSize=16M
BackupLogBufferSize=4M
BackupMemory=20M
MaxNoOfExecutionThreads=4
TransactionDeadLockDetectionTimeOut=10000
BatchSizePerLocalScan=512
###Increasing the LongMessageBufferb/c of a bug (20090903)
LongMessageBuffer=8M
###Heartbeating
HeartbeatIntervalDbDb=15000
HeartbeatIntervalDbApi=15000
[MGM DEFAULT]
PortNumber:1186
DataDir:/var/lib/mysql-cluster1
[TCP DEFAULT]
SendBufferMemory:64M
#######################################
#Change HOST1 to the name of the NDB_MGMD host
#Change HOST8 to the name of the NDBD host
#Change HOST9 to the name of the NDBD host
#######################################
[NDB_MGMD]
NodeId:1
HostName:10.88.49.119
ArbitrationRank:1
[NDBD]
NodeId:4
HostName:10.88.49.124
######################################################
#Note: The following can be MySQLDconnections or #
# NDB API application connecting to thecluster #
######################################################
[API]
NodeId:10
HostName:10.88.49.122
ArbitrationRank:2
[API]
NodeId:11
HostName:10.88.49.123
ArbitrationRank:2
4 install data node (10.88.49.124)
4.1 install the directory of install
mkdir -p /usr/local/mysql/bin
mkdir -p /usr/local/mysql/ndbdata
4.2 copy the run command file
cd mysql-cluster-gpl-7.2.15-linux2.6-x86_64
cp ./bin/ndbd /usr/local/mysql/bin
chown -R mysql:mysql /usr/local/mysql
4.3 set the path
vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
4.4 set the config file
vim /etc/mycluster.cnf
[mysql_cluster]
4.5 配置数据节点连接管理节点
ndb-connectstring=10.88.49.119
5 install sql node (10.88.49.122,10.88.49.123)
compress the tar.gz file
tar -zxvf mysql-cluster-gpl-7.2.15-linux2.6-x86_64.tar.gz
5.1 copy the directory
mv mysql-cluster-gpl-7.2.15-linux2.6-x86_64 /usr/local/mysqlndb
5.2 add mysql accounts
group add mysql
useradd -g mysql mysql
5.3 add the permission
chown -R mysql:mysql /usr/local/mysqlndb
5.4 copy the config file
cp /usr/local/mysqlndb/my.cnf /etc/my.cnf
5.5 init the database
cd /usr/local/mysqlndb
scripts/mysql_install_db --basedir=/usr/local/mysqlndb/ --datadir=/data/ --defaults-file =/etc/myndb.cnf --user=mysql
[root@localhost mysqlndb]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
2014-02-27 01:55:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
Installation of system tables failed! Examine the logs in
/app/mysql for more information.
You can try to start the mysqld daemon with:
shell> /usr/local/mysql5615/bin/mysqld --skip-grant &
and use the command line tool /usr/local/mysql5615/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/local/mysql5615/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /app/mysql that may be helpful.
Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/local/mysql5615/scripts/mysqlbug script!
[]必须使用全路径/usr/local/mysqlndb/scripts/mysql_install_db,不然识别,就会自动调用为原来的初始化路径。
[root@localhost mysqlndb]# cp /etc/myndb.cnf /usr/local/mysqlndb/my.cnf
[root@localhost mysqlndb]# /usr/local/mysqlndb/scripts/mysql_install_db --defaults-file=/usr/local/mysqlndb/my.cnf --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysqlndb//bin/mysqladmin -u root password 'new-password'
/usr/local/mysqlndb//bin/mysqladmin -u root -h localhost password 'new-password'
Alternatively you can run:
/usr/local/mysqlndb//bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysqlndb/ ; /usr/local/mysqlndb//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysqlndb//mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysqlndb//scripts/mysqlbug script!
5.7 copy the protect process
cp /usr/local/mysqlndb/support-files/mysql.server /etc/init.d/ndbdsql
配置守护进程
chkconfig --add ndbdsql
chkconfig --level 35 ndbdsql on
添加执行文件路径
vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysqlndb/bin
更改配置文件
vim /etc/my.cnf
分别编辑如下信息:
[mysqld]#配置SQL节点与管理节点连接
port= 3307
socket= /tmp/mysql.sock
ndbcluster
ndb-connectstring=10.88.49.119
[root@localhost mysqlndb]# /etc/init.d/mysqldndbd status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
[root@localhost mysqlndb]# /etc/init.d/mysqldndbd status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
[root@localhost mysqlndb]# mv /var/lock/subsys/mysql /var/lock/subsys/mysql.bak
[root@localhost mysqlndb]# /etc/init.d/mysqldndbd start
Starting MySQL... SUCCESS!
6 start the cluster
6.1 start the management node
ndb_mgmd -f /usr/local/mysql/cluster-conf/config.ini
[root@mysql ~]# ndb_mgmd -f /usr/local/mysql/cluster-conf/config.ini
MySQL Cluster Management Server mysql-5.5.35 ndb-7.2.15
2014-02-25 18:57:04 [MgmtSrvr] ERROR -- at line 1: Value specified outside section
2014-02-25 18:57:04 [MgmtSrvr] ERROR -- at line 1: Could not parse name-value pair in config file.
2014-02-25 18:57:04 [MgmtSrvr] ERROR -- Could not load configuration from '/usr/local/mysql/cluster-conf/config.ini'
2014-02-25 18:57:04 [MgmtSrvr] ERROR -- Could not determine which nodeid to use for this node. Specify it with --ndb-nodeid=
检查是从window下copy到liux下,某些空格失效了。
修改/usr/local/mysql/cluster-conf/config.ini,将[NDBDDEFAULT]换成[NDBD DEFAULT],中间少了一个空格。
6.2 start the data node
ndbd