This is a Perl script that can be used to estimate the amount
of space that would be required by a MySQL database if it were
converted to use the NDBCLUSTER
storage engine. Unlike the other utilities discussed in this
section, it does not require access to a MySQL Cluster (in
fact, there is no reason for it to do so). However, it does
need to access the MySQL server on which the database to be
tested resides.
Requirements:
A running MySQL server. The server instance does not have to provide support for MySQL Cluster.
A working installation of Perl.
The DBI
and
HTML::Template
modules, both of which
can be obtained from CPAN if they are not already part of
your Perl installation. (Many Linux and other operating
system distributions provide their own packages for one or
both of these libraries.)
The ndb_size.tmpl
template file,
which you should be able to find in the
share/mysql
directory of your MySQL
installation. This file should be copied or moved into the
same directory as ndb_size.pl
—
if it is not there already — before running the
script.
A MySQL user account having the necessary privileges. If
you do not wish to use an existing account, then creating
one using GRANT USAGE ON
—
where db_name
.*db_name
is the name of
the database to be examined — is sufficient for this
purpose.
ndb_size.pl
and
ndb_size.tmpl
can also be found in the
MySQL sources in storage/ndb/tools
. If
these files are not present in your MySQL installation, you
can obtain them from the
MySQL
Forge project page.
The following table includes command options specific to the MySQL Cluster program ndb_size.pl. Additional descriptions follow the table. For options common to all MySQL Cluster programs, see Section 15.4.21, “Options Common to MySQL Cluster Programs”.
Table 15.16. ndb_size.pl Command Line Options
Format | Description | Introduction | Deprecated | Removed |
---|---|---|---|---|
--database=dbname | The databae or databases to examine; accepts a comma-delimited list; the default is ALL (use all databases found on the server) | |||
--excludedbs=db-list | Skip any databases in a comma-separated list of databases | |||
--excludetables=tbl-list | Skip any tables in a comma-separated list of tables | |||
--format=string | Set output format (text or HTML) | |||
--hostname[:port] | Specify host and optional port as host[:port] | |||
--loadqueries=file | Loads all queries from the file specified; does not connect to a database | |||
--password=string | Specify a MySQL user password | |||
--savequeries=file | Saves all queries to the database into the file specified | |||
--user=string | Specify a MySQL user name |
Usage:
perl ndb_size.pldb_name
hostname
username
password
>file_name
.html
The command shown connects to the MySQL server at
hostname
using the account of the
user username
having the password
password
, analyzes all of the
tables in database db_name
, and
generates a report in HTML format which is directed to the
file
.
(Without the redirection, the output is sent to
file_name
.htmlstdout
.) This figure shows a portion of the
generated ndb_size.html
output file, as
viewed in a Web browser:
The output from this script includes:
Minimum values for the DataMemory
,
IndexMemory
,
MaxNoOfTables
,
MaxNoOfAttributes
,
MaxNoOfOrderedIndexes
,
MaxNoOfUniqueHashIndexes
, and
MaxNoOfTriggers
configuration
parameters required to accommodate the tables analyzed.
Memory requirements for all of the tables, attributes, ordered indexes, and unique hash indexes defined in the database.
The IndexMemory
and
DataMemory
required per table and table
row.
User Comments
Add your own comment.