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_importdb_namefile_nameoptions
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:
在 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.
在系统终端:In the system shell:
# if you are not already in the MySQL bin directory: $>
cd$>path-to-mysql-bin-dirndb_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.
命令行格式Command-Line Format --abort-on-error在任何致命错误时生成核心转储;仅用于调试。Dump core on any fatal error; used for debugging only.
命令行格式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 theauto_increment_incrementsystem variable does in the MySQL Server.命令行格式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 theauto_increment_offsetsystem variable.命令行格式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 thendb_autoincrement_prefetch_szsystem variable does in the MySQL Server.命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path包含字符集的目录。Directory containing character sets.
命令行格式Command-Line Format --connections=#类型Type 整数Integer 默认值Default Value 1最小值Minimum Value 1最大值Maximum Value 4294967295要创建的集群连接数。Number of cluster connections to create.
命令行格式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.
命令行格式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.
命令行格式Command-Line Format --connect-string=connection_string类型Type 字符串String 默认值Default Value [none][none]同
--ndb-connectstring。Same as--ndb-connectstring.命令行格式Command-Line Format --continue当某个作业失败时,继续下一个作业。When a job fails, continue to the next job.
命令行格式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 commad:使用默认值,除非被其他参数覆盖d: Use defaults, except where overridden by another parametern:行以\n结尾n: Lines terminated by\nq:字段可选地被双引号字符 (") 包围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.
命令行格式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.
命令行格式Command-Line Format --defaults-file=path类型Type 字符串String 默认值Default Value [none][none]仅从指定文件读取默认选项。Read default options from given file only.
命令行格式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.
命令行格式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 stopjobstopallsighupsigintlist错误插入类型;使用
list作为name的值以获取所有可能的值。此选项仅用于测试目的。Error insert type; uselistas thenamevalue to obtain all possible values. This option is used for testing purposes only.命令行格式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 theFIELDS ENCLOSED BYoption does for theLOAD DATAstatement, 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 theFIELDS ESCAPED BYoption does for the SQLLOAD DATAstatement.--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 theFIELDS OPTIONALLY ENCLOSED BYoption does for theLOAD DATAstatement, specifying a character to be interpreted as optionally quoting field values. For CSV input, this is the same as--fields-enclosed-by.命令行格式Command-Line Format --fields-terminated-by=char类型Type 字符串String 默认值Default Value \t这与
FIELDS TERMINATED BY选项在LOAD DATA语句中的作用相同,用于指定一个字符作为字段分隔符。This works in the same way as theFIELDS TERMINATED BYoption does for theLOAD DATAstatement, specifying a character to be interpreted as the field separator.命令行格式Command-Line Format --help--help显示帮助文本并退出。Display help text and exit.
命令行格式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.
命令行格式Command-Line Format --idlespin=#类型Type 整数Integer 默认值Default Value 0最小值Minimum Value 0最大值Maximum Value 4294967295在休眠之前重试的次数。Number of times to retry before sleeping.
命令行格式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 randomrandomcsv设置输入类型。默认值为
csv;random仅用于测试目的。Set the type of input type. The default iscsv;randomis intended for testing purposes only. .命令行格式Command-Line Format --input-workers=#类型Type 整数Integer 默认值Default Value 4最小值Minimum Value 1最大值Maximum Value 4294967295设置处理输入的线程数量。Set the number of threads processing input.
命令行格式Command-Line Format --keep-state默认情况下,ndb_import 在完成作业后会删除所有状态文件(非空的
*.rej文件除外)。指定此选项(不需要参数)以强制程序保留所有状态文件。By default, ndb_import removes all state files (except non-empty*.rejfiles) when it completes a job. Specify this option (nor argument is required) to force the program to retain all state files instead.命令行格式Command-Line Format --lines-terminated-by=char类型Type 字符串String 默认值Default Value \n这与
LINES TERMINATED BY选项在LOAD DATA语句中所起的作用相同,用于指定一个字符作为行结束符。This works in the same way as theLINES TERMINATED BYoption does for theLOAD DATAstatement, specifying a character to be interpreted as end-of-line.命令行格式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.
命令行格式Command-Line Format --login-path=path类型Type 字符串String 默认值Default Value [none][none]从登录文件读取给定路径。Read given path from login file.
命令行格式Command-Line Format --no-login-paths跳过从登录路径文件读取选项。Skips reading options from the login path file.
命令行格式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.
命令行格式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 anAUTO_INCREMENTcolumn, and that ndb_import should supply them; if the option is used and theAUTO_INCREMENTcolumn contains any values, the import operation cannot proceed.命令行格式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.
命令行格式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=. Overrides entries inid;][host=]hostname[:port]NDB_CONNECTSTRINGandmy.cnf.命令行格式Command-Line Format --ndb-mgm-tls=level类型Type 枚举Enumeration 默认值Default Value relaxedrelaxed有效值Valid Values relaxedrelaxedstrictstrict设置连接到管理服务器所需的 TLS 支持级别;可以是
relaxed或strict。relaxed(默认)表示尝试建立 TLS 连接,但不要求成功;strict表示连接必须使用 TLS。Sets the level of TLS support required to connect to the management server; one ofrelaxedorstrict.relaxed(the default) means that a TLS connection is attempted, but success is not required;strictmeans that TLS is required to connect.命令行格式Command-Line Format --ndb-mgmd-host=connection_string类型Type 字符串String 默认值Default Value [none][none]同
--ndb-connectstring。Same as--ndb-connectstring.命令行格式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-selectionto disable.命令行格式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.命令行格式Command-Line Format --no-asynch以批量方式运行数据库操作,在单个事务中执行。Run database operations as batches, in single transactions.
命令行格式Command-Line Format --no-defaults--no-defaults除了登录文件之外,不从任何配置文件读取默认选项。Do not read default options from any option file other than login file.
命令行格式Command-Line Format --no-hint不要使用分布键提示来选择数据节点。Do not use distribution key hinting to select a data node.
命令行格式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.
命令行格式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.ndbis the default.nullis used only for testing.命令行格式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.
命令行格式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.
命令行格式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.
命令行格式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.
命令行格式Command-Line Format --print-defaults打印程序参数列表然后退出。Print program argument list and exit.
命令行格式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.rejfile.此选项施加的限制在当前运行期间有效。使用
--resume重启的运行在此目的下被视为“新”运行。The limit imposed by this option is effective for the duration of the current run. A run restarted using--resumeis considered a “new” run for this purpose.命令行格式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.
命令行格式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.
命令行格式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.
命令行格式Command-Line Format --stats将与性能及其他内部统计相关的选项信息保存在名为
*.sto和*.stt的文件中。这些文件在操作成功完成后总是会被保留(即使没有同时指定--keep-state选项)。Save information about options related to performance and other internal statistics in files named*.stoand*.stt. These files are always kept on successful completion (even if--keep-stateis 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);默认是当前目录。Where to write the state files (tbl_name.stt,tbl_name.map,tbl_name.rej, andtbl_name.res) produced by a run of the program; the default is the current directory.tbl_name.stt命令行格式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--tableoption (short form-t).命令行格式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.
命令行格式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.rejfile.--verbose,-v命令行格式Command-Line Format --verbose[=#]类型Type 布尔Boolean 默认值Default Value falsefalse启用详细输出。Enable verbose output.
命令行格式Command-Line Format --usage显示帮助文本并退出;与
--help相同。Display help text and exit; same as--help.命令行格式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.