DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info.gz) MySQL Cluster quick

Info Catalog (mysql.info.gz) MySQL Cluster installing (mysql.info.gz) MySQL Cluster Configuration (mysql.info.gz) MySQL Cluster Config File
 
 16.3.3 Quick Test Setup of MySQL Cluster
 ----------------------------------------
 
 In order to familiarize you with the basics, we will describe the
 simplest possible configuration for a functional MySQL Cluster. After
 this, you should be able to design your desired setup from the
 information provided in the other relevant sections of this chapter.
 
 First, you need to create a configuration directory, for example
 `/var/lib/mysql-cluster', by executing the following command as `root':
 
      shell> mkdir /var/lib/mysql-cluster
 
 In this directory, create a file named `config.ini' with the following
 information, substituting appropriate values for `HostName' and
 `DataDir' as necessary for your system.
 
      # file "config.ini" - showing minimal setup consisting of 1 DB node,
      # 1 management server, and 3 MySQL servers.
      # The empty default sections are not required, and are shown only for
      # the sake of completeness.
      # Storage nodes are required to provide a hostname but MySQL Servers
      # are not.
      # If you don't know the hostname for your machine, use localhost.
      # The DataDir parameter also has a default value, but it is recommended to
      # set it explicitly.
      # NDBD, MYSQLD, and NDB_MGMD are aliases for DB, API, and MGM respectively
      #
      [NDBD DEFAULT]
      NoOfReplicas= 1
 
      [MYSQLD DEFAULT]
      [NDB_MGMD DEFAULT]
      [TCP DEFAULT]
 
      [NDB_MGMD]
      HostName= myhost.example.com
 
      [NDBD]
      HostName= myhost.example.com
      DataDir= /var/lib/mysql-cluster
 
      [MYSQLD]
      [MYSQLD]
      [MYSQLD]
 
 You can start the management server as follows:
 
      shell> cd /var/lib/mysql-cluster
      shell> ndb_mgmd
 
 Then start a single DB node by running `ndbd'. When starting `ndbd' for
 a given DB node for the very first time, you should use the `--initial'
 option:
 
      shell> ndbd --initial
 
 For subsequent `ndbd' starts, you will generally not want to use
 `--initial':
 
      shell> ndbd
 
 This is because the `--initial' option will delete all existing data
 and log files (as well as all table metadata) for this storage node and
 create new ones.
 
 By default, `ndbd' will look for the management server at `localhost'
 at port 1186. (Prior to MySQL 4.1.8, the default port was 2200.)
 
 * If you have installed MySQL from a binary tarball, you will
 need to specify the path of the `ndb_mgmd' and `ndbd' servers
 explicitly. (Normally, these will be found in `/usr/local/mysql/bin'.)
 
 Finally, go to the MySQL data directory (usually `/var/lib/mysql' or
 `/usr/local/mysql/data'), and make sure that the `my.cnf' file contains
 the option necessary to enable the `NDB' storage engine:
 
      [mysqld]
      ndbcluster
 
 You can start the MySQL server as usual:
 
      shell> mysqld_safe --user=mysql &
 
 Wait a moment to make sure the MySQL server is running properly. If you
 see the notice `mysql ended', check the server's `.err' file to find
 out what went wrong.
 
 If all has gone well so far, you can start using the cluster:
 
      shell> mysql
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 1 to server version: 4.1.7
 
      Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
      mysql> SHOW ENGINES;
      +------------+---------+------------------------------------------------------------+
      | Engine     | Support | Comment                                                    |
      +------------+---------+------------------------------------------------------------+
      ...
      | NDBCLUSTER | DEFAULT | Clustered, fault-tolerant, memory-based tables             |
      | NDB        | YES     | Alias for NDBCLUSTER                                       |
      ...
 
      mysql> USE test;
      Database changed
 
      mysql> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;
      Query OK, 0 rows affected (0.09 sec)
 
      mysql> SHOW CREATE TABLE ctest \G
      *************************** 1. row ***************************
             Table: ctest
      Create Table: CREATE TABLE `ctest` (
        `i` int(11) default NULL
      ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
      1 row in set (0.00 sec)
 
 To check that your nodes were set up properly, start the management
 client as shown:
 
      shell> ndb_mgm
 
 You can then use the `SHOW' command from within the management client
 in order to obtain a report on the cluster's status:
 
      NDB> SHOW
      Cluster Configuration
      ---------------------
      [ndbd(NDB)]     1 node(s)
      id=2    @127.0.0.1  (Version: 3.5.3, Nodegroup: 0, Master)
 
      [ndb_mgmd(MGM)] 1 node(s)
      id=1    @127.0.0.1  (Version: 3.5.3)
 
      [mysqld(API)]   3 node(s)
      id=3    @127.0.0.1  (Version: 3.5.3)
      id=4 (not connected, accepting connect from any host)
      id=5 (not connected, accepting connect from any host)
 
 At this point, you have successfully set up a working MySQL Cluster.
 You can store data in the cluster by using any table created with
 `ENGINE=NDBCLUSTER' or its alias `ENGINE=NDB'.
 
Info Catalog (mysql.info.gz) MySQL Cluster installing (mysql.info.gz) MySQL Cluster Configuration (mysql.info.gz) MySQL Cluster Config File
automatically generated byinfo2html