MySQL database management (ii) installation of MySQL cluster in a stand-alone environment

Source: Internet
Author: User

Above "MySQL database management (a) MySQL cluster cluster Introduction" to the MySQL cluster cluster to do a brief introduction, this article will teach you step by step to build a single-machine environment MySQL database cluster.


One, single-machine environment construction

First go to the MySQL official online http://www.mysql.com/downloads/Cluster/Download the required installation package, and then extract the downloaded Zip package to C:\YPL\MYSQL\MYSQLC


The MySQL database cluster consists of a MySQL service engine (mysqlds), two data nodes (NDBD), and a Management node (NDB_MGMD), all of which are running on the same machine. Create the following folder in turn:
C:\ypl\mysql\my_Cluster
C:\ypl\mysql\my_Cluster\ndb_data
C:\ypl\mysql\my_Cluster\mysqld_data\ndbinfo
C:\ypl\mysql\my_Cluster\conf

After that, create the following two configuration files in the C:\ypl\mysql\my_Cluster\conf folder:
(1) my.cnf
The contents are as follows:
[mysqld]ndbclusterdatadir=c:\\ypl\\mysql\\my_cluster\\mysqld_databasedir=c:\\ypl\\mysql\\mysqlcport=3306
(2) Config.ini
The contents are as follows:
[NDB_MGMD]HOSTNAME=LOCALHOSTDATADIR=C:\YPL\MYSQL\MY_CLUSTER\NDB_DATAID=1[NDBD default]noofreplicas=2datadir=C:\ Ypl\mysql\my_cluster\ndb_data[ndbd]hostname=localhostid=3[ndbd]hostname=localhostid=4[mysqld]hostname= localhost

The MYSQLD process requires a system database called MySQL to store the necessary system data and user data. Therefore, the following actions are required:

    • will be C:\ypl\mysql\mysqlc\data\mysql The entire folder is copied to the C:\ypl\mysql\my_Cluster\ndb_data directory.
    • Copy the C:\ypl\mysql\mysqlc\data\ndbinfo entire folder to the C:\ypl\mysql\my_Cluster\ndb_data directory.

After the above work is complete, you can start MySQL Cluster.


Second, start node: Management node--Data node-->sql node

(1) Start the Management node

Go to the command line tool cleansing and enter the command in turn:

CD  c:\ypl\mysql\my_clusterstart/b C:\ypl\mysql\mysqlc\bin\ndb_mgmd-f conf\config.ini--initial--configdir=c:\ Ypl\mysql\my_cluster\conf

The results are as follows:


(2) Start Data node

    • Start the First Data node and enter a command:

Start/b C:\ypl\mysql\mysqlc\bin\ndbd-c localhost:1186

    • Start the Second Data node and enter a command:

Start/b C:\ypl\mysql\mysqlc\bin\ndbd-c localhost:1186


(3) Start the MySQL service engine

Enter the command:

Start/b C:\ypl\mysql\mysqlc\bin\mysqld--defaults-file=conf\my.cnf

To see if the data node is up and finished:

C:\YPL\MYSQL\MYSQLC\BIN\NDB_MGM-  e Show

The results are as follows:

After each node is successfully started, the process of all nodes can be seen in the process. Start Task Manager and you will see the results,

To connect to the MySQL server, enter the command:

C:\ypl\mysql\mysqlc\bin\mysql-u root-p123456

If the connection is successful, the following interface will appear:

Third, testing

Create the database Yplbeyond (note using NDB), create the table users within the database, and insert the data

Drop database if exists yplbeyond;create database yplbeyond;use yplbeyond;create table users (id int (3) auto_increment not NULL primary Key,uid char (a) not null,pwd char (a) not null,realname char (TEN) not Null,phone char (TEN) not Null,mail char ( () not null,date datetime null) engine=ndb;; Insert into users values (' ', ' Renmin University ', ' rucedu ', ' Lizi ', ' 00000000 ', ' [email protected] ', '); select * from users;



Note : Instead of building a table in MySQL, you need to add "ENGINE=NDB;" at the endof the table, because using MySQL Cluster, the underlying storage engine is memory-based NDB, not InnoDB. Search within the folder YPL, you can find the C:\YPL\MYSQL\MY_CLUSTER\NDB_DATA\YPL directory has just created the table. At the same time, it should be noted that when the data nodes are distributed on different machines, the data stored by the InnoDB engine cannot be found on other data nodes, and can be verified by corresponding experiments.

The MySQL Cluster service must be stopped manually, and after the service is stopped, other cluster nodes can use the Management node (NDB_MGM) to stop. Enter the command:

C:\YPL\MYSQL\MYSQLC\BIN\NDB_MGM-E shutdownc:\ypl\mysql\mysqlc\bin\mysqladmin-u root-p123456 shutdown

The results are as follows:



MySQL database management (ii) installation of MySQL cluster in a stand-alone environment

Related Article

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.