Notes on installing MySQL-Cluster 7.3.4 on CentOS 6.5
Install MySQL-Cluster 7.3.4 Process notes on CentOS6.5 (two days to search for various materials and test results ).
In order to install the Cluster, the study took 2 days to complete, so the study experience was recorded for your reference, to avoid repeated detours, the installation is divided into the following stages:
Environment Description: CentOS6.5 + MySQL-Cluster 7.3.4 (latest GA version), two machines are planned, one for Control Server + Server Load balancer SERVER + data node server, another Server Load balancer SERVER + data node server;
1. Download: To facilitate the installation process, the RPM package is used directly to install the package, avoiding the pain of compiling and installation:
First go to www.msyql.com to download the following RPM installation package (http://dev.mysql.com/downloads/cluster/), remember to select Red Hat Enterprise Linux/Oracle Linux under the MySQL-Cluster-gpl-7.3.4-1.el6.x86_64.rpm-bundle.tar of this installation package, to avoid one by one download pain;
II. Environment Cleaning and installation:
1. Clear the old mysql version:
First, run the following command to clear the mysql installation that comes with the operating system: yum-y remove mysql
Run the following command:
Rpm-qa | grep mysql *
Delete the remaining two mysql packages in the following command format:
Rpm-e -- nodeps mysql-libs-5.1.71-1.el6.x86_64
2. mysql cluster installation preparation: Put mysql-cluster-gpl-7.3.4-1.el6.x86_64.rpm-bundle.tar in a directory (for example,/package) and run the following command to decompress the package:
Tar-xvf MySQL-Cluster-gpl-7.3.4-1.el6.x86_64.rpm-bundle.tar
Get the following file list:
MySQL-Cluster-client-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-devel-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-embedded-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-server-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-shared-compat-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-shared-gpl-7.3.4-1.el6.x86_64.rpm
MySQL-Cluster-test-gpl-7.3.4-1.el6.x86_64.rpm
3. Install mysql cluster:
Create a folder (the following three classes are used to create the corresponding folder)
Storage node: mkdir/var/lib/mysql/data
Management node: mkdir/var/lib/mysql-cluster SQL node: folder authorization is not required.
Process DIR: mkdir/var/run/mysqld
You can use the following command to change the permission to write data:
Chmod-R 1777/var/lib/mysql
Chmod-R 1777/var/run/mysqld
Chmod-R 1777/var/lib/mysql-cluster
Rpm-ivh MySQL-Cluster-server-gpl-7.3.4-1.el6.x86_64.rpm
Rpm-ivh MySQL-Cluster-client-gpl-7.3.4-1.el6.x86_64.rpm
Note: After the server gpl package is installed, the following message is displayed, reminding us that the first Super account password after the cluster is installed exists in the/root/. mysql_secret file.
Bytes ---------------------------------------------------------------------------------------------------------------------
A random password has been set for the MySQL root USER!
You will find that password in '/root/. mysql_secret '.
You must change that password on your first connect,
No other statement but 'set password' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/Usr/bin/mysql_secure_installation
Which will also give you the option of removing the test database.
This is stronugly recommended for production servers.
-----------------------------------------------------------
MySQL Cluster backup and recovery
MySQL Cluster installation Configuration
Create a Cluster environment using three MySQL clusters. DOC
MySQL Cluster7.2 online addition of data nodes has major drawbacks
Build a MySQL-Cluster architecture
----------------------------------------------------------
4. configuration file writing and adjustment:
Cd/var/lib/mysql-cluster
Vi config. ini
Bytes ---------------------------------------------------------------------------------------------------------------------------
[Computer]
Mgr-server-01
HostName = 10.10.0.1
[Mgm default]
Datadir =/var/lib/mysql-cluster
[Mgm]
HostName = 10.10.0.1
NodeId = 60
ExecuteOnComputer = mgr-server-01
PortNumber = 1186
ArbitrationRank = 2
[Ndbd default]
NoOfReplicas = 2
DataMemory = 8G
IndexMemory = 2G
[Ndbd]
HostName = 10.10.0.1
DataDir =/var/lib/mysql
NodeId = 1
[Ndbd]
HostName = 10.10.0.2
DataDir =/var/lib/mysql
NodeId = 2
[Mysqld]
HostName = 10.10.0.1
NodeId = 81
[Mysqld]
HostName = 10.10.0.2
NodeId = 82
Bytes ---------------------------------------------------------------------------------------------------------------------------
5. Configure the Mysql file:
Vi/etc/my. cnf
[Client]
Socket =/var/lib/mysql. sock
[Mysqld]
Max_connections = 100
Datadir =/var/lib/mysql
Socket =/var/lib/mysql. sock
Ndbcluster
Ndb-connectstring = 10.10.0.1
[Mysqld_safe]
Log-error =/var/log/mysqld. log
Pid-file =/var/run/mysqld. pid
[Mysql_cluster]
Ndb-connectstring = 10.10.0.1
Bytes ---------------------------------------------------------------------------------------------------------------------------
Iii. SQL Cluster Initial Startup command and user password change adjustment: (Please start in strict order)
Before starting the service for the first time, make sure that the firewall of the two machines is disabled (service iptables stop or set the firewall port to allow access, and the two ports are communication port 1186 and data port 3306)
Start mgt console command for the first time: ndb_mgmd-f/var/lib/mysql-cluster/config. ini
Run the "ndbd -- initial" command to start the balancing node.
Run mysqld_safe -- defaults-file =/etc/my. cnf -- explicit_defaults_for_timestamp &
Pay attention to the need to monitor the entire console output during the startup process. If any error information is found, it should be resolved in a timely manner based on the error log Content.
Bytes ---------------------------------------------------------------------------------------------------------
Run the following command to enable the Management console: ndb_mgm
Input: show
Ndb_mgm> show
Cluster Configuration
Bytes ---------------------------------------------------------------------------------------------------------
[Ndbd (NDB)] 2 node (s)
Id = 1 @ 10. x.0.1 (mysql-5.6.15 ndb-7.3.4, node group: 0 ,*)
Id = 2 @ 10. x.0.2 (mysql-5.6.15 ndb-7.3.4, node group: 0)
[Ndb_mgmd (MGM)] 1 node (s)
Id = 60 @ 10. x.0.1 (mysql-5.6.15 ndb-7.3.4)
[Mysqld (API)] 2 node (s)
Id = 81 @ 10. x.0.1 (mysql-5.6.15 ndb-7.3.4)
Id = 82 @ 10. x.0.2 (mysql-5.6.15 ndb-7.3.4)
Bytes ---------------------------------------------------------------------------------------------------------
Change Password:
After mysqld is started properly (you can use pgrep mysqld to obtain the process ID), run the following command to modify the process ID:
Mysql-u root-p;
Random Password (for details, see the/root/. mysql_secret file), and then use the following command to change the password:
Set password = PASSWORD ('new password ');
The preceding commands must be executed on several servers with SQL data nodes;
Bytes ---------------------------------------------------------------------------------------------------------
Iv. Cluster performance test:
Use the mysql-u root-p password;
Enter the password and log on to the system. Run the following command to create a database;
Create database clustertest;
Use clustertest;
Create table testtable (Count INT) ENGINE = NDBCLUSTER;
Note that only tables using the NDBCluster engine can perform synchronization. Therefore, you must add this suffix to the preceding table;
For more details, please continue to read the highlights on the next page: