You are here: Home Docs MySQL NDB API

The MySQL Cluster API Developer Guide

by Bryan Hinton last modified Jul 03, 2009 05:16 PM

Version 2.0 (2009-06-11)

Copyright 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc.

This documentation is NOT distributed under a GPL license. Use of this documentation is subject to the following terms: You may create a printed copy of this documentation solely for your own personal use. Conversion to other formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish or distribute this documentation in any form or on any media, except if you distribute the documentation in a manner similar to how Sun disseminates it (that is, electronically for download on a Web site with the software) or on a CD-ROM or similar medium, provided however that the documentation is disseminated together with the software on the same medium. Any other use, such as any dissemination of printed copies or use of this documentation, in whole or in part, in another publication, requires the prior written consent from an authorized representative of Sun Microsystems, Inc. Sun Microsystems, Inc. and MySQL AB reserve any and all rights to this documentation not expressly granted above.

For more information on the terms of this license, for details on how the MySQL documentation is built and produced, or if you are interested in doing a translation, please contact the Documentation Team.

If you want help with using MySQL, please visit either the MySQL Forums or MySQL Mailing Lists where you can discuss your issues with other MySQL users.

For additional documentation on MySQL products, including translations of the documentation into other languages, and downloadable versions in variety of formats, including HTML, CHM, and PDF formats, see MySQL Documentation Library.

The MySQL Cluster API Developer Guide

Document generated on: 2009-06-11 (revision: 15304)

This guide provides information for developers wishing to use: The low-level C/C++-language NDB API for the MySQL NDBCLUSTER storage engine, the C-language MGM API for communicating with and controlling MySQL Cluster management servers, and other APIs used with MySQL in the context of MySQL Cluster. This Guide includes concepts, terminology, class and function references, practical examples, common problems, and tips for using these APIs in applications. It also contains information about NDB internals that may be of interest to developers working with NDBCLUSTER, such as communication protocols employed between nodes, filesystems used by data nodes, and error messages.

The information presented in this guide is current for recent MySQL Cluster NDB 6.2, NDB 6.3, and NDB 7.0 releases. You should be aware that there have been significant changes in the NDB API, MGM API, and other particulars in MySQL Cluster versions since MySQL 5.1.12.


Table of Contents

1. Overview and Concepts
1.1. Introduction
1.1.1. The NDB API
1.1.2. The MGM API
1.2. Terminology
1.3. The NDBCLUSTER Transaction and Scanning API
1.3.1. Core NDB API Classes
1.3.2. Application Program Basics
1.3.3. Review of MySQL Cluster Concepts
1.3.4. The Adaptive Send Algorithm
2. The NDB API
2.1. Getting Started with the NDB API
2.1.1. Compiling and Linking NDB API Programs
2.1.2. Connecting to the Cluster
2.1.3. Mapping MySQL Database Object Names and Types to NDB
2.2. The NDB API Object Hierarachy
2.3. NDB API Classes, Interfaces, and Structures
2.3.1. The Column Class
2.3.2. The Datafile Class
2.3.3. The Dictionary Class
2.3.4. The Event Class
2.3.5. The Index Class
2.3.6. The LogfileGroup Class
2.3.7. The List Class
2.3.8. The Ndb Class
2.3.9. The NdbBlob Class
2.3.10. The NdbDictionary Class
2.3.11. The NdbEventOperation Class
2.3.12. The NdbIndexOperation Class
2.3.13. The NdbIndexScanOperation Class
2.3.14. The NdbInterpretedCode Class
2.3.15. The NdbOperation Class
2.3.16. The NdbRecAttr Class
2.3.17. The NdbScanFilter Class
2.3.18. The NdbScanOperation Class
2.3.19. The NdbTransaction Class
2.3.20. The Object Class
2.3.21. The Table Class
2.3.22. The Tablespace Class
2.3.23. The Undofile Class
2.3.24. The Ndb_cluster_connection Class
2.3.25. The NdbRecord Interface
2.3.26. The AutoGrowSpecification Structure
2.3.27. The Element Structure
2.3.28. The IndexBound Structure
2.3.29. The Key_part_ptr Structure
2.3.30. The NdbError Structure
2.3.31. The PartitionSpec Structure
2.3.32. The RecordSpecification Structure
2.4. Practical Examples
2.4.1. Using Synchronous Transactions
2.4.2. Using Synchronous Transactions and Multiple Clusters
2.4.3. Handling Errors and Retrying Transactions
2.4.4. Basic Scanning Example
2.4.5. Using Secondary Indexes in Scans
2.4.6. Using NdbRecord with Hash Indexes
2.4.7. NDB API Event Handling Example
2.4.8. Event Handling with Multiple Clusters
2.4.9. Basic BLOB Handling Example
2.4.10. Handling BLOBs Using NdbRecord
3. The MGM API
3.1. General Concepts
3.1.1. Working with Log Events
3.1.2. Structured Log Events
3.2. MGM C API Function Listing
3.2.1. Log Event Functions
3.2.2. MGM API Error Handling Functions
3.2.3. Management Server Handle Functions
3.2.4. Management Server Connection Functions
3.2.5. Cluster Status Functions
3.2.6. Functions for Starting & Stopping Nodes
3.2.7. Cluster Log Functions
3.2.8. Backup Functions
3.2.9. Single-User Mode Functions
3.3. MGM Datatypes
3.3.1. The ndb_mgm_node_type Type
3.3.2. The ndb_mgm_node_status Type
3.3.3. The ndb_mgm_error Type
3.3.4. The Ndb_logevent_type Type
3.3.5. The ndb_mgm_event_severity Type
3.3.6. The ndb_logevent_handle_error Type
3.3.7. The ndb_mgm_event_category Type
3.4. MGM Structures
3.4.1. The ndb_logevent Structure
3.4.2. The ndb_mgm_node_state Structure
3.4.3. The ndb_mgm_cluster_state Structure
3.4.4. The ndb_mgm_reply Structure
4. MySQL Cluster API Errors
4.1. MGM API Errors
4.1.1. Request Errors
4.1.2. Node ID Allocation Errors
4.1.3. Service Errors
4.1.4. Backup Errors
4.1.5. Single User Mode Errors
4.1.6. General Usage Errors
4.2. NDB API Errors and Error Handling
4.2.1. Handling NDB API Errors
4.2.2. NDB Error Codes and Messages
4.2.3. NDB Error Classifications
4.3. ndbd Error Messages
4.3.1. ndbd Error Codes
4.3.2. ndbd Error Classifications
4.4. NDB Transporter Errors
5. MySQL Cluster Internals
5.1. MySQL Cluster File Systems
5.1.1. Cluster Data Node File System
5.1.2. Cluster Management Node File System
5.2. DUMP Commands
5.2.1. DUMP Codes 1 to 999
5.2.2. DUMP Codes 1000 to 1999
5.2.3. DUMP Codes 2000 to 2999
5.2.4. DUMP Codes 3000 to 3999
5.2.5. DUMP Codes 4000 to 4999
5.2.6. DUMP Codes 5000 to 5999
5.2.7. DUMP Codes 6000 to 6999
5.2.8. DUMP Codes 7000 to 7999
5.2.9. DUMP Codes 8000 to 8999
5.2.10. DUMP Codes 9000 to 9999
5.2.11. DUMP Codes 10000 to 10999
5.2.12. DUMP Codes 11000 to 11999
5.2.13. DUMP Codes 12000 to 12999
5.3. The NDB Protocol
5.3.1. NDB Protocol Overview
5.3.2. Message Naming Conventions and Structure
5.3.3. Operations and Signals
5.4. NDB Kernel Blocks
5.4.1. The BACKUP Block
5.4.2. The CMVMI Block
5.4.3. The DBACC Block
5.4.4. The DBDICT Block
5.4.5. The DBDIH Block
5.4.6. DBLQH Block
5.4.7. The DBTC Block
5.4.8. The DBTUP Block
5.4.9. DBTUX Block
5.4.10. The DBUTIL Block
5.4.11. The LGMAN Block
5.4.12. The NDBCNTR Block
5.4.13. The NDBFS Block
5.4.14. The PGMAN Block
5.4.15. The QMGR Block
5.4.16. The RESTORE Block
5.4.17. The SUMA Block
5.4.18. The TSMAN Block
5.4.19. The TRIX Block
5.5. MySQL Cluster Start Phases
5.5.1. Initialization Phase (Phase -1)
5.5.2. Configuration Read Phase (STTOR Phase -1)
5.5.3. STTOR Phase 0
5.5.4. STTOR Phase 1
5.5.5. STTOR Phase 2
5.5.6. NDB_STTOR Phase 1
5.5.7. STTOR Phase 3
5.5.8. NDB_STTOR Phase 2
5.5.9. STTOR Phase 4
5.5.10. NDB_STTOR Phase 3
5.5.11. STTOR Phase 5
5.5.12. NDB_STTOR Phase 4
5.5.13. NDB_STTOR Phase 5
5.5.14. NDB_STTOR Phase 6
5.5.15. STTOR Phase 6
5.5.16. STTOR Phase 7
5.5.17. STTOR Phase 8
5.5.18. NDB_STTOR Phase 7
5.5.19. STTOR Phase 9
5.5.20. STTOR Phase 101
5.5.21. System Restart Handling in Phase 4
5.5.22. START_MEREQ Handling
5.6. NDB Internals Glossary
Index
Document Actions