MySQL NDB Cluster Installation Guide

Source: Internet
Author: User

The main function of Mysql NDB Cluster is to deploy a memory-based database Cluster in a system with no shared storage, mainly through the NDB Cluster (abbreviated NDB) storage engine. The NDB cluster version used in this article is 7.6, and the host description is shown in the following table:

1, each node package installation
I created a yum repository here, so I installed it directly through the Yum command.

  • NDB Management Node installation package
    [[email protected] ~]# yum -y install mysql-cluster-commercial-management-server
  • NDB SQL Node installation package
    [[email protected] ~]# yum -y install mysql-cluster-commercial-server mysql-cluster-commercial-common mysql-cluster-commercial-client
  • NDB Data Node installation package
    [[email protected] ~]# yum -y install mysql-cluster-commercial-data-node mysql-cluster-commercial-client[[email protected] ~]# yum -y install mysql-cluster-commercial-data-node mysql-cluster-commercial-client

    2, NDB Cluster service configuration

  • NDB Management Node Configuration
     //Create configuration file [[[email protected] ~]# mkdir/var/lib/mysql-cluster[[email protected] ~]# vi/var/lib/ MYSQL-CLUSTER/CONFIG.INI[TCP default]sendbuffermemory=2mreceivebuffermemory=2m[ndbd Default] #设置冗余的分数NoOfReplicas =2# Specifies the size of the memory segment that holds the data datamemory=1024m# the directory that holds trace files, log files, PID files, and error logs datadir=/var/lib/mysql-clusterserverport=2202# The maximum number of NDB tables that are stored in the database maxnooftables=8192# sets the total number of times that the hash index is used in the system, and the default value of this parameter is 128. maxnooforderedindexes=2048# defines the number of properties that can be defined in a cluster maxnoofattributes=5000000# opening this setting will allow the mainland version NDB to attempt to use O_direct to write LCP, backup, redo logs, Typically, fewer memory and CPUs are used. odirect=1# the size of each redo log file fragmentlogfilesize=100m# The maximum number of triggers that can be defined in the system Maxnooftriggers=1000[ndb_mgmd]nodeid=1hostname =192.168.120.93datadir=/var/lib/mysql-clustertotalsendbuffermemory=2048m[ndbd]totalsendbuffermemory= 2048mnodeid=2hostname=192.168.120.130datadir=/var/lib/mysql[ndbd]totalsendbuffermemory=2048mnodeid=3hostname= 192.168.120.131datadir=/var/lib/mysql[mysqld]nodeid=4totalsendbuffermemory=2048mhostname=192.168.120.129 

    Initializes the NDB management node, executes once, and does not require additional--initial parameters for subsequent launches.

    [[email protected] ~]# ndb_mgmd -f /var/lib/mysql-cluster/config.ini –initial

    Through the NDB client view, in addition to the management node is connected, the other has not yet established a connection with the management node, such as:

  • NDB Data Node Configuration
    //数据节点1创建my.cnf文件[[email protected] ~]# vi /etc/my.cnf[mysqld]ndbclusterndb-connectstring = 192.168.120.93[mysql_cluster]  ndb-connectstring = 192.168.120.93//数据节点1初始化[[email protected] ~]# ndbd --initial//数据节点2创建my.cnf文件[[email protected] ~]# vi /etc/my.cnf[mysqld]ndbclusterndb-connectstring = 192.168.120.93[mysql_cluster]  ndb-connectstring = 192.168.120.93//数据节点2初始化[[email protected] ~]# ndbd –initial

    In the management node through the NDB client can verify that the data node has established a connection, such as:

  • NDB SQL Node configuration
     //Create configuration file [[email protected] ~]# vi/etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/ var/lib/mysql/mysql.socksymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/ Mysqld.pidndbclusterdefault-storage-engine=ndbclustertmp_table_size = 512M Max_heap_table_size = 102400Mmax_allowed _packet = 3072mlog_timestamps=systemcollation-server=utf8_general_cicharacter-set-server = Utf8[mysql_cluster] ndb-connectstring=192.168.120.93//start the MySQL service [[email protected] ~]# systemctl start mysqld  

    Verify that the SQL node establishes a connection to the management node, such as

    , where the entire NDB Cluster service is built, and finally the table is created through the SQL node and the data is imported. In addition, only tables that use the Ndbcluster engine perform synchronous operations, and if you do not specify an engine type of ndbcluster when you create the table, the system does not synchronize. Use the following command in the SQL node to change the table type to Ndbcluster:

      mysql> ALTER TABLE Xj.chapter Engine=ndbcluster;  

    3, NDB Cluster service management
    When the cluster is created, the initialization is done, and the subsequent boot process does not need to add--initial parameters. The order to start is to start the NDB Management Service, start the NDB Data node service, and finally the SQL node service.

  • Start NDB Cluster service
    [[email protected] ~]# ndb_mgmd -f /var/lib/mysql-cluster/config.ini[[email protected] ~]# ndbd[[email protected] ~]# ndbd[[email protected] ~]# systemctl start mysqld
  • Close NDB Cluster service
    //通过NDB客户端执行shutdown可关闭cluster里的所有服务除SQL节点服务[[email protected] ~]# ndb_mgmndb_mgm>shutdown[[email protected] ~]# systemctl stop mysqld

    4, Monitoring NDB Cluster service
    Using the MySQL Enterprise Monitor tool here, please refer to my blog for the installation of this tool. After the MySQL Enterprise Monitor Agent service starts, it collects the operating system as well as the MySQL information sent to the server, and finally obtains relevant information from the Web interface, such as:


MySQL NDB Cluster Installation Guide

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.