Below is the list of changes that have just been committed into a local
mysqldoc repository of jon. When jon does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.2778 05/03/27 15:15:30 jon@stripped +1 -0
Cluster Chapter How-To:
- ndb_mgmd must be started with -f or --config-file
- mentioned that it's possible to use
ALTER TABLE table ENGINE=NDBCLUSTER;
after after importing a DB
Docs/manual.texi
1.2612 05/03/27 15:15:25 jon@stripped +54 -30
Cluster Chapter How-To:
- ndb_mgmd must be started with -f or --config-file
- mentioned that it's possible to use
ALTER TABLE table ENGINE=NDBCLUSTER;
after after importing a DB
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jon
# Host: gigan.site
# Root: /home/jon/bk/mysqldoc
--- 1.2611/Docs/manual.texi 2005-03-26 04:26:30 +10:00
+++ 1.2612/Docs/manual.texi 2005-03-27 15:15:25 +10:00
@@ -71820,11 +71820,9 @@
@subsubheading Configuring the Management Node
-The @command{ndb_mgmd} and @command{ndb_mgm} processes running on the MGM node
-will expect to find their configuration data in the file
-@file{/var/lib/mysql-cluster/config.ini}. Therefore, the first step in
-configuring the MGM node is to create the directory in which this file can be
-found and then create the file itself. For example (running as root):
+The first step in configuring the MGM node is to create the directory in which
+the configuration file can be found and then to create the file itself. For
+example (running as root):
@example
mkdir /var/lib/mysql-cluster
@@ -71906,9 +71904,13 @@
start the MGM node process:
@example
- shell> ndb_mgmd
+ shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini
@end example
+ Note that @command{ndb_mgmd} must be told where to find its configuration
+ file, using the @code{-f} or @code{--config-file} option. (See @ref{Command
+ Options for @command{ndb_mgmd}} for details.)
+
@item
On each of the storage node hosts, run this command to start the NDBD process
for the first time:
@@ -71976,13 +71978,15 @@
@item
Tables must be created with the @option{ENGINE=NDB} or
- @option{ENGINE=NDBCLUSTER} option in order to have them replicated in the
+ @option{ENGINE=NDBCLUSTER} option, or be altered (using @code{ALTER TABLE}) to
+ use the NDB CLuster storage engine in order to have them replicated in the
cluster. If you are importing tables from an existing database using the
- output of @command{mysqldump}, you should first open the SQL script(s) in a
- text editor and add this option to any table creation statements, or replace
- any existing @option{ENGINE} (or @option{TYPE}) option with one of these. For
- example, suppose that you have the sample @strong{world} database on another
- MySQL server, and you wish to export the definition for the @code{CITY} table:
+ output of @command{mysqldump}, you can open the SQL script(s) in a text editor
+ and add this option to any table creation statements, or replace any existing
+ @code{ENGINE} (or @code{TYPE}) option(s) with one of these. For example,
+ suppose that you have the sample @strong{world} database on another MySQL
+ server (that doesn't support MySQL Cluster), and you wish to export the
+ definition for the @code{CITY} table:
@example
shell> mysqldump --add-drop-table world City < city_table.sql
@@ -72009,8 +72013,10 @@
# (remaining INSERT statements omitted)
@end example
- Before importing this into the Cluster database, you will need to modify it
- so that it reads:
+ You will need to make sure that MySQL uses the NDB storage engine for this
+ table. There are two ways that this can be accomplished. One of these is,
+ @strong{before} importing the table into the Cluster database, to modify
+ its definition so that it reads (still using the @strong{City} as an example):
@example
DROP TABLE IF EXISTS City;
@@ -72029,6 +72035,12 @@
# (etc.)
@end example
+ This will need to be done for the definition of each table that is to be part
+ of the clustered database. The easiest way to accomplish this is simply to do
+ a search-and-replace on the @file{world.sql} file and replace all instances of
+ @code{TYPE=MyISAM} with @code{ENGINE=NDBCLUSTER}. If you do not wish to modify
+ the file, you can also use @code{ALTER TABLE}; see below for particulars.
+
Assuming that you have already created a database named @strong{world} on
the SQL node of the cluster, you can then use the @command{mysql} command-line
client to read @file{city_table.sql}, and create and populate the
@@ -72042,10 +72054,8 @@
on the host where the SQL node is running -- in this case, on the machine with
the IP address @strong{192.168.0.20}.
- To create a copy of the @strong{world} database on the SQL node, simply do a
- search-and-replace on the @file{world.sql} file, replacing all instances of
- @code{TYPE=MyISAM} with @code{ENGINE=NDBCLUSTER}, save the file to
- @file{/usr/local/mysql/data}, then run
+ To create a copy of the @strong{world} database on the SQL node, save the file
+ to @file{/usr/local/mysql/data}, then run
@example
shell> cd /usr/local/mysql/data
@@ -72070,12 +72080,23 @@
mysql>
@end example
+ If you did not modify the @code{ENGINE=} clauses in the table definitions prior
+ to importing the SQL script, then you should at this point run the following
+ commands:
+
+ @example
+ mysql> USE world;
+ mysql> ALTER TABLE City ENGINE=NDBCLUSTER;
+ mysql> ALTER TABLE Country ENGINE=NDBCLUSTER;
+ mysql> ALTER TABLE CountryLanguage ENGINE=NDBCLUSTER;
+ @end example
+
Note that we simply use the default root account with its empty password here.
- Of course, in a production setting, you should always follow the standard
- security precautions for installing a MySQL server, including the setting of a
- strong root password and creation of a user account with only those privileges
- required to accomplish necessary tasks by that user. For more information
- about these, see @ref{Privilege system}.
+ Of course, in a production setting, you should @strong{always} follow the
+ standard security precautions for installing a MySQL server, including the
+ setting of a strong root password and creation of a user account with only
+ those privileges required to accomplish necessary tasks by that user. For more
+ information about these, see @ref{Privilege system}.
It is worth taking into account that Cluster nodes do not make use of the
MySQL privileges system when accessing one another, and setting or changing
@@ -72109,7 +72130,7 @@
Applications using MySQL can use standard APIs. It is important to remember
that your application must access the SQL node, and not the MGM or storage
nodes. This brief example shows how we might execute the same query as above
- using PHP 5's @strong{mysqli} extension running on a Web server elsewhere on
+ using PHP 5's @code{mysqli} extension running on a Web server elsewhere on
the network:
@example
@@ -72149,14 +72170,14 @@
<?
# then display the results...
while($row = $result->fetch_object())
- echo "<tr>\n <td align=\"center\">$row->Name</td>
- <td>$row->Population</td>\n</tr>\n";
+ printf(<tr>\n <td align=\"center\">%s</td><td>%d</td>\n</tr>\n",
+ $row->Name, $row->Population);
?>
</tbody
</table>
<?
# ...and verify the number of rows that were retrieved
- echo "<p>Affected rows: " . $link->affected_rows . "</p>\n";
+ printf("<p>Affected rows: %d</p>\n", $link->affected_rows);
@}
else
# otherwise, tell us what went wrong
@@ -72180,7 +72201,10 @@
@item
Also remember that all NDB tables must have a primary key. If no primary key
is defined by the user when a table is created, the NDB Cluster storage
- engine will automatically generate a hidden one.
+ engine will automatically generate a hidden one. (@bold{Note}: This hidden key
+ takes up space just as does any other table index. It is not uncommon to
+ encounter problems due to insufficient memory to accomodate these
+ automatically-created keys.)
@end itemize
@@ -72206,7 +72230,7 @@
On the management host (192.168.0.10 in our setup):
@example
- shell> ndb_mgmd
+ shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini
@end example
@item
@@ -98108,7 +98132,7 @@
they are inserted into the table. For example:
@example
LOAD DATA INFILE 'file.txt'
- INTO TABLE t1
+ INTO TABLE t1
(column1, @@var1)
SET column2 = @@var1/100;
@end example
| Thread |
|---|
| • bk commit - mysqldoc tree (jon:1.2778) | jon | 27 Mar |