21.4.11 ndb_drop_index — NDBtable 中的删除索引
ndb_drop_index从NDBtable 中删除指定的索引。 建议您仅将此 Util 用作编写 NDB API 应用程序的示例 —有关详细信息,请参阅本节后面的警告。
Usage
ndb_drop_index -c connection_string table_name index -d db_name
上面显示的语句从* database
中的 table
中删除了名为 index
*的索引。
下 table 包含特定于ndb_drop_index的选项。附加说明如下 table 所示。有关大多数 NDB 群集程序(包括ndb_drop_index)共有的选项,请参见第 21.4.32 节“ NDB 群集程序的公用选项-NDB 群集程序的公用选项”。
table21.247 ndb_drop_index 程序的命令行选项
Format | Description | 添加,不建议使用或删除 |
---|---|---|
--database=dbname , | ||
-d | 在其中找到 table 的数据库名称 | (在所有基于 MySQL 5.7 的版本中受支持) |
Warning
使用 NDB API 对群集 table 索引执行的操作对 MySQL 不可见,并使该 table 无法被 MySQL 服务器使用。如果使用此程序删除索引,请尝试从 SQL 节点访问 table,从而导致错误,如下所示:
shell> ./ndb_drop_index -c localhost dogs ix -d ctest1
Dropping index dogs/idx...OK
NDBT_ProgramExit: 0 - OK
shell> ./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.31-ndb-7.5.20
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
在这种情况下,使 table 再次对 MySQL 可用的* only *选项是删除 table 并重新创建它。您可以使用 SQL 语句DROP TABLE或ndb_drop_tableUtil(请参见第 21.4.12 节“ ndb_drop_table-删除 NDBtable”)删除 table。