Author: paul
Date: 2006-02-01 19:44:30 +0100 (Wed, 01 Feb 2006)
New Revision: 1171
Log:
r2769@kite-hub: paul | 2006-02-01 12:43:28 -0600
General revisions.
Modified:
trunk/
trunk/refman-4.1/ndbcluster.xml
trunk/refman-5.0/ndbcluster.xml
trunk/refman-5.1/ndbcluster.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:7026
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:2768
+ b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:7026
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:2769
Modified: trunk/refman-4.1/ndbcluster.xml
===================================================================
--- trunk/refman-4.1/ndbcluster.xml 2006-02-01 18:44:17 UTC (rev 1170)
+++ trunk/refman-4.1/ndbcluster.xml 2006-02-01 18:44:30 UTC (rev 1171)
@@ -1249,7 +1249,7 @@
<listitem>
<para>
On each of the data node hosts, run this command to start
- the NDBD process for the first time:
+ the <command>ndbd</command> process for the first time:
</para>
<programlisting>
@@ -1297,7 +1297,7 @@
<programlisting>
shell> <userinput>ndb_mgm</userinput>
-- NDB Cluster -- Management Client --
-ndb_mgm> SHOW
+ndb_mgm> <userinput>SHOW</userinput>
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
@@ -1315,8 +1315,8 @@
<para>
<emphasis role="bold">Note</emphasis>: If you are using an older
version of MySQL, you may see the SQL node referenced as
- ‘<literal>[mysqld(API)]</literal>’. This reflects an
- older usage that is now deprecated.
+ <literal>[mysqld(API)]</literal>. This reflects an older usage
+ that is now deprecated.
</para>
<para>
@@ -1346,26 +1346,38 @@
<listitem>
<para>
- For a table to be replicated in the cluster, it must be
- created with the <option>ENGINE=NDB</option> or
- <option>ENGINE=NDBCLUSTER</option> table option, or else it
- must be altered after being created (using <literal>ALTER
- TABLE</literal>) to use the <literal>NDB Cluster</literal>
- storage engine.
+ For a table to be replicated in the cluster, it must use the
+ <literal>NDB Cluster</literal> storage engine. To specify
+ this, use the <option>ENGINE=NDB</option> or
+ <option>ENGINE=NDBCLUSTER</option> table option. You can add
+ this open when creating the table:
</para>
+
+<programlisting>
+CREATE TABLE <replaceable>tbl_name</replaceable> ( ... ) ENGINE=NDBCLUSTER;
+</programlisting>
+
+ <para>
+ Alternatively, for an existing table that uses a different
+ storage engine, use <literal>ALTER TABLE</literal> to change
+ the table to use <literal>NDB Cluster</literal>:
+ </para>
+
+<programlisting>
+ALTER TABLE <replaceable>tbl_name</replaceable> ENGINE=NDBCLUSTER;
+</programlisting>
</listitem>
<listitem>
<para>
- Also remember that <emphasis>each <literal>NDB</literal>
- table must have a primary key</emphasis>. If no primary key
- is defined by the user when a table is created, the
- <literal>NDB Cluster</literal> storage engine will
- automatically generate a hidden one.
+ Each <literal>NDB</literal> table <emphasis>must</emphasis>
+ have a primary key. If no primary key is defined by the user
+ when a table is created, the <literal>NDB Cluster</literal>
+ storage engine automatically generates a hidden one.
(<emphasis role="bold">Note</emphasis>: This hidden key
takes up space just as does any other table index. It is not
uncommon to encounter problems due to insufficient memory
- for accommodating these automatically created keys.)
+ for accommodating these automatically created indexes.)
</para>
</listitem>
@@ -1374,13 +1386,13 @@
<para>
If you are importing tables from an existing database using the
output of <command>mysqldump</command>, you can open the SQL
- script or scripts in a text editor and add the
- <literal>ENGINE</literal> option to any table creation
- statements, or replace any existing <literal>ENGINE</literal>
- (or <literal>TYPE</literal>) option. Suppose that you have the
- <literal>world</literal> sample database on another MySQL server
- that does not support MySQL Cluster, and you want to export the
- <literal>City</literal> table:
+ script in a text editor and add the <literal>ENGINE</literal>
+ option to any table creation statements, or replace any existing
+ <literal>ENGINE</literal> (or <literal>TYPE</literal>) option.
+ Suppose that you have the <literal>world</literal> sample
+ database on another MySQL server that does not support MySQL
+ Cluster, and you want to export the <literal>City</literal>
+ table:
</para>
<programlisting>
@@ -1405,49 +1417,49 @@
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
-INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
-INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
-# (remaining INSERT statements omitted)
+INSERT INTO `City` VALUES (1,'Kabul','AFG','Kabol',1780000);
+INSERT INTO `City` VALUES (2,'Qandahar','AFG','Qandahar',237500);
+INSERT INTO `City` VALUES (3,'Herat','AFG','Herat',186800);
+<replaceable>(remaining INSERT statements omitted)</replaceable>
</programlisting>
<para>
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, <emphasis>before</emphasis>
- importing the table into the Cluster database, to modify its
- definition so that it reads (still using <literal>City</literal>
- as an example):
+ accomplished. One of these is to modify the table definition
+ <emphasis>before</emphasis> importing it into the Cluster
+ database. Using the <literal>City</literal> table as an example,
+ the definition would be modified as follows:
</para>
<programlisting>
-DROP TABLE IF EXISTS City;
-CREATE TABLE City (
-ID int(11) NOT NULL auto_increment,
-Name char(35) NOT NULL default '',
-CountryCode char(3) NOT NULL default '',
-District char(20) NOT NULL default '',
-Population int(11) NOT NULL default '0',
-PRIMARY KEY (ID)
-) ENGINE=NDBCLUSTER;
+DROP TABLE IF EXISTS `City`;
+CREATE TABLE `City` (
+ `ID` int(11) NOT NULL auto_increment,
+ `Name` char(35) NOT NULL default '',
+ `CountryCode` char(3) NOT NULL default '',
+ `District` char(20) NOT NULL default '',
+ `Population` int(11) NOT NULL default '0',
+ PRIMARY KEY (`ID`)
+) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1;
-INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
-INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
-INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
-# (etc.)
+INSERT INTO `City` VALUES (1,'Kabul','AFG','Kabol',1780000);
+INSERT INTO `City` VALUES (2,'Qandahar','AFG','Qandahar',237500);
+INSERT INTO `City` VALUES (3,'Herat','AFG','Herat',186800);
+<replaceable>(remaining INSERT statements omitted)</replaceable>
</programlisting>
<para>
- 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 to do a search-and-replace on the
- <filename>world.sql</filename> file and replace all instances of
+ This must be done for the definition of each table that is to be
+ part of the clustered database. The easiest way to accomplish
+ this is to do a search-and-replace on the file that contains the
+ definitions and replace all instances of
<literal>TYPE=MyISAM</literal> or
<literal>ENGINE=MyISAM</literal> with
<literal>ENGINE=NDBCLUSTER</literal>. If you do not want to
- modify the file, you can also use <literal>ALTER TABLE</literal>
- to change their type. The particulars are given later in this
- section.
+ modify the file, you can use the unmodified file to create the
+ tables, and then use <literal>ALTER TABLE</literal> to change
+ their type. The particulars are given later in this section.
</para>
<para>
@@ -1464,15 +1476,18 @@
<para>
It is very important to keep in mind that the preceding command
- must be executed on the host where the SQL node is running -- in
+ must be executed on the host where the SQL node is running (in
this case, on the machine with the IP address
- <literal>192.168.0.20</literal>.
+ <literal>192.168.0.20</literal>).
</para>
<para>
- To create a copy of the <literal>world</literal> database on the
- SQL node, save the file to
- <filename>/usr/local/mysql/data</filename>, and then run
+ To create a copy of the entire <literal>world</literal> database
+ on the SQL node, use <command>mysqldump</command> on the
+ non-cluster server to export it to a file named
+ <filename>world.sql</filename> in the
+ <filename>/usr/local/mysql/data</filename> directory. Then
+ import the file into the SQL node of the cluster like this:
</para>
<programlisting>
@@ -1481,10 +1496,8 @@
</programlisting>
<para>
- Of course, the SQL script must be readable by the
- <literal>mysql</literal> system user. If you save the file to a
- different location, adjust the preceding instructions
- accordingly.
+ If you save the file to a different location, adjust the
+ preceding instructions accordingly.
</para>
<para>
@@ -1494,7 +1507,7 @@
<xref linkend="mysql-cluster-limitations-in-4-1"/>.) This means
that, once the <literal>world</literal> database and its tables
have been created on one data node, you need to issue the
- statement <literal>CREATE DATABASE world</literal> followed by
+ <literal>CREATE DATABASE world</literal> statement followed by
<literal>FLUSH TABLES</literal> on each SQL node in the cluster.
This will cause the node to recognize the database and read its
table definitions.
@@ -1504,7 +1517,9 @@
Running <literal>SELECT</literal> queries on the SQL node is no
different than running them on any other instance of a MySQL
server. To run queries from the command line, you first need to
- log in to the MySQL Monitor in the usual way:
+ log in to the MySQL Monitor in the usual way (specify the
+ <literal>root</literal> password at the <literal>Enter
+ password:</literal> prompt):
</para>
<programlisting>
@@ -1519,11 +1534,6 @@
</programlisting>
<para>
- Specify the <literal>root</literal> password at the
- <literal>Enter password:</literal> prompt.
- </para>
-
- <para>
We simply use the MySQL server's <literal>root</literal> account
and assume that you have followed the standard security
precautions for installing a MySQL server, including setting a
@@ -1717,9 +1727,9 @@
</programlisting>
<para>
- Remember <emphasis role="bold">not</emphasis> to invoke this
- command with the <option>--initial</option> option when
- restarting an NDBD node normally.
+ Remember <emphasis>not</emphasis> to invoke this command
+ with the <option>--initial</option> option when restarting
+ an NDBD node normally.
</para>
</listitem>
Modified: trunk/refman-5.0/ndbcluster.xml
===================================================================
--- trunk/refman-5.0/ndbcluster.xml 2006-02-01 18:44:17 UTC (rev 1170)
+++ trunk/refman-5.0/ndbcluster.xml 2006-02-01 18:44:30 UTC (rev 1171)
@@ -1249,7 +1249,7 @@
<listitem>
<para>
On each of the data node hosts, run this command to start
- the NDBD process for the first time:
+ the <command>ndbd</command> process for the first time:
</para>
<programlisting>
@@ -1297,7 +1297,7 @@
<programlisting>
shell> <userinput>ndb_mgm</userinput>
-- NDB Cluster -- Management Client --
-ndb_mgm> SHOW
+ndb_mgm> <userinput>SHOW</userinput>
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
@@ -1315,8 +1315,8 @@
<para>
<emphasis role="bold">Note</emphasis>: If you are using an older
version of MySQL, you may see the SQL node referenced as
- ‘<literal>[mysqld(API)]</literal>’. This reflects an
- older usage that is now deprecated.
+ <literal>[mysqld(API)]</literal>. This reflects an older usage
+ that is now deprecated.
</para>
<para>
@@ -1346,26 +1346,38 @@
<listitem>
<para>
- For a table to be replicated in the cluster, it must be
- created with the <option>ENGINE=NDB</option> or
- <option>ENGINE=NDBCLUSTER</option> table option, or else it
- must be altered after being created (using <literal>ALTER
- TABLE</literal>) to use the <literal>NDB Cluster</literal>
- storage engine.
+ For a table to be replicated in the cluster, it must use the
+ <literal>NDB Cluster</literal> storage engine. To specify
+ this, use the <option>ENGINE=NDB</option> or
+ <option>ENGINE=NDBCLUSTER</option> table option. You can add
+ this open when creating the table:
</para>
+
+<programlisting>
+CREATE TABLE <replaceable>tbl_name</replaceable> ( ... ) ENGINE=NDBCLUSTER;
+</programlisting>
+
+ <para>
+ Alternatively, for an existing table that uses a different
+ storage engine, use <literal>ALTER TABLE</literal> to change
+ the table to use <literal>NDB Cluster</literal>:
+ </para>
+
+<programlisting>
+ALTER TABLE <replaceable>tbl_name</replaceable> ENGINE=NDBCLUSTER;
+</programlisting>
</listitem>
<listitem>
<para>
- Also remember that <emphasis>each <literal>NDB</literal>
- table must have a primary key</emphasis>. If no primary key
- is defined by the user when a table is created, the
- <literal>NDB Cluster</literal> storage engine will
- automatically generate a hidden one.
+ Each <literal>NDB</literal> table <emphasis>must</emphasis>
+ have a primary key. If no primary key is defined by the user
+ when a table is created, the <literal>NDB Cluster</literal>
+ storage engine automatically generates a hidden one.
(<emphasis role="bold">Note</emphasis>: This hidden key
takes up space just as does any other table index. It is not
uncommon to encounter problems due to insufficient memory
- for accommodating these automatically created keys.)
+ for accommodating these automatically created indexes.)
</para>
</listitem>
@@ -1374,13 +1386,13 @@
<para>
If you are importing tables from an existing database using the
output of <command>mysqldump</command>, you can open the SQL
- script or scripts in a text editor and add the
- <literal>ENGINE</literal> option to any table creation
- statements, or replace any existing <literal>ENGINE</literal>
- (or <literal>TYPE</literal>) option. Suppose that you have the
- <literal>world</literal> sample database on another MySQL server
- that does not support MySQL Cluster, and you want to export the
- <literal>City</literal> table:
+ script in a text editor and add the <literal>ENGINE</literal>
+ option to any table creation statements, or replace any existing
+ <literal>ENGINE</literal> (or <literal>TYPE</literal>) option.
+ Suppose that you have the <literal>world</literal> sample
+ database on another MySQL server that does not support MySQL
+ Cluster, and you want to export the <literal>City</literal>
+ table:
</para>
<programlisting>
@@ -1405,49 +1417,49 @@
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
-INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
-INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
-# (remaining INSERT statements omitted)
+INSERT INTO `City` VALUES (1,'Kabul','AFG','Kabol',1780000);
+INSERT INTO `City` VALUES (2,'Qandahar','AFG','Qandahar',237500);
+INSERT INTO `City` VALUES (3,'Herat','AFG','Herat',186800);
+<replaceable>(remaining INSERT statements omitted)</replaceable>
</programlisting>
<para>
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, <emphasis>before</emphasis>
- importing the table into the Cluster database, to modify its
- definition so that it reads (still using <literal>City</literal>
- as an example):
+ accomplished. One of these is to modify the table definition
+ <emphasis>before</emphasis> importing it into the Cluster
+ database. Using the <literal>City</literal> table as an example,
+ the definition would be modified as follows:
</para>
<programlisting>
-DROP TABLE IF EXISTS City;
-CREATE TABLE City (
-ID int(11) NOT NULL auto_increment,
-Name char(35) NOT NULL default '',
-CountryCode char(3) NOT NULL default '',
-District char(20) NOT NULL default '',
-Population int(11) NOT NULL default '0',
-PRIMARY KEY (ID)
-) ENGINE=NDBCLUSTER;
+DROP TABLE IF EXISTS `City`;
+CREATE TABLE `City` (
+ `ID` int(11) NOT NULL auto_increment,
+ `Name` char(35) NOT NULL default '',
+ `CountryCode` char(3) NOT NULL default '',
+ `District` char(20) NOT NULL default '',
+ `Population` int(11) NOT NULL default '0',
+ PRIMARY KEY (`ID`)
+) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1;
-INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
-INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
-INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
-# (etc.)
+INSERT INTO `City` VALUES (1,'Kabul','AFG','Kabol',1780000);
+INSERT INTO `City` VALUES (2,'Qandahar','AFG','Qandahar',237500);
+INSERT INTO `City` VALUES (3,'Herat','AFG','Herat',186800);
+<replaceable>(remaining INSERT statements omitted)</replaceable>
</programlisting>
<para>
- 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 to do a search-and-replace on the
- <filename>world.sql</filename> file and replace all instances of
+ This must be done for the definition of each table that is to be
+ part of the clustered database. The easiest way to accomplish
+ this is to do a search-and-replace on the file that contains the
+ definitions and replace all instances of
<literal>TYPE=MyISAM</literal> or
<literal>ENGINE=MyISAM</literal> with
<literal>ENGINE=NDBCLUSTER</literal>. If you do not want to
- modify the file, you can also use <literal>ALTER TABLE</literal>
- to change their type. The particulars are given later in this
- section.
+ modify the file, you can use the unmodified file to create the
+ tables, and then use <literal>ALTER TABLE</literal> to change
+ their type. The particulars are given later in this section.
</para>
<para>
@@ -1464,15 +1476,18 @@
<para>
It is very important to keep in mind that the preceding command
- must be executed on the host where the SQL node is running -- in
+ must be executed on the host where the SQL node is running (in
this case, on the machine with the IP address
- <literal>192.168.0.20</literal>.
+ <literal>192.168.0.20</literal>).
</para>
<para>
- To create a copy of the <literal>world</literal> database on the
- SQL node, save the file to
- <filename>/usr/local/mysql/data</filename>, and then run
+ To create a copy of the entire <literal>world</literal> database
+ on the SQL node, use <command>mysqldump</command> on the
+ non-cluster server to export it to a file named
+ <filename>world.sql</filename> in the
+ <filename>/usr/local/mysql/data</filename> directory. Then
+ import the file into the SQL node of the cluster like this:
</para>
<programlisting>
@@ -1481,10 +1496,8 @@
</programlisting>
<para>
- Of course, the SQL script must be readable by the
- <literal>mysql</literal> system user. If you save the file to a
- different location, adjust the preceding instructions
- accordingly.
+ If you save the file to a different location, adjust the
+ preceding instructions accordingly.
</para>
<para>
@@ -1493,7 +1506,7 @@
databases. (See <xref linkend="mysql-cluster-limitations"/>.)
This means that, once the <literal>world</literal> database and
its tables have been created on one data node, you need to issue
- the statement <literal>CREATE SCHEMA world</literal>, (beginning
+ the <literal>CREATE SCHEMA world</literal> statement (beginning
with MySQL 5.0.2, you may use <literal>CREATE SCHEMA
world</literal> instead), followed by <literal>FLUSH
TABLES</literal> on each SQL node in the cluster. This will
@@ -1505,7 +1518,9 @@
Running <literal>SELECT</literal> queries on the SQL node is no
different than running them on any other instance of a MySQL
server. To run queries from the command line, you first need to
- log in to the MySQL Monitor in the usual way:
+ log in to the MySQL Monitor in the usual way (specify the
+ <literal>root</literal> password at the <literal>Enter
+ password:</literal> prompt):
</para>
<programlisting>
@@ -1520,11 +1535,6 @@
</programlisting>
<para>
- Specify the <literal>root</literal> password at the
- <literal>Enter password:</literal> prompt.
- </para>
-
- <para>
We simply use the MySQL server's <literal>root</literal> account
and assume that you have followed the standard security
precautions for installing a MySQL server, including setting a
@@ -1718,9 +1728,9 @@
</programlisting>
<para>
- Remember <emphasis role="bold">not</emphasis> to invoke this
- command with the <option>--initial</option> option when
- restarting an NDBD node normally.
+ Remember <emphasis>not</emphasis> to invoke this command
+ with the <option>--initial</option> option when restarting
+ an NDBD node normally.
</para>
</listitem>
Modified: trunk/refman-5.1/ndbcluster.xml
===================================================================
--- trunk/refman-5.1/ndbcluster.xml 2006-02-01 18:44:17 UTC (rev 1170)
+++ trunk/refman-5.1/ndbcluster.xml 2006-02-01 18:44:30 UTC (rev 1171)
@@ -1249,7 +1249,7 @@
<listitem>
<para>
On each of the data node hosts, run this command to start
- the NDBD process for the first time:
+ the <command>ndbd</command> process for the first time:
</para>
<programlisting>
@@ -1297,7 +1297,7 @@
<programlisting>
shell> <userinput>ndb_mgm</userinput>
-- NDB Cluster -- Management Client --
-ndb_mgm> SHOW
+ndb_mgm> <userinput>SHOW</userinput>
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
@@ -1315,8 +1315,8 @@
<para>
<emphasis role="bold">Note</emphasis>: If you are using an older
version of MySQL, you may see the SQL node referenced as
- ‘<literal>[mysqld(API)]</literal>’. This reflects an
- older usage that is now deprecated.
+ <literal>[mysqld(API)]</literal>. This reflects an older usage
+ that is now deprecated.
</para>
<para>
@@ -1346,26 +1346,38 @@
<listitem>
<para>
- For a table to be replicated in the cluster, it must be
- created with the <option>ENGINE=NDB</option> or
- <option>ENGINE=NDBCLUSTER</option> table option, or else it
- must be altered after being created (using <literal>ALTER
- TABLE</literal>) to use the <literal>NDB Cluster</literal>
- storage engine.
+ For a table to be replicated in the cluster, it must use the
+ <literal>NDB Cluster</literal> storage engine. To specify
+ this, use the <option>ENGINE=NDB</option> or
+ <option>ENGINE=NDBCLUSTER</option> table option. You can add
+ this open when creating the table:
</para>
+
+<programlisting>
+CREATE TABLE <replaceable>tbl_name</replaceable> ( ... ) ENGINE=NDBCLUSTER;
+</programlisting>
+
+ <para>
+ Alternatively, for an existing table that uses a different
+ storage engine, use <literal>ALTER TABLE</literal> to change
+ the table to use <literal>NDB Cluster</literal>:
+ </para>
+
+<programlisting>
+ALTER TABLE <replaceable>tbl_name</replaceable> ENGINE=NDBCLUSTER;
+</programlisting>
</listitem>
<listitem>
<para>
- Also remember that <emphasis>each <literal>NDB</literal>
- table must have a primary key</emphasis>. If no primary key
- is defined by the user when a table is created, the
- <literal>NDB Cluster</literal> storage engine will
- automatically generate a hidden one.
+ Each <literal>NDB</literal> table <emphasis>must</emphasis>
+ have a primary key. If no primary key is defined by the user
+ when a table is created, the <literal>NDB Cluster</literal>
+ storage engine automatically generates a hidden one.
(<emphasis role="bold">Note</emphasis>: This hidden key
takes up space just as does any other table index. It is not
uncommon to encounter problems due to insufficient memory
- for accommodating these automatically created keys.)
+ for accommodating these automatically created indexes.)
</para>
</listitem>
@@ -1374,13 +1386,13 @@
<para>
If you are importing tables from an existing database using the
output of <command>mysqldump</command>, you can open the SQL
- script or scripts in a text editor and add the
- <literal>ENGINE</literal> option to any table creation
- statements, or replace any existing <literal>ENGINE</literal>
- (or <literal>TYPE</literal>) option. Suppose that you have the
- <literal>world</literal> sample database on another MySQL server
- that does not support MySQL Cluster, and you want to export the
- <literal>City</literal> table:
+ script in a text editor and add the <literal>ENGINE</literal>
+ option to any table creation statements, or replace any existing
+ <literal>ENGINE</literal> (or <literal>TYPE</literal>) option.
+ Suppose that you have the <literal>world</literal> sample
+ database on another MySQL server that does not support MySQL
+ Cluster, and you want to export the <literal>City</literal>
+ table:
</para>
<programlisting>
@@ -1405,49 +1417,49 @@
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
-INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
-INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
-# (remaining INSERT statements omitted)
+INSERT INTO `City` VALUES (1,'Kabul','AFG','Kabol',1780000);
+INSERT INTO `City` VALUES (2,'Qandahar','AFG','Qandahar',237500);
+INSERT INTO `City` VALUES (3,'Herat','AFG','Herat',186800);
+<replaceable>(remaining INSERT statements omitted)</replaceable>
</programlisting>
<para>
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, <emphasis>before</emphasis>
- importing the table into the Cluster database, to modify its
- definition so that it reads (still using <literal>City</literal>
- as an example):
+ accomplished. One of these is to modify the table definition
+ <emphasis>before</emphasis> importing it into the Cluster
+ database. Using the <literal>City</literal> table as an example,
+ the definition would be modified as follows:
</para>
<programlisting>
-DROP TABLE IF EXISTS City;
-CREATE TABLE City (
-ID int(11) NOT NULL auto_increment,
-Name char(35) NOT NULL default '',
-CountryCode char(3) NOT NULL default '',
-District char(20) NOT NULL default '',
-Population int(11) NOT NULL default '0',
-PRIMARY KEY (ID)
-) ENGINE=NDBCLUSTER;
+DROP TABLE IF EXISTS `City`;
+CREATE TABLE `City` (
+ `ID` int(11) NOT NULL auto_increment,
+ `Name` char(35) NOT NULL default '',
+ `CountryCode` char(3) NOT NULL default '',
+ `District` char(20) NOT NULL default '',
+ `Population` int(11) NOT NULL default '0',
+ PRIMARY KEY (`ID`)
+) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1;
-INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
-INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
-INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
-# (etc.)
+INSERT INTO `City` VALUES (1,'Kabul','AFG','Kabol',1780000);
+INSERT INTO `City` VALUES (2,'Qandahar','AFG','Qandahar',237500);
+INSERT INTO `City` VALUES (3,'Herat','AFG','Herat',186800);
+<replaceable>(remaining INSERT statements omitted)</replaceable>
</programlisting>
<para>
- 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 to do a search-and-replace on the
- <filename>world.sql</filename> file and replace all instances of
+ This must be done for the definition of each table that is to be
+ part of the clustered database. The easiest way to accomplish
+ this is to do a search-and-replace on the file that contains the
+ definitions and replace all instances of
<literal>TYPE=MyISAM</literal> or
<literal>ENGINE=MyISAM</literal> with
<literal>ENGINE=NDBCLUSTER</literal>. If you do not want to
- modify the file, you can also use <literal>ALTER TABLE</literal>
- to change their type. The particulars are given later in this
- section.
+ modify the file, you can use the unmodified file to create the
+ tables, and then use <literal>ALTER TABLE</literal> to change
+ their type. The particulars are given later in this section.
</para>
<para>
@@ -1464,15 +1476,18 @@
<para>
It is very important to keep in mind that the preceding command
- must be executed on the host where the SQL node is running -- in
+ must be executed on the host where the SQL node is running (in
this case, on the machine with the IP address
- <literal>192.168.0.20</literal>.
+ <literal>192.168.0.20</literal>).
</para>
<para>
- To create a copy of the <literal>world</literal> database on the
- SQL node, save the file to
- <filename>/usr/local/mysql/data</filename>, and then run
+ To create a copy of the entire <literal>world</literal> database
+ on the SQL node, use <command>mysqldump</command> on the
+ non-cluster server to export it to a file named
+ <filename>world.sql</filename> in the
+ <filename>/usr/local/mysql/data</filename> directory. Then
+ import the file into the SQL node of the cluster like this:
</para>
<programlisting>
@@ -1481,10 +1496,8 @@
</programlisting>
<para>
- Of course, the SQL script must be readable by the
- <literal>mysql</literal> system user. If you save the file to a
- different location, adjust the preceding instructions
- accordingly.
+ If you save the file to a different location, adjust the
+ preceding instructions accordingly.
</para>
<para>
@@ -1493,17 +1506,19 @@
databases. (See <xref linkend="mysql-cluster-limitations"/>.)
This means that, once the <literal>world</literal> database and
its tables have been created on one data node, you need to issue
- the statement <literal>CREATE SCHEMA world</literal>, followed
+ the <literal>CREATE SCHEMA world</literal> statement, followed
by <literal>FLUSH TABLES</literal> on each SQL node in the
- cluster. This will cause the node to recognize the database and
- read its table definitions.
+ cluster. This causes the node to recognize the database and read
+ its table definitions.
</para>
<para>
Running <literal>SELECT</literal> queries on the SQL node is no
different than running them on any other instance of a MySQL
server. To run queries from the command line, you first need to
- log in to the MySQL Monitor in the usual way:
+ log in to the MySQL Monitor in the usual way (specify the
+ <literal>root</literal> password at the <literal>Enter
+ password:</literal> prompt):
</para>
<programlisting>
@@ -1518,11 +1533,6 @@
</programlisting>
<para>
- Specify the <literal>root</literal> password at the
- <literal>Enter password:</literal> prompt.
- </para>
-
- <para>
We simply use the MySQL server's <literal>root</literal> account
and assume that you have followed the standard security
precautions for installing a MySQL server, including setting a
@@ -1716,9 +1726,9 @@
</programlisting>
<para>
- Remember <emphasis role="bold">not</emphasis> to invoke this
- command with the <option>--initial</option> option when
- restarting an NDBD node normally.
+ Remember <emphasis>not</emphasis> to invoke this command
+ with the <option>--initial</option> option when restarting
+ an NDBD node normally.
</para>
</listitem>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r1171 - in trunk: . refman-4.1 refman-5.0 refman-5.1 | paul | 1 Feb |