MYSQL user experience (6)-cluster

Source: Internet
Author: User
MYSQL usage tips (6) ---- dev. mysql. comdownloadsclustermysql-cluster on the official cluster website is actually the alias of MYSQL. However, based on personal experience, it is rarely used in actual production. So I will write an article here to get started with understanding and learning. To install cluster, you must first install java and cmake

MYSQL use experience (6) ---- cluster official website http://dev.mysql.com/downloads/cluster/ mysql-cluster is actually mysql7.0 version alias. However, based on personal experience, it is rarely used in actual production. So I will write an article here to get started with understanding and learning. To install cluster, you must first install java and cmake

MYSQL usage experience (6) ---- cluster
Official Website
Http://dev.mysql.com/downloads/cluster/
Mysql-cluster is actually the alias of mysql. However, based on personal experience, it is rarely used in actual production. So I will write an article here to get started with understanding and learning.




To install cluster, you must first install java and cmake
Datadir =/data0/search/mysql-cluster

[Install a management node]
Cmake-DCMAKE_INSTALL_PREFIX =/application/search/mysql-cluster/mysql-cluster-gpl-7.2.8
Make-j16
Make install-j16

Copy the configuration file and modify the corresponding configuration
Mkdir etc
Cp support-files/config. huge. ini etc/

Start
./Ndb_mgmd -- config-file =/application/search/mysql-cluster/mysql-cluster-gpl-7.2.8/etc/config. ini

Modify configuration and restart -- reload
./Ndb_mgmd -- config-file =/application/search/mysql-cluster/mysql-cluster-gpl-7.2.8/etc/config. ini -- reload

Log on to the management client
./Ndb_mgm

Stop
./Ndb_mgm-e shutdown

Restart other nodes Restart-f;



View table partitions
An empty engine node must be reserved in config. ini.
[API]
Id: 6
> Show # Check the last row; otherwise, the table partition cannot be viewed.
Cluster Configuration
---------------------
[Ndbd (NDB)] 3 node (s)
Id = 2 @ 10.10.128.118 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0, Master)
Id = 3 @ 10.10.128.117 (mysql-5.5.27, Nodegroup: 1)
Id = 5 @ 10.10.128.119 (mysql-5.5.27, Nodegroup: 2)

[Ndb_mgmd (MGM)] 1 node (s)
Id = 1 @ 10.10.128.119 (mysql-5.5.27 ndb-7.2.8)

[Mysqld (API)] 2 node (s)
Id = 4 @ 10.10.128.116 (mysql-5.5.27 ndb-7.2.8)
Id = 6 (not connected, accepting connect from any host)
View commands
./Ndb_desc user-d opendata_test-p

[Install data nodes]
./Scripts/mysql_install_db -- user = search -- datadir =/data0/search/mysql-cluster
Create a configuration file/application/search/mysql-cluster/mysql-cluster-gpl-7.2.8/etc/ndb. ini

[Mysqld]
Datadir =/data0/search/mysql-cluster
Skip-locking
Ndbcluster
Ndb-connectstring = 10.10.128.119: 1186
[Mysql_cluster]
Ndb-connectstring = 10.10.128.119: 1186


Start the data node. -- initial must be included when the data node is started for the first time.
./Ndbd -- defaults-file =/application/search/mysql-cluster/mysql-cluster-gpl-7.2.8/etc/ndb. ini -- initial




[Install mysql engine]
Create a configuration file/application/search/mysql-cluster/mysql-cluster-gpl-7.2.8/etc/ndb. ini
And join
[Mysqld]
# Ndb
Ndbcluster
Ndb-connectstring = 10.10.128.119: 1186

Initialization
./Scripts/mysql_install_db -- user = search -- datadir =/data0/search/mysql-cluster

Start
./Mysqld-uroot &

SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where engine = 'dbcluster ';
Alter online table table_name REORGANIZE PARTITION



[Create a disk table]
Create a log file
Create logfile group lg_cloudstor add undofile 'cloudstor _ undo_1.log' INITIAL_SIZE 1024 M UNDO_BUFFER_SIZE 20 m engine ndbcluster;
This statement may cause errors and ERROR 1064 (42000) syntax ERROR. The cause is the character set problem. Run: set character_set_client = latin1:
Alter logfile group lg_cloudstor add undofile 'cloudstor _ undo_2.log 'INITIAL_SIZE 1024 m engine ndbcluster;
Alter logfile group lg_cloudstor add undofile 'cloudstor _ undo_3.log 'INITIAL_SIZE 1024 m engine ndbcluster;

Create a tablespace
Create tablespace ts_cloudstore add datafile 'cloudstore _ data_1.dbf' use logfile group lg_cloudstor INITIAL_SIZE 1024 M AUTOEXTEND_SIZE 256 m engine ndbcluster;
Alter tablespace ts_cloudstore add datafile 'cloudstore _ data_2.dbf' INITIAL_SIZE 1024 M AUTOEXTEND_SIZE 256 m engine ndbcluster;

Create a table
Create table disktable (\
Id int auto_increment primary key ,\
C1 varchar (50) not null ,\
C2 varchar (30) default null ,\
C3 date default null ,\
Index (c1) TABLESPACE ts_cloudstore storage disk engine = ndbcluster

Delete
Drop table disktable;
Alter tablespace ts_cloudstore drop datafile 'cloudstore _ data_1.dbf' engine ndbcluster;
Alter tablespace ts_cloudstore drop datafile 'cloudstore _ data_2.dbf' engine ndbcluster;

Drop tablespace ts_cloudstore engine ndbcluster;

Drop logfile group lg_cloudstorengine ndbcluster;

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.