Debian6 configure Mysql cluster Mysql version: mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz Operating System: Debian6.0 Virtual Machine 192.168.225.131 (MGMD) 192.168.225.small (NDBD) 192.168.225.134 (NDBD) 192.168.225.135 (MySQLD) Small
1. mysql-cluster root @ debian:/home/john # groupadd mysql root @ debian:/home/john # useradd-g mysql root @ debian: /home/john # tar zxf mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz root @ debian:/home/john # mv zxf mysql-cluster-gpl-7.1.14-linux-i686-glibc23/usr/local/mysql root @ debian:/home/john # chown mysql: mysql/usr/local/mysql root @ debian:/home/john # rm mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz
2. configure MGMD (Management node 192,168.225 .131) to create a file/var/lib/mysql-cluster/config. ini (it can be another location or name) [ndbd default] NoOfReplicas = 2 DataMemory = 100 M IndexMemory = 100 M [tcp default] portnumber = 2202 [NDB_MGMD] id = 1 hostname = 192.168.225.131 datadir =/var/lib/mysql- cluster [NDBD] id = 2 hostname = 192.168.225.133 datadir =/usr/local/mysql/ndbdata www.2cto.com [NDBD] id = 3 hostname = 192.168.225.134 datadir =/usr/local/mysql [mysqld] id = 4 hostname = 192.168.225.135 [mysqld] id = 5 hostname = 192.168.225.1363. configure NDBD (data node 192.168.225.133, 192.168.225.134) to create/etc/my. cnf file, content: [mysqld] datadir =/usr/local/mysql/ndbdata [mysql_cluster] ndb-connectstring = 192.168.225.131 # point to mgmd4. configure MySQLD (SQL node 192.168.225.135, Baidu) create/etc/my. the cnf file contains the following content: [mysqld] ndbcluster ndb-connectstring = 192.168.225.131 www.2cto.com [mysql_cluster] ndb-connectstring = 192.168.225.131 install System tables root @ debian: /usr/local/mysql/scripts # mysql_install_db -- user = mysql -- defaults-file =/etc/my. cnf -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data5. after the configuration is correct, start the management node 192.168.225.131 root @ debian: /usr/local/mysql/bin #. /ndb_mgmd-f/var/lib/mysql-cluster/config. ini root @ debian:/usr/local/mysql/bin #. /ndb_mgmd ndb_mgm> show
At the first startup, id = 2, 3, 4, and 5 should be not connected. 6. Start NDB node and MySQL node start NDB node root @ debian:/usr/local/mysql/bin #./ndbd
Start the MySQL node root @ debian:/usr/local/mysql/bin #./mysqld_safe &
If an error occurs during startup, check whether System tables is correctly installed in step 1. 7. test (on the MySQLD node 192.168.225.135, 192.168.225.136) root @ debian: /usr/local/mysql/bin # ln-s/usr/local/mysql/bin/mysql/usr/bin root @ debian: /usr/local/mysql/bin # mysql-uroot test mysql> create table job (id int auto_increment, name varchar (100) engine = ndbcluster default charset utf8; engine = ndbcluster cannot be small; otherwise, nodes cannot be synchronized. Create a table and insert data in the two nodes. The test result shows that the node data has been synchronized .. OK www.2cto.com 8. Stop the node later and restart the node to stop the ndbd node.
If all the data nodes ndbd are stopped, mysqld on the SQL node will automatically lose the connection, but the mysqld process remains alive. As a result, after the ndbd is restored, mysqld cannot be automatically restored, you must first kill the mysqld process and restart the mysqld node.
Note: Run/usr/local/mysql/scripts/mysql_install_db -- user = mysql parameter -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data & (this is very important) author: dyyaries