1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
|
'\" t
.\" Title: \fBndb_size.pl\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
.\" Date: 11/04/2013
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
.TH "\FBNDB_SIZE\&.PL\FR" "1" "11/04/2013" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" ndb_size.pl
.SH "NAME"
ndb_size.pl \- NDBCLUSTER Size Requirement Estimator
.SH "SYNOPSIS"
.HP \w'\fBndb_size\&.pl\ \fR\fB\fIarguments\fR\fR\ 'u
\fBndb_size\&.pl \fR\fB\fIarguments\fR\fR
.SH "DESCRIPTION"
.PP
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
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A running MySQL server\&. The server instance does not have to provide support for MySQL Cluster\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A working installation of Perl\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
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\&.)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Previous to MySQL 5\&.1\&.18,
\fBndb_size\&.pl\fR
also required the
HTML::Template
module and an associated template file
share/mysql/ndb_size\&.tmpl\&. Beginning with MySQL 5\&.1\&.18,
ndb_size\&.tmpl
is no longer needed (or included)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
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 \fIdb_name\fR\&.*\(emwhere
\fIdb_name\fR
is the name of the database to be examined\(emis sufficient for this purpose\&.
.RE
.PP
ndb_size\&.pl
can also be found in the MySQL sources in
storage/ndb/tools\&.
.PP
The following table includes options that are specific to the MySQL Cluster program
\fBndb_size\&.pl\fR\&. Additional descriptions follow the table\&. For options common to most MySQL Cluster programs (including
\fBndb_size\&.pl\fR), see
Options Common to MySQL Cluster Programs(1)\&.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&17.27.\ \&ndb_size\&.pl Options and Variables: MySQL 5.1, MySQL Cluster NDB 6.3-7.1
.TS
allbox tab(:);
lB lB lB.
T{
Format
T}:T{
Description
T}:T{
Added / Removed
T}
.T&
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l
l l l.
T{
.PP
--database=dbname
T}:T{
The database or databases to examine; accepts a comma\-delimited list;
the default is ALL (use all databases found on the server)
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--hostname[:port]
T}:T{
Specify host and optional port as host[:port]
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--socket=file
T}:T{
Specify a socket to connect to
T}:T{
.PP
ADDED: NDB 6\&.2\&.5
T}
T{
.PP
--user=string
T}:T{
Specify a MySQL user name
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--password=string
T}:T{
Specify a MySQL user password
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--format=string
T}:T{
Set output format (text or HTML)
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--excludetables=tbl_list
T}:T{
Skip any tables in a comma\-separated list of tables
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--excludedbs=db_list
T}:T{
Skip any databases in a comma\-separated list of databases
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--savequeries=file
T}:T{
Saves all queries to the database into the file specified
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--loadqueries=file
T}:T{
Loads all queries from the file specified; does not connect to a
database
T}:T{
.PP
All MySQL 5\&.1 based releases
T}
T{
.PP
--real_table_name=table
T}:T{
Designates a table to handle unique index size calculations
T}:T{
.PP
ADDED: NDB 6\&.2\&.5
T}
.TE
.sp 1
Usage
.sp
.if n \{\
.RS 4
.\}
.nf
perl ndb_size\&.pl [\-\-database={\fIdb_name\fR|ALL}] [\-\-hostname=\fIhost\fR[:\fIport\fR]] [\-\-socket=\fIsocket\fR] \e
[\-\-user=\fIuser\fR] [\-\-password=\fIpassword\fR] \e
[\-\-help|\-h] [\-\-format={html|text}] \e
[\-\-loadqueries=\fIfile_name\fR] [\-\-savequeries=\fIfile_name\fR]
.fi
.if n \{\
.RE
.\}
.PP
By default, this utility attempts to analyze all databases on the server\&. You can specify a single database using the
\fB\-\-database\fR
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
\fB\-\-excludedbs\fR
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
\fB\-\-excludetables\fR
option\&. A host name (and possibly a port as well) can be specified using
\fB\-\-hostname\fR; the default is
localhost\&. Beginning with MySQL Cluster NDB 6\&.3\&.49, MySQL Cluster NDB 7\&.0\&.32, and MySQL Cluster NDB 7\&.1\&.21, you can specify a port in addition to the host using
\fIhost\fR:\fIport\fR
format for the value of
\fB\-\-hostname\fR\&. 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
\fB\-\-format\fR
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:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBndb_size\&.pl \-\-database=test \-\-socket=/tmp/mysql\&.sock\fR
ndb_size\&.pl report for database: \*(Aqtest\*(Aq (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
.fi
.if n \{\
.RE
.\}
.PP
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
\fB\-\-savequeries\fR; a file containing such arrays to be read in during script execution can be specified using
\fB\-\-loadqueries\fR\&. Neither of these options has a default value\&.
.PP
To produce output in HTML format, use the
\fB\-\-format\fR
option and redirect the output to a file, as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBndb_size\&.pl \-\-database=test \-\-socket=/tmp/mysql\&.sock \-\-format=html > ndb_size\&.html\fR
.fi
.if n \{\
.RE
.\}
.PP
(Without the redirection, the output is sent to
stdout\&.)
.PP
The output from this script includes the following information:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Minimum values for the
DataMemory,
IndexMemory,
MaxNoOfTables,
MaxNoOfAttributes,
MaxNoOfOrderedIndexes,
MaxNoOfUniqueHashIndexes, and
MaxNoOfTriggers
configuration parameters required to accommodate the tables analyzed\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Memory requirements for all of the tables, attributes, ordered indexes, and unique hash indexes defined in the database\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
IndexMemory
and
DataMemory
required per table and table row\&.
.RE
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
Prior to MySQL 5\&.1\&.23, MySQL Cluster NDB 6\&.2\&.5, and MySQL Cluster NDB 6\&.3\&.7,
ndb_size\&.pl
was invoked as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
perl ndb_size\&.pl \fIdb_name\fR \fIhostname\fR \fIusername\fR \fIpassword\fR > \fIfile_name\fR\&.html
.fi
.if n \{\
.RE
.\}
.PP
For more information about this change, see Bug #28683 and Bug #28253\&.
.sp .5v
.RE
.SH "COPYRIGHT"
.br
.PP
Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).
|