文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 25 MySQL NDB 集群 8.4 / 25.5 NDB 集群程序 / 25.5.13 ndb_import — 将 CSV 数据导入 NDB
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 74%

25.5.13 ndb_import — 将 CSV 数据导入 NDB25.5.13 ndb_import — Import CSV Data Into NDB

ndb_import 将 CSV 格式的数据(例如由 mysqldump --tab 生成的数据)直接导入 NDB,使用 NDB API。ndb_import 需要连接到 NDB 管理服务器 (ndb_mgmd) 才能工作;它不需要连接到 MySQL 服务器。ndb_import imports CSV-formatted data, such as that produced by mysqldump --tab, directly into NDB using the NDB API. ndb_import requires a connection to an NDB management server (ndb_mgmd) to function; it does not require a connection to a MySQL Server.

用法Usage

ndb_import db_name file_name options

ndb_import 需要两个参数。db_name 是要导入数据的表所在的数据库名称;file_name 是要读取数据的 CSV 文件名;如果该文件不在当前目录下,则必须包括该文件的路径。文件名必须与表名匹配;文件的扩展名(如果有)不予考虑。ndb_import 支持的选项包括用于指定字段分隔符、转义符和行终止符的选项,这些将在本节后面进行描述。ndb_import requires two arguments. db_name is the name of the database where the table into which to import the data is found; file_name is the name of the CSV file from which to read the data; this must include the path to this file if it is not in the current directory. The name of the file must match that of the table; the file's extension, if any, is not taken into consideration. Options supported by ndb_import include those for specifying field separators, escapes, and line terminators, and are described later in this section.

ndb_import 会拒绝从 CSV 文件中读取的任何空行,除非在导入单列数据时,此时可以使用空值作为列值。ndb_import 处理此情况的方式与 LOAD DATA 语句相同。ndb_import rejects any empty lines which it reads from the CSV file, except when importing a single column, in which case an empty value can be used as the column value. ndb_import handles this in the same manner as a LOAD DATA statement does.

ndb_import 必须能够连接到 NDB 集群管理服务器;因此,集群 config.ini 文件中必须有一个未使用的 [api] 插槽。ndb_import must be able to connect to an NDB Cluster management server; for this reason, there must be an unused [api] slot in the cluster config.ini file.

要将使用不同存储引擎的现有表(例如 InnoDB)复制为 NDB 表,请使用 mysql 客户端执行 SELECT INTO OUTFILE 语句将现有表导出为 CSV 文件,然后执行 CREATE TABLE LIKE 语句以创建具有与现有表相同结构的新表,再对新表执行 ALTER TABLE ... ENGINE=NDB;之后,从系统命令行调用 ndb_import 将数据加载到新的 NDB 表中。例如,数据库 myinnodb 中的现有 InnoDB 表名为 myinnodb_table,可以导出到数据库 myndb 中的 NDB 表名为 myndb_table,如下所示,假设您已经以具有适当权限的 MySQL 用户身份登录:To duplicate an existing table that uses a different storage engine, such as InnoDB, as an NDB table, use the mysql client to perform a SELECT INTO OUTFILE statement to export the existing table to a CSV file, then to execute a CREATE TABLE LIKE statement to create a new table having the same structure as the existing table, then perform ALTER TABLE ... ENGINE=NDB on the new table; after this, from the system shell, invoke ndb_import to load the data into the new NDB table. For example, an existing InnoDB table named myinnodb_table in a database named myinnodb can be exported into an NDB table named myndb_table in a database named myndb as shown here, assuming that you are already logged in as a MySQL user with the appropriate privileges:

  1. 在 mysql 客户端:In the mysql client:

    mysql> USE myinnodb;
    
    mysql> SELECT * INTO OUTFILE '/tmp/myndb_table.csv'
         >  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
         >  LINES TERMINATED BY '\n'
         >  FROM myinnodbtable;
    
    mysql> CREATE DATABASE myndb;
    
    mysql> USE myndb;
    
    mysql> CREATE TABLE myndb_table LIKE myinnodb.myinnodb_table;
    
    mysql> ALTER TABLE myndb_table ENGINE=NDB;
    
    mysql> EXIT;
    Bye
    $>
    

    一旦目标数据库和表已经创建,运行中的 mysqld 就不再需要。您可以在继续之前使用 mysqladmin shutdown 或其他方法停止它,如果您愿意的话。Once the target database and table have been created, a running mysqld is no longer required. You can stop it using mysqladmin shutdown or another method before proceeding, if you wish.

  2. 在系统终端:In the system shell:

    # if you are not already in the MySQL bin directory:
    $> cd path-to-mysql-bin-dir
    
    $> ndb_import myndb /tmp/myndb_table.csv --fields-optionally-enclosed-by='"' \
        --fields-terminated-by="," --fields-escaped-by='\\'
    

    输出应类似于此处显示的内容:The output should resemble what is shown here:

    job-1 import myndb.myndb_table from /tmp/myndb_table.csv
    job-1 [running] import myndb.myndb_table from /tmp/myndb_table.csv
    job-1 [success] import myndb.myndb_table from /tmp/myndb_table.csv
    job-1 imported 19984 rows in 0h0m9s at 2277 rows/s
    jobs summary: defined: 1 run: 1 with success: 1 with failure: 0
    $>
    

下表显示了可以与ndb_import一起使用的所有选项。表格后面有附加说明。All options that can be used with ndb_import are shown in the following table. Additional descriptions follow the table.

  • --abort-on-error

    命令行格式Command-Line Format --abort-on-error

    在任何致命错误时生成核心转储;仅用于调试。Dump core on any fatal error; used for debugging only.

  • --ai-increment=#

    命令行格式Command-Line Format --ai-increment=#
    类型Type 整数Integer
    默认值Default Value 1
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    对于具有隐藏主键的表,指定自增长步长,就像 MySQL 服务器中的 auto_increment_increment 系统变量所做的那样。For a table with a hidden primary key, specify the autoincrement increment, like the auto_increment_increment system variable does in the MySQL Server.

  • --ai-offset=#

    命令行格式Command-Line Format --ai-offset=#
    类型Type 整数Integer
    默认值Default Value 1
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    对于具有隐藏主键的表,指定自增长偏移量。类似于 auto_increment_offset 系统变量。For a table with hidden primary key, specify the autoincrement offset. Similar to the auto_increment_offset system variable.

  • --ai-prefetch-sz=#

    命令行格式Command-Line Format --ai-prefetch-sz=#
    类型Type 整数Integer
    默认值Default Value 1024
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    对于具有隐藏主键的表,指定预取的自增值的数量。其行为类似于 MySQL 服务器中的 ndb_autoincrement_prefetch_sz 系统变量。For a table with a hidden primary key, specify the number of autoincrement values that are prefetched. Behaves like the ndb_autoincrement_prefetch_sz system variable does in the MySQL Server.

  • --character-sets-dir

    命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path

    包含字符集的目录。Directory containing character sets.

  • --connections=#

    命令行格式Command-Line Format --connections=#
    类型Type 整数Integer
    默认值Default Value 1
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    要创建的集群连接数。Number of cluster connections to create.

  • --connect-retries

    命令行格式Command-Line Format --connect-retries=#
    类型Type 整数Integer
    默认值Default Value 12
    最小值Minimum Value 0
    最大值Maximum Value 12

    放弃之前重试连接的次数。Number of times to retry connection before giving up.

  • --connect-retry-delay

    命令行格式Command-Line Format --connect-retry-delay=#
    类型Type 整数Integer
    默认值Default Value 5
    最小值Minimum Value 0
    最大值Maximum Value 5

    尝试联系管理服务器之间等待的秒数。Number of seconds to wait between attempts to contact management server.

  • --connect-string

    命令行格式Command-Line Format --connect-string=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    同 --ndb-connectstring。Same as --ndb-connectstring.

  • --continue

    命令行格式Command-Line Format --continue

    当某个作业失败时,继续下一个作业。When a job fails, continue to the next job.

  • --core-file

    命令行格式Command-Line Format --core-file

    错误时生成核心文件;用于调试。Write core file on error; used in debugging.

  • --csvopt=string

    命令行格式Command-Line Format --csvopt=opts
    类型Type 字符串String
    默认值Default Value [none][none]

    提供了一种设置典型 CSV 导入选项的快捷方法。此选项的参数是由下列一个或多个参数组成的字符串:Provides a shortcut method for setting typical CSV import options. The argument to this option is a string consisting of one or more of the following parameters:

    • c:字段以逗号分隔c: Fields terminated by comma

    • d:使用默认值,除非被其他参数覆盖d: Use defaults, except where overridden by another parameter

    • n:行以 \n 结尾n: Lines terminated by \n

    • q:字段可选地被双引号字符 (") 包围q: Fields optionally enclosed by double quote characters (")

    • r:行以 \r 结尾r: Line terminated by \r

    此选项参数中使用的参数顺序处理方式为最右侧的参数始终优先于已在相同参数值中使用的任何可能冲突的参数。这同样适用于给定参数的任何重复实例。The order of parameters used in the argument to this option is handled such that the rightmost parameter always takes precedence over any potentially conflicting parameters which have already been used in the same argument value. This also applies to any duplicate instances of a given parameter.

    此选项用于在传输转义字符或引号困难的条件下进行测试。This option is intended for use in testing under conditions in which it is difficult to transmit escapes or quotation marks.

  • --db-workers=#

    命令行格式Command-Line Format --db-workers=#
    类型Type 整数Integer
    默认值Default Value 4
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    每个数据节点执行数据库操作的线程数。Number of threads, per data node, executing database operations.

  • --defaults-file

    命令行格式Command-Line Format --defaults-file=path
    类型Type 字符串String
    默认值Default Value [none][none]

    仅从指定文件读取默认选项。Read default options from given file only.

  • --defaults-extra-file

    命令行格式Command-Line Format --defaults-extra-file=path--defaults-extra-file=path
    类型Type 字符串String
    默认值Default Value [none][none]

    在读取全局文件之后读取给定文件。Read given file after global files are read.

  • --defaults-group-suffix

    命令行格式Command-Line Format --defaults-group-suffix=string
    类型Type 字符串String
    默认值Default Value [none][none]

    也读取组合了 concat(group, suffix) 的组。Also read groups with concat(group, suffix).

  • --errins-type=name

    命令行格式Command-Line Format --errins-type=name
    类型Type 枚举Enumeration
    默认值Default Value [none][none]
    有效值Valid Values

    stopjob

    stopall

    sighup

    sigint

    list

    错误插入类型;使用 list 作为 name 的值以获取所有可能的值。此选项仅用于测试目的。Error insert type; use list as the name value to obtain all possible values. This option is used for testing purposes only.

  • --errins-delay=#

    命令行格式Command-Line Format --errins-delay=#
    类型Type 整数Integer
    默认值Default Value 1000
    最小值Minimum Value 0
    最大值Maximum Value 4294967295
    单位Unit 毫秒ms

    错误插入延迟(毫秒);会添加随机变化。此选项仅用于测试目的。Error insert delay in milliseconds; random variation is added. This option is used for testing purposes only.

  • --fields-enclosed-by=char

    命令行格式Command-Line Format --fields-enclosed-by=char
    类型Type 字符串String
    默认值Default Value [none][none]

    这与 FIELDS ENCLOSED BY 选项在 LOAD DATA 语句中的作用相同,用于指定一个字符来作为字段值的引号。对于 CSV 输入,这与 --fields-optionally-enclosed-by 相同。This works in the same way as the FIELDS ENCLOSED BY option does for the LOAD DATA statement, specifying a character to be interpreted as quoting field values. For CSV input, this is the same as --fields-optionally-enclosed-by.

  • --fields-escaped-by=name

    命令行格式Command-Line Format --fields-escaped-by=char
    类型Type 字符串String
    默认值Default Value \

    以与 SQL LOAD DATA 语句中的 FIELDS ESCAPED BY 选项相同的方式指定转义字符。Specify an escape character in the same way as the FIELDS ESCAPED BY option does for the SQL LOAD DATA statement.

  • --fields-optionally-enclosed-by=char

    命令行格式Command-Line Format --fields-optionally-enclosed-by=char
    类型Type 字符串String
    默认值Default Value [none][none]

    这与 FIELDS OPTIONALLY ENCLOSED BY 选项在 LOAD DATA 语句中的作用相同,指定一个字符被解释为可选地引用字段值。对于 CSV 输入,这与 --fields-enclosed-by 相同。This works in the same way as the FIELDS OPTIONALLY ENCLOSED BY option does for the LOAD DATA statement, specifying a character to be interpreted as optionally quoting field values. For CSV input, this is the same as --fields-enclosed-by.

  • --fields-terminated-by=char

    命令行格式Command-Line Format --fields-terminated-by=char
    类型Type 字符串String
    默认值Default Value \t

    这与 FIELDS TERMINATED BY 选项在 LOAD DATA 语句中的作用相同,用于指定一个字符作为字段分隔符。This works in the same way as the FIELDS TERMINATED BY option does for the LOAD DATA statement, specifying a character to be interpreted as the field separator.

  • --help

    命令行格式Command-Line Format --help--help

    显示帮助文本并退出。Display help text and exit.

  • --idlesleep=#

    命令行格式Command-Line Format --idlesleep=#
    类型Type 整数Integer
    默认值Default Value 1
    最小值Minimum Value 1
    最大值Maximum Value 4294967295
    单位Unit 毫秒ms

    等待执行更多工作时的休眠毫秒数。Number of milliseconds to sleep waiting for more work to perform.

  • --idlespin=#

    命令行格式Command-Line Format --idlespin=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 4294967295

    在休眠之前重试的次数。Number of times to retry before sleeping.

  • --ignore-lines=#

    命令行格式Command-Line Format --ignore-lines=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 4294967295

    使 ndb_import 忽略输入文件的前 # 行。可用于跳过不包含任何数据的文件头。Cause ndb_import to ignore the first # lines of the input file. This can be employed to skip a file header that does not contain any data.

  • --input-type=name

    命令行格式Command-Line Format --input-type=name
    类型Type 枚举Enumeration
    默认值Default Value csv
    有效值Valid Values

    randomrandom

    csv

    设置输入类型。默认值为 csv;random 仅用于测试目的。Set the type of input type. The default is csv; random is intended for testing purposes only. .

  • --input-workers=#

    命令行格式Command-Line Format --input-workers=#
    类型Type 整数Integer
    默认值Default Value 4
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    设置处理输入的线程数量。Set the number of threads processing input.

  • --keep-state

    命令行格式Command-Line Format --keep-state

    默认情况下,ndb_import 在完成作业后会删除所有状态文件(非空的 *.rej 文件除外)。指定此选项(不需要参数)以强制程序保留所有状态文件。By default, ndb_import removes all state files (except non-empty *.rej files) when it completes a job. Specify this option (nor argument is required) to force the program to retain all state files instead.

  • --lines-terminated-by=name

    命令行格式Command-Line Format --lines-terminated-by=char
    类型Type 字符串String
    默认值Default Value \n

    这与 LINES TERMINATED BY 选项在 LOAD DATA 语句中所起的作用相同,用于指定一个字符作为行结束符。This works in the same way as the LINES TERMINATED BY option does for the LOAD DATA statement, specifying a character to be interpreted as end-of-line.

  • --log-level=#

    命令行格式Command-Line Format --log-level=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 2

    在指定级别执行内部日志记录。此选项主要用于内部和开发用途。Performs internal logging at the given level. This option is intended primarily for internal and development use.

    仅在 NDB 的调试版本中,日志级别可以使用此选项设置,最高可达 4。In debug builds of NDB only, the logging level can be set using this option to a maximum of 4.

  • --login-path

    命令行格式Command-Line Format --login-path=path
    类型Type 字符串String
    默认值Default Value [none][none]

    从登录文件读取给定路径。Read given path from login file.

  • --no-login-paths

    命令行格式Command-Line Format --no-login-paths

    跳过从登录路径文件读取选项。Skips reading options from the login path file.

  • --max-rows=#

    命令行格式Command-Line Format --max-rows=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 4294967295
    单位Unit 字节bytes

    仅导入此数量的输入数据行;默认值为 0,表示导入所有行。Import only this number of input data rows; the default is 0, which imports all rows.

  • --missing-ai-column

    命令行格式Command-Line Format --missing-ai-column='name'
    类型Type 布尔Boolean
    默认值Default Value FALSE

    当导入单个表或多个表时,可以使用此选项。使用时,它表示正在导入的 CSV 文件不包含 AUTO_INCREMENT 列的任何值,并且 ndb_import 应该提供这些值;如果使用该选项,而 AUTO_INCREMENT 列包含任何值,则无法继续导入操作。This option can be employed when importing a single table, or multiple tables. When used, it indicates that the CSV file being imported does not contain any values for an AUTO_INCREMENT column, and that ndb_import should supply them; if the option is used and the AUTO_INCREMENT column contains any values, the import operation cannot proceed.

  • --monitor=#

    命令行格式Command-Line Format --monitor=#
    类型Type 整数Integer
    默认值Default Value 2
    最小值Minimum Value 0
    最大值Maximum Value 4294967295
    单位Unit 字节bytes

    如果有任何变化(状态、被拒绝的行、临时错误),定期打印正在运行的作业的状态。设置为 0 可禁用此报告。设置为 1 会打印任何观察到的变化。更高的值会减少状态报告的频率。Periodically print the status of a running job if something has changed (status, rejected rows, temporary errors). Set to 0 to disable this reporting. Setting to 1 prints any change that is seen. Higher values reduce the frequency of this status reporting.

  • --ndb-connectstring

    命令行格式Command-Line Format --ndb-connectstring=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    设置用于连接到 ndb_mgmd 的连接字符串。语法:[nodeid=id;][host=]hostname[:port]。覆盖 NDB_CONNECTSTRING 和 my.cnf 中的条目。Set connection string for connecting to ndb_mgmd. Syntax: [nodeid=id;][host=]hostname[:port]. Overrides entries in NDB_CONNECTSTRING and my.cnf.

  • --ndb-mgm-tls

    命令行格式Command-Line Format --ndb-mgm-tls=level
    类型Type 枚举Enumeration
    默认值Default Value relaxedrelaxed
    有效值Valid Values

    relaxedrelaxed

    strictstrict

    设置连接到管理服务器所需的 TLS 支持级别;可以是 relaxed 或 strict。relaxed(默认)表示尝试建立 TLS 连接,但不要求成功;strict表示连接必须使用 TLS。Sets the level of TLS support required to connect to the management server; one of relaxed or strict. relaxed (the default) means that a TLS connection is attempted, but success is not required; strict means that TLS is required to connect.

  • --ndb-mgmd-host

    命令行格式Command-Line Format --ndb-mgmd-host=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    同 --ndb-connectstring。Same as --ndb-connectstring.

  • --ndb-nodeid

    命令行格式Command-Line Format --ndb-nodeid=#
    类型Type 整数Integer
    默认值Default Value [none][none]

    为此节点设置节点 ID,覆盖由 --ndb-connectstring 设置的任何 ID。Set node ID for this node, overriding any ID set by --ndb-connectstring.

  • --ndb-optimized-node-selection

    命令行格式Command-Line Format --ndb-optimized-node-selection

    启用事务节点选择的优化。默认启用;使用 --skip-ndb-optimized-node-selection 来禁用。Enable optimizations for selection of nodes for transactions. Enabled by default; use --skip-ndb-optimized-node-selection to disable.

  • --ndb-tls-search-path

    命令行格式Command-Line Format --ndb-tls-search-path=list
    类型Type 路径名Path name
    默认值(Unix)Default Value (Unix) $HOME/ndb-tls$HOME/ndb-tls
    默认值(Windows)Default Value (Windows) $HOMEDIR/ndb-tls

    指定用于搜索 CA 文件的目录列表。在 Unix 平台上,目录名称用冒号 (:) 分隔;在 Windows 系统上,使用分号 (;) 作为分隔符。目录引用可以是相对路径或绝对路径;它可以包含一个或多个环境变量,每个变量以美元符号 ($) 开头,并在使用前进行展开。Specify a list of directories to search for a CA file. On Unix platforms, the directory names are separated by colons (:); on Windows systems, the semicolon character (;) is used as the separator. A directory reference may be relative or absolute; it may contain one or more environment variables, each denoted by a prefixed dollar sign ($), and expanded prior to use.

    搜索从最左边的命名目录开始,按从左到右的顺序进行,直到找到文件。空字符串表示空搜索路径,这会导致所有搜索失败。由单个点 (.) 组成的字符串表示搜索路径仅限于当前工作目录。Searching begins with the leftmost named directory and proceeds from left to right until a file is found. An empty string denotes an empty search path, which causes all searches to fail. A string consisting of a single dot (.) indicates that the search path limited to the current working directory.

    如果未提供搜索路径,则使用编译时的默认值。此值取决于所使用的平台:在 Windows 上,它是 \ndb-tls;在其他平台(包括 Linux)上,它是 $HOME/ndb-tls。可以通过使用 -DWITH_NDB_TLS_SEARCH_PATH 编译 NDB Cluster 来覆盖该值。If no search path is supplied, the compiled-in default value is used. This value depends on the platform used: On Windows, this is \ndb-tls; on other platforms (including Linux), it is $HOME/ndb-tls. This can be overridden by compiling NDB Cluster using -DWITH_NDB_TLS_SEARCH_PATH.

  • --no-asynch

    命令行格式Command-Line Format --no-asynch

    以批量方式运行数据库操作,在单个事务中执行。Run database operations as batches, in single transactions.

  • --no-defaults

    命令行格式Command-Line Format --no-defaults--no-defaults

    除了登录文件之外,不从任何配置文件读取默认选项。Do not read default options from any option file other than login file.

  • --no-hint

    命令行格式Command-Line Format --no-hint

    不要使用分布键提示来选择数据节点。Do not use distribution key hinting to select a data node.

  • --opbatch=#

    命令行格式Command-Line Format --opbatch=#
    类型Type 整数Integer
    默认值Default Value 256
    最小值Minimum Value 1
    最大值Maximum Value 4294967295
    单位Unit 字节bytes

    设置每个执行批次的操作数(包括 blob 操作),从而限制异步事务的数量。Set a limit on the number of operations (including blob operations), and thus the number of asynchronous transactions, per execution batch.

  • --opbytes=#

    命令行格式Command-Line Format --opbytes=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 4294967295
    单位Unit 字节bytes

    设置每个执行批次的字节数限制。使用 0 表示无限制。Set a limit on the number of bytes per execution batch. Use 0 for no limit.

  • --output-type=name

    命令行格式Command-Line Format --output-type=name
    类型Type 枚举Enumeration
    默认值Default Value ndb
    有效值Valid Values null

    设置输出类型。ndb 是默认值。null 仅用于测试。Set the output type. ndb is the default. null is used only for testing.

  • --output-workers=#

    命令行格式Command-Line Format --output-workers=#
    类型Type 整数Integer
    默认值Default Value 2
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    设置处理输出或转发数据库操作的线程数。Set the number of threads processing output or relaying database operations.

  • --pagesize=#

    命令行格式Command-Line Format --pagesize=#
    类型Type 整数Integer
    默认值Default Value 4096
    最小值Minimum Value 1
    最大值Maximum Value 4294967295
    单位Unit 字节bytes

    将 I/O 缓冲区对齐到给定大小。Align I/O buffers to the given size.

  • --pagecnt=#

    命令行格式Command-Line Format --pagecnt=#
    类型Type 整数Integer
    默认值Default Value 64
    最小值Minimum Value 1
    最大值Maximum Value 4294967295

    将 I/O 缓冲区的大小设置为页面大小的倍数。CSV 输入工作者会分配大小加倍的缓冲区。Set the size of I/O buffers as multiple of page size. The CSV input worker allocates buffer that is doubled in size.

  • --polltimeout=#

    命令行格式Command-Line Format --polltimeout=#
    类型Type 整数Integer
    默认值Default Value 1000
    最小值Minimum Value 1
    最大值Maximum Value 4294967295
    单位Unit 毫秒ms

    为每次轮询已完成的异步事务设置超时时间;轮询将持续进行,直到所有轮询完成或发生错误。Set a timeout per poll for completed asynchronous transactions; polling continues until all polls are completed, or until an error occurs.

  • --print-defaults

    命令行格式Command-Line Format --print-defaults

    打印程序参数列表然后退出。Print program argument list and exit.

  • --rejects=#

    命令行格式Command-Line Format --rejects=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 4294967295

    限制数据加载中被拒绝的行数(具有永久错误的行)。默认值为 0,这意味着任何被拒绝的行都会导致致命错误。任何导致限制超出的行将被添加到.rej文件中。Limit the number of rejected rows (rows with permanent errors) in the data load. The default is 0, which means that any rejected row causes a fatal error. Any rows causing the limit to be exceeded are added to the .rej file.

    此选项施加的限制在当前运行期间有效。使用 --resume 重启的运行在此目的下被视为“新”运行。The limit imposed by this option is effective for the duration of the current run. A run restarted using --resume is considered a “new” run for this purpose.

  • --resume

    命令行格式Command-Line Format --resume

    如果作业中止(由于临时数据库错误或用户中断),则使用尚未处理的任何行恢复。If a job is aborted (due to a temporary db error or when interrupted by the user), resume with any rows not yet processed.

  • --rowbatch=#

    命令行格式Command-Line Format --rowbatch=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 4294967295
    单位Unit 行数rows

    设置每个行队列的行数限制。使用 0 表示无限制。Set a limit on the number of rows per row queue. Use 0 for no limit.

  • --rowbytes=#

    命令行格式Command-Line Format --rowbytes=#
    类型Type 整数Integer
    默认值Default Value 262144
    最小值Minimum Value 0
    最大值Maximum Value 4294967295
    单位Unit 字节bytes

    设置每个行队列的字节数限制。使用 0 表示无限制。Set a limit on the number of bytes per row queue. Use 0 for no limit.

  • --stats

    命令行格式Command-Line Format --stats

    将与性能及其他内部统计相关的选项信息保存在名为 *.sto 和 *.stt 的文件中。这些文件在操作成功完成后总是会被保留(即使没有同时指定 --keep-state 选项)。Save information about options related to performance and other internal statistics in files named *.sto and *.stt. These files are always kept on successful completion (even if --keep-state is not also specified).

  • --state-dir=name

    命令行格式Command-Line Format --state-dir=path
    类型Type 字符串String
    默认值Default Value .

    写入程序运行产生的状态文件的位置(tbl_name.map,tbl_name.rej,tbl_name.res,以及 tbl_name.stt);默认是当前目录。Where to write the state files (tbl_name.map, tbl_name.rej, tbl_name.res, and tbl_name.stt) produced by a run of the program; the default is the current directory.

  • --table=name

    命令行格式Command-Line Format --table=name
    类型Type 字符串String
    默认值Default Value [input file base name][input file base name]

    默认情况下,ndb_import 尝试将数据导入表,其表名为正在读取数据的 CSV 文件的基本名称。您可以通过使用 --table 选项(简写形式 -t)来覆盖表名的选择。By default, ndb_import attempts to import data into a table whose name is the base name of the CSV file from which the data is being read. You can override the choice of table name by specifying it with the --table option (short form -t).

  • --tempdelay=#

    命令行格式Command-Line Format --tempdelay=#
    类型Type 整数Integer
    默认值Default Value 10
    最小值Minimum Value 0
    最大值Maximum Value 4294967295
    单位Unit 毫秒ms

    临时错误之间的休眠时间,单位为毫秒。Number of milliseconds to sleep between temporary errors.

  • --temperrors=#

    命令行格式Command-Line Format --temperrors=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 4294967295

    每个执行批次中事务因临时错误失败的次数。默认值为 0,表示任何临时错误都是致命的。临时错误不会导致任何行被添加到 .rej 文件中。Number of times a transaction can fail due to a temporary error, per execution batch. The default is 0, which means that any temporary error is fatal. Temporary errors do not cause any rows to be added to the .rej file.

  • --verbose, -v

    命令行格式Command-Line Format --verbose[=#]
    类型Type 布尔Boolean
    默认值Default Value falsefalse

    启用详细输出。Enable verbose output.

  • --usage

    命令行格式Command-Line Format --usage

    显示帮助文本并退出;与 --help 相同。Display help text and exit; same as --help.

  • --version

    命令行格式Command-Line Format --version

    显示版本信息并退出。Display version information and exit.

与LOAD DATA类似,字段和行格式的选项必须与创建 CSV 文件时使用的选项匹配,无论这是使用SELECT INTO ... OUTFILE完成的,还是通过其他方式完成的。没有与LOAD DATA语句的STARTING WITH选项相对应的选项。As with LOAD DATA, options for field and line formatting much match those used to create the CSV file, whether this was done using SELECT INTO ... OUTFILE, or by some other means. There is no equivalent to the LOAD DATA statement STARTING WITH option.