ndb_drop_index 从 NDB 表中删除指定的索引。建议仅将此实用程序用作编写 NDB API 应用程序的示例—请参阅本节中的警告以获取详细信息。
使用
ndb_drop_index -c connection_string table_name index -d db_name
上面的语句从 database 中的 table 中删除名为 index 的索引。
可以与 ndb_drop_index 一起使用的选项如下表所示。下表后面是详细描述。
表 25.31 与程序 ndb_drop_index 一起使用的命令行选项
| Format | Description | Added, Deprecated, or Removed |
|---|---|---|
| 在放弃之前重试连接的次数 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 在尝试联系管理服务器之间等待的秒数 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 与 --ndb-connectstring 相同 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
|
|
表所在的数据库的名称 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
| 在读取全局文件后读取给定的文件 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 仅从给定的文件中读取默认选项 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 也读取带有 concat(group, suffix) 的组 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 显示帮助文本并退出 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 从登录文件中读取给定的路径 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 不从登录路径文件中读取登录路径 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 设置连接字符串以连接到 ndb_mgmd。语法:"[nodeid=id;][host=]hostname[:port]"。覆盖 NDB_CONNECTSTRING 和 my.cnf 中的条目 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| ndb_mgm 客户端 TLS 要求级别 |
添加于:8.3.0 |
|
| 与 --ndb-connectstring 相同 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 设置该节点的节点 ID,覆盖 --ndb-connectstring 设置的 ID |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 包含 TLS 密钥和证书的目录列表 |
添加于:8.3.0 |
|
| 不从任何选项文件中读取默认选项,除了登录文件 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 打印程序参数列表并退出 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 显示帮助文本并退出;同 --help |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
|
| 显示版本信息并退出 |
(在所有基于 MySQL 8.3 的 NDB 版本中支持) |
-
Command-Line Format --character-sets-dir=路径包含字符集的目录。
-
Command-Line Format --connect-retries=整数Type 整数 Default Value 12Minimum Value 0Maximum Value 12在放弃之前尝试连接的次数。
-
Command-Line Format --connect-retry-delay=整数Type 整数 Default Value 5Minimum Value 0Maximum Value 5在尝试联系管理服务器之间等待的秒数。
-
Command-Line Format --connect-string=连接字符串Type 字符串 Default Value [none]与
--ndb-connectstring相同。 -
Command-Line Format --core-file在错误时写入核心文件;用于调试。
-
--database,-dCommand-Line Format --database=名称Type 字符串 Default Value TEST_DB表所在的数据库名称。
-
Command-Line Format --defaults-extra-file=路径Type 字符串 Default Value [none]在读取全局文件后读取给定的文件。
-
Command-Line Format --defaults-file=路径Type 字符串 Default Value [none]仅从给定的文件中读取默认选项。
-
Command-Line Format --defaults-group-suffix=字符串Type 字符串 Default Value [none]还读取带有后缀的组。
-
Command-Line Format --help显示帮助文本并退出。
-
Command-Line Format --login-path=路径Type 字符串 Default Value [none]从登录文件中读取给定的路径。
-
Command-Line Format --no-login-paths跳过从登录路径文件中读取选项。
-
Command-Line Format --ndb-connectstring=连接字符串Type 字符串 Default Value [none]设置连接到 ndb_mgmd 的连接字符串。语法:
[nodeid=。覆盖id;][host=]主机名[:端口]NDB_CONNECTSTRING和my.cnf中的条目。 -
Command-Line Format --ndb-mgm-tls=级别Type 枚举 Default Value relaxedValid Values relaxedstrict设置连接到管理服务器所需的 TLS 级别;可以是
relaxed或strict。relaxed(默认) 表示尝试 TLS 连接,但不要求成功;strict表示需要 TLS 连接。 -
Command-Line Format --ndb-mgmd-host=连接字符串Type 字符串 Default Value [none]与
--ndb-connectstring相同。 -
Command-Line Format --ndb-nodeid=#Type 整数 Default Value [none]设置当前节点的节点 ID,覆盖
--ndb-connectstring中的 ID。 -
--ndb-optimized-node-selectionCommand-Line Format --ndb-optimized-node-selection启用事务节点选择的优化。默认启用;使用
--skip-ndb-optimized-node-selection禁用。 -
Command-Line Format --ndb-tls-search-path=列表Type 路径名 Default Value (Unix) $HOME/ndb-tlsDefault Value (Windows) $HOMEDIR/ndb-tls指定要搜索的CA文件的目录列表。在 Unix 平台上,目录名称以冒号 (
:) 分隔;在 Windows 系统上,使用分号字符 (;) 作为分隔符。目录引用可以是相对的或绝对的;它可以包含一个或多个环境变量,每个变量以美元符号 ($) 开头,并在使用前展开。搜索从左到右进行,直到找到文件。空字符串表示空搜索路径,导致所有搜索失败。点 (
.) 表示搜索路径仅限于当前工作目录。如果没有提供搜索路径,将使用编译时的默认值。该值取决于平台:在 Windows 上是
\ndb-tls;在其他平台(包括 Linux)上是$HOME/ndb-tls。这可以通过使用-DWITH_NDB_TLS_SEARCH_PATH编译 NDB 集群来覆盖。 -
Command-Line Format --no-defaults不要从任何选项文件中读取默认选项,除了登录文件。
-
Command-Line Format --print-defaults打印程序参数列表并退出。
-
Command-Line Format --usage显示帮助文本并退出;与
--help相同。 -
Command-Line Format --version显示版本信息并退出。
使用 NDB API 在集群表索引上的操作对 MySQL 是不可见的,并使表对 MySQL 服务器不可用。如果您使用该程序删除索引,然后尝试从 SQL 节点访问表,将出现错误,如下所示:
$> ./ndb_drop_index -c localhost dogs ix -d ctest1
Dropping index dogs/idx...OK
NDBT_ProgramExit: 0 - OK
$> ./mysql -u jon -p ctest1
Enter password: *******
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 5.7.44-ndb-7.5.32
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> SHOW TABLES;
+------------------+
| Tables_in_ctest1 |
+------------------+
| a |
| bt1 |
| bt2 |
| dogs |
| employees |
| fish |
+------------------+
6 rows in set (0.00 sec)
mysql> SELECT * FROM dogs;
ERROR 1296 (HY000): Got error 4243 'Index not found' from NDBCLUSTER
在这种情况下,您的 唯一 选项是删除表并重新创建它。您可以使用 SQL 语句DROP TABLE 或 ndb_drop_table 实用程序(见 第 25.5.11 节,“ndb_drop_table — 删除 NDB 表”)来删除表。