A MySQL Cluster Binaries

Many binaries are included with MySQL Cluster for special uses. Many of them have been discussed in this book, but some of them have not. This appendix is designed for quick reference; you can use it to find out what a program does and get an overview of the commonly used options for the different binaries.

An Overview of Binary Options

The options for the MySQL Cluster binaries work the same as those for MySQL. They can be included in configuration files and accept short and long options in the same manner as any of the other MySQL binaries.

One option that exists for almost all the binaries discussed is called --ndb-connectstring, or -c. This option specifies to the program where to find the management server to find out the information about the structure of the cluster. Here are two examples of its use:


ndb_show_tables --ndb-connectstring=192.168.0.5
ndb_show_tables –c 192.168.0.5


To get a list of all the options that a program takes, you should run it with the --help or -? option to get output for all the possible options.

Configuration Files

The configuration file setup works the same with MySQL Cluster as with MySQL. The normal default global configuration file is /etc/my.cnf. In addition, a user can create a user-specific configuration file in his or her home directory as ~/.my.cnf. This home directory configuration file is used only by the client programs and not by the server programs.

A special group is designed to be used with MySQL Cluster binaries: [mysql_cluster]. Any options put into this group apply to all the binaries that are involved in the cluster. The most common use of this is to specify the ndb-connectstring option discussed previously. The following example sets up the location of the configuration server for all cluster clients and servers that will run on the server:


[mysql_cluster]
ndb-connectstring=192.168.0.5


Individual Programs

Many different programs are used with MySQL Cluster. Some of the programs are exclusive to MySQL Cluster, whereas a lot of them are used with normal MySQL, and you may be familiar with them already. All these programs have a plethora of different command-line options that can be used with them. The following sections discuss the different programs and some of the most commonly used options.

The mysqld Program

mysqld is the normal MySQL server. It handles all the incoming client connections and handles all the SQL processing in the cluster.

The following is the most common option for mysqld:

Option                                 Description

--ndbcluster             Tells the MySQL server to enable the storage engine and to join the cluster setup.

The mysql Program

mysql is the default command-line client for logging in to the MySQL server. All SQL statements in this book (for example, CREATE TABLE, ALTER TABLE, SELECT) can be issued through this interface.

The following are the common options for mysql:

Option

Description

--host or -h

Specifies where to connect to the MySQL server.

--user or -u

Specifies which user to attempt to log in to the server as.

--password or -p

Prompts you for the password (or you can specify it on the command line). Unlike with other options, you cannot use a space between -p and <password> when providing it.

The ndbd Program

The ndbd binary represents a data node instance. You have to execute it once for each data node in the cluster setup. It is in charge of the actual physical storage and reading/writing of memory and disk with regard to the table data you manipulate.

The following are the common options for ndbd:

Option

Description

--initial

Causes ndbd to delete everything stored on disk. This is normally only used the first time you run the node or, in some cases, during a change of a configuration parameter.

--nostart or -n

Causes ndbd to connect to the management server and retrieve the configuration information but not actually perform any data manipulations. It can later be fully started from within the management server, using the START option.

Note

You need to be very careful.3 with the --initial option, as it can result in total data loss.

The ndb_mgmd Program

The ndb_mgmd binary represents the management server. This program reads in the cluster configuration file (config.ini) and then sends the configuration to any of the later starting nodes. It is also used for management (for example, restarting nodes, starting backups) and monitoring the health of the cluster. It also creates the cluster log, which is a central location for all cluster activities to be logged to.

The following is the most common option for ndb_mgmd:

Option

Description

--config-file or -f

Tells the management node where to find the cluster configuration. If you do not specify a file, MySQL Cluster looks for a file called config.ini in the current working directory.

The ndb_mgm Program

The ndb_mgm binary is the management client. It is used to log in to the management server and issue the commands to actually do the monitoring and management tasks. Normally, it runs in interactive mode, allowing you to issue commands and see their results immediately.

The following is the most common option for ndb_mgm:

Option

Description

--execute or -e

Causes the client to issue a single command and return the result instead of running in interactive mode. This option is commonly used during shell scripting for various tasks.

The ndb_desc Program

The ndb_desc program allows you to connect directly to the cluster and examine the structure of a table. This can be useful for ensuring that the cluster has the table structure you expect.

The following is the most common option for ndb_desc:

Option

Description

--database or -d

Tells the cluster what database the table is in. This option always has to be specified.

The following is an example of the ndb_desc program:


ndb_desc --database dbname tblname


The ndb_restore Program

The ndb_restore binary is used to restore a backup taken from the hot online native backup command in MySQL Cluster. It is run as many times as there are nodes in the cluster in the backup process. Chapter 3, “Backup and Recovery,” provides more information.

The following are the common options for ndb_restore:

Option

Description

--backupid or -b

Specifies which backup you want to restore. Every backup is assigned an ID when it is taken, and you need to specify the ID here.

--nodeid or -n

Specifies the original node ID. Note that the node ID is stored in the backup filenames, so you can look it up if you forget it.

--restore_meta or -m

Causes the ndb_restore program to re-create all the table and index structures into the cluster. This is used only for the data you are restoring for the first node.

--restore_data or -r

Causes the ndb_restore program to re-insert the data into the cluster. This option needs to be used for all the original data nodes.

The ndb_show_tables Program

The ndb_show_tables program connects directly to the cluster (not using the MySQL server) and retrieves and outputs a list of all the tables that exist. It is most commonly used for testing that a cluster is up and has in it all the tables that should be there.

The ndb_waiter Program

The ndb_waiter program is designed to allow you to wait until the cluster has entered a certain state before returning. This can be useful when you want to take a certain action when the nodes all reach some point. The two most common times are for all of them to be started and handling requests or for them to be running but waiting to be actually started (due to the --nostart option for ndbd). The default is for ndb_waiter to wait until all the nodes are running.

The following is the most common option for ndb_waiter:

Option

Description

--not-started

Changes the behavior and makes the program wait until all the nodes are started but not running yet (--nostart option for ndbd).

The perror Program

The perror program is designed to aid in debugging error codes back to plain text. It accepts both MySQL and NDB error codes. The default is to look for the MySQL error code.

The following is the most common option for perror:

Option

Description

--ndb

Causes perror to attempt to look up the code that NDB has given.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.172.93