Rechercher dans le manuel MySQL
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 an NDB 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 NDB Cluster.
A working installation of Perl.
The
DBI
module, which can be obtained from CPAN if it is not already part of your Perl installation. (Many Linux and other operating system distributions provide their own packages for this library.)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
—wheredb_name
.*db_name
is the name of the database to be examined—is sufficient for this purpose.
ndb_size.pl
can also be found in the MySQL
sources in storage/ndb/tools
.
The following table includes options that are specific to the NDB Cluster program ndb_size.pl. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_size.pl), see Section 22.4.31, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 22.357 Command-line options for the ndb_size.pl program
Format | Description | Added, Deprecated, or Removed |
---|---|---|
The database or databases to examine; accepts a comma-delimited list; the default is ALL (use all databases found on the server) | All NDB 8.0 releases |
|
Specify host and optional port as host[:port] | All NDB 8.0 releases |
|
Specify a socket to connect to | All NDB 8.0 releases |
|
Specify a MySQL user name | All NDB 8.0 releases |
|
Specify a MySQL user password | All NDB 8.0 releases |
|
Set output format (text or HTML) | All NDB 8.0 releases |
|
Skip any tables in a comma-separated list of tables | All NDB 8.0 releases |
|
Skip any databases in a comma-separated list of databases | All NDB 8.0 releases |
|
Saves all queries to the database into the file specified | All NDB 8.0 releases |
|
Loads all queries from the file specified; does not connect to a database | All NDB 8.0 releases |
|
Designates a table to handle unique index size calculations | All NDB 8.0 releases |
Usage
perl ndb_size.pl [--database={db_name|ALL}] [--hostname=host[:port]] [--socket=socket] \
[--user=user] [--password=password] \
[--help|-h] [--format={html|text}] \
[--loadqueries=file_name] [--savequeries=file_name]
By default, this utility attempts to analyze all databases on
the server. You can specify a single database using the
--database
option; the default behavior can be
made explicit by using ALL
for the name of
the database. You can also exclude one or more databases by
using the --excludedbs
option with a
comma-separated list of the names of the databases to be
skipped. Similarly, you can cause specific tables to be skipped
by listing their names, separated by commas, following the
optional --excludetables
option. A host name
can be specified using --hostname
; the default
is localhost
. You can specify a port in
addition to the host using
host
:port
format for the value of --hostname
. The default
port number is 3306. If necessary, you can also specify a
socket; the default is /var/lib/mysql.sock
.
A MySQL user name and password can be specified the
corresponding options shown. It also possible to control the
format of the output using the --format
option;
this can take either of the values html
or
text
, with text
being the
default. An example of the text output is shown here:
shell> ndb_size.pl --database=test --socket=/tmp/mysql.sock
ndb_size.pl report for database: 'test' (1 tables)
--------------------------------------------------
Connected to: DBI:mysql:host=localhost;mysql_socket=/tmp/mysql.sock
Including information for versions: 4.1, 5.0, 5.1
test.t1
-------
DataMemory for Columns (* means varsized DataMemory):
Column Name Type Varsized Key 4.1 5.0 5.1
HIDDEN_NDB_PKEY bigint PRI 8 8 8
c2 varchar(50) Y 52 52 4*
c1 int(11) 4 4 4
-- -- --
Fixed Size Columns DM/Row 64 64 12
Varsize Columns DM/Row 0 0 4
DataMemory for Indexes:
Index Name Type 4.1 5.0 5.1
PRIMARY BTREE 16 16 16
-- -- --
Total Index DM/Row 16 16 16
IndexMemory for Indexes:
Index Name 4.1 5.0 5.1
PRIMARY 33 16 16
-- -- --
Indexes IM/Row 33 16 16
Summary (for THIS table):
4.1 5.0 5.1
Fixed Overhead DM/Row 12 12 16
NULL Bytes/Row 4 4 4
DataMemory/Row 96 96 48
(Includes overhead, bitmap and indexes)
Varsize Overhead DM/Row 0 0 8
Varsize NULL Bytes/Row 0 0 4
Avg Varside DM/Row 0 0 16
No. Rows 0 0 0
Rows/32kb DM Page 340 340 680
Fixedsize DataMemory (KB) 0 0 0
Rows/32kb Varsize DM Page 0 0 2040
Varsize DataMemory (KB) 0 0 0
Rows/8kb IM Page 248 512 512
IndexMemory (KB) 0 0 0
Parameter Minimum Requirements
------------------------------
* indicates greater than default
Parameter Default 4.1 5.0 5.1
DataMemory (KB) 81920 0 0 0
NoOfOrderedIndexes 128 1 1 1
NoOfTables 128 1 1 1
IndexMemory (KB) 18432 0 0 0
NoOfUniqueHashIndexes 64 0 0 0
NoOfAttributes 1000 3 3 3
NoOfTriggers 768 5 5 5
For debugging purposes, the Perl arrays containing the queries
run by this script can be read from the file specified using can
be saved to a file using --savequeries
; a file
containing such arrays to be read during script execution can be
specified using --loadqueries
. Neither of these
options has a default value.
To produce output in HTML format, use the
--format
option and redirect the output to a
file, as shown here:
shell> ndb_size.pl --database=test --socket=/tmp/mysql.sock --format=html > ndb_size.html
(Without the redirection, the output is sent to
stdout
.)
The output from this script includes the following information:
Minimum values for the
DataMemory
,IndexMemory
,MaxNoOfTables
,MaxNoOfAttributes
,MaxNoOfOrderedIndexes
, andMaxNoOfTriggers
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
andDataMemory
required per table and table row.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-mysql-cluster-programs-ndb-size-pl.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.