Experience in installing MySQL-Cluster 7.3.4 on CentOs6.5 (2 days to find test results of various materials)

Source: Internet
Author: User

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.
Bytes ---------------------------------------------------------------------------------------------------------------------

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;
Bytes ---------------------------------------------------------------------------------------------------------

5. Disable Cluster: (the Cluster must be executed in strict order)
Close the data node: mysqld stop (the SQL node can be shut down using mysqladmin shutdown or other methods .)
Run shell> ndb_mgm-e shutdown on the Management node.
Close management nodes and data nodes securely.

Run the following process detection command to check whether the system has exited:
Pgrep mysqld
Ps aux | grep nbdb
If not, find the corresponding pid and perform the kill operation.

6. Restart the Cluster solution:
Sequence of starting the entire cluster:
Ndb_mgmd-f/var/lib/mysql-cluster/config. ini
Ndbd
Mysqld_safe -- defaults-file =/etc/my. cnf -- explicit_defaults_for_timestamp &
Bytes ---------------------------------------------------------------------------------------------------------------------
Note:
Firewall Policy Adjustment: iptables-a input-s 192.168.100.0/24-I eth2-p tcp-m tcp-j ACCEPT
Method 1:
Mysqladmin-u root password root (Change password) (execute before new password is not available)
Mysqladmin-u root-p 'xxxx' password 'newpassword'; (start mysqld after installation)

Method 2:
UPDATE mysql. user SET Password = PASSWORD ('password01! ') WHERE User = 'root ';
Flush privileges;

Method 3:
Enable mysql with no security control:
Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking;
Then use the previous two methods to change the password;
Bytes ------------------------------------------------------------------------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.