|
Install version mysql-cluster-gpl-7.4.6-linux-glibc2.5-i686.tar.gz
System for the Linux virtual machine
Virtual Machine 2 (assurance firewall turned off, or may be unsuccessful deployment)
ip: 192.168.52.130 as management, data node, the service node
ip: 192.168.52.131 as a data node, the service node
A: install cluster software
Each node requires the following steps (in fact, the management can not, but I do when they are together, so not too many studies):
1, download extract to / usr / local / mysql (you can choose your own directory)
tar -zxvf mysql-cluster-gpl-7.4.6-linux-glibc2.5-i686.tar.gz
mv mysql-cluster-gpl-7.4.6-linux-glibc2.5-i686 / usr / local / mysql /
2, create mysql user
useradd mysql
chown -R mysql: mysql / usr / local / mysql /
3, modify / etc / profile for ease of use
PATH = $ PATH: / usr / local / mysql / bin
export PATH
4. Installation mysq (step source installation of mysql)
cd / usr / local / mysql / scripts
./mysql_install_db --basedir = / usr / local / mysql / --datadir = / usr / local / mysql / data / --user = mysql
5, configuration management node ndb
Copy / usr / local / mysql / bin / ndb_mgm, ndb_mgmd two files to / usr / local / bin
cp / usr / local / mysql / bin / ndb_mgm * / usr / local / bin
All of this installation is finished, the following is to start
Boot sequence node for node management -> Data Node -> SQL node
Two: Start the management node
Create a profile on the management node config.ini as follows
mkdir / var / lib / mysql-cluster
vim /var/lib/mysql-cluster/config.ini
config.ini contents
[Ndbd default]
NoOfReplicas = 2 # image quantity of each data node, if the node is 1 when the data is broken then the cluster is unavailable, "opposite 1
DataMemory = 200M # each data node in the memory allocated to the data
IndexMemory = 30M # each data node in the memory allocated to the index
[Ndb_mgmd]
id = 1
hostname = 192.168.52.130 # IP management node
datadir = / var / lib / mysql-cluster / # management node directory
[Ndbd]
id = 2
hostname = 192.168.52.131 # IP node data
datadir = / usr / local / mysql / data # data node directory
[Ndbd]
id = 3
hostname = 192.168.52.130 # IP node data
datadir = / usr / local / mysql / data # data node directory
[Mysqld]
id = 4
hostname = 192.168.52.130 #sql node IP
[Mysqld]
id = 5
hostname = 192.168.52.131 #sql node IP
(Note: NoOfReplicas data indicating the number of copies, if it is 1, there will be data nodes single point of failure)
Start Management Service on the management node
ndb_mgmd -f /var/lib/mysql-cluster/config.ini
If you can reload modified config.ini
ndb_mgmd -f /var/lib/mysql-cluster/config.ini --reload - add to reload
ndb_mgm -e show to check the cluster status
ndb_mgm -e shutdown shut down the cluster software
Management node started up.
Other machines connected to the management node test
First of all the other nodes in the management node is not known which ip (because no other nodes config.ini)
Three: Each node configuration file /etc/my.cnf
So you want to configure profiles and services on /etc/my.cnf,mysql start time will default load /etc/my.cnf
my.cnf as follows:
[Mysqld]
ndbcluster
datadir = / usr / local / mysql / data
basedir = / usr / local / mysql
socket = / tmp / mysql.sock
port = 3306
ndb-connectstring = 192.168.52.130 --- management node ip
[Mysql_cluster]
ndb-connectstring = 192.168.52.130 --- management node ip
Then on unmanaged node ndb_mgm -e show could see just the cluster status
2 Start the data node
/ Usr / local / mysql / bin / ndbd --initial
To add --initial parameters for the first time after the installation starts data nodes, and other times do not increase, unless it is in backup, restore or restart after configuration changes
ndb_mgm -e show cluster status
3 start service node
/ Usr / local / mysql / bin / mysqld_safe --user = mysql &
ndb_mgm -e show cluster status
To build on the success of this test, then adjourned. |
|
|
|