- MySQL 5.1 Reference Manual :: 17 MySQL Cluster NDB 6.X/7.X :: 17.3 MySQL Cluster Configuration :: 17.3.2 MySQL Cluster Configuration Files :: 17.3.2.3 The MySQL Cluster Connectstring
-
- MySQL 5.1 Reference Manual
- Preface, Notes, Licenses
- 1 General Information
- 2 Installing and Upgrading MySQL
- 3 Tutorial
- 4 MySQL Programs
- 5 MySQL Server Administration
- 6 Backup and Recovery
- 7 Optimization
- 8 Language Structure
- 9 Internationalization and Localization
- 10 Data Types
- 11 Functions and Operators
- 12 SQL Statement Syntax
- 13 Storage Engines
- 14 High Availability and Scalability
- 15 MySQL Enterprise Monitor
- 16 Replication
- 17 MySQL Cluster NDB 6.X/7.X
- 18 Partitioning
- 19 Stored Programs and Views
- 20 INFORMATION_SCHEMA Tables
- 21 Connectors and APIs
- 22 Extending MySQL
- A MySQL 5.1 Frequently Asked Questions
- B Errors, Error Codes, and Common Problems
- C MySQL Change History
- D Restrictions and Limits
- Index
- Standard Index
- C Function Index
- Command Index
- Function Index
- INFORMATION_SCHEMA Index
- Transaction Isolation Level Index
- JOIN Types Index
- Operator Index
- Option Index
- Privileges Index
- SQL Modes Index
- Status Variable Index
- Statement/Syntax Index
- System Variable Index
With the exception of the MySQL Cluster management server (ndb_mgmd), each node that is part of a MySQL Cluster requires a connectstring that points to the management server's location. This connectstring is used in establishing a connection to the management server as well as in performing other tasks depending on the node's role in the cluster. The syntax for a connectstring is as follows:
[nodeid=
node_id
, ]host-definition
[,host-definition
[, ...]]host-definition
:host_name
[:port_number
]node_id
is an integer larger than 1 which identifies a node inconfig.ini
.host_name
is a string representing a valid Internet host name or IP address.port_number
is an integer referring to a TCP/IP port number.example 1 (long): "nodeid=2,myhost1:1100,myhost2:1100,192.168.0.3:1200" example 2 (short): "myhost1"
localhost:1186
is used as the default connectstring value if none is provided. Ifport_num
is omitted from the connectstring, the default port is 1186. This port should always be available on the network because it has been assigned by IANA for this purpose (see http://www.iana.org/assignments/port-numbers for details).By listing multiple host definitions, it is possible to designate several redundant management servers. A MySQL Cluster data or API node attempts to contact successive management servers on each host in the order specified, until a successful connection has been established.
Beginning with MySQL Cluster NDB 6.3.19, it is also possible in a connectstring to specify one or more bind addresses to be used by nodes having multiple network interfaces for connecting to management servers. A bind address consists of a hostname or network address and an optional port number. This enhanced syntax for connectstrings is shown here:
[nodeid=
node_id
, ] [bind-address=host-definition
, ]host-definition
[; bind-address=host-definition
]host-definition
[; bind-address=host-definition
] [, ...]]host-definition
:host_name
[:port_number
]If a single bind address is used in the connectstring prior to specifying any management hosts, then this address is used as the default for connecting to any of them (unless overridden for a given management server; see later in this section for an example). For example, the following connectstring causes the node to use
192.168.178.242
regardless of the management server to which it connects:bind-address=192.168.178.242, poseidon:1186, perch:1186
If a bind address is specified following a management host definition, then it is used only for connecting to that management node. Consider the following connectstring:
poseidon:1186;bind-address=localhost, perch:1186;bind-address=192.168.178.242
In this case, the node uses
localhost
to connect to the management server running on the host namedposeidon
and192.168.178.242
to connect to the management server running on the host namedperch
.You can specify a default bind address and then override this default for one or more specific management hosts. In the following example,
localhost
is used for connecting to the management server running on hostposeidon
; since192.168.178.242
is specified first (before any management server definitions), it is the default bind address and so is used for connecting to the management servers on hostsperch
andorca
:bind-address=192.168.178.242,poseidon:1186;bind-address=localhost,perch:1186,orca:2200
There are a number of different ways to specify the connectstring:
Each executable has its own command-line option which enables specifying the management server at startup. (See the documentation for the respective executable.)
It is also possible to set the connectstring for all nodes in the cluster at once by placing it in a
[mysql_cluster]
section in the management server'smy.cnf
file.-
For backward compatibility, two other options are available, using the same syntax:
Set the
NDB_CONNECTSTRING
environment variable to contain the connectstring.Write the connectstring for each executable into a text file named
Ndb.cfg
and place this file in the executable's startup directory.
However, these are now deprecated and should not be used for new installations.
The recommended method for specifying the connectstring is to set it on the command line or in the
my.cnf
file for each executable.Previous to MySQL Cluster NDB 7.0.15 and MySQL Cluster NDB 7.1.4, the maximum length of a connectstring was 1024 characters.