With ncluster_export you can export from multiple tables in a single invocation by creating a map file of tables to be exported and passing the --map-file or -m option with the filename. All tables are exported within a single database transaction. To export from multiple tables, perform the following steps:
- Prepare your map file. The map file is a text file containing a set of logical text blocks, each surrounded by curly braces. Each block represents a table to be exported. The format is as follows:
{ "exportconfig" : [ { "table" : "exporttable1", "fileprefix" : "path/to/dir/file" }, { "table" : "exporttable2", "fileprefix" : "path/to/dir/prefix", "maxtuplesperfile" : 100, "columns" : "a,b" } ] }
Each block must contain the following required parameters:
- “table” specifies the name of the table to export.
- “fileprefix” specifies the output file / file prefix to be used.
Each block can contain the following optional parameters:
- maxtuplesperfile” can be used to specify how many records will be put in each output file. This allows outputting multiple files for a single table, with the specified number of records in each.
- “columns” is a comma-separated list of the columns to be exported.
- Run ncluster_export, passing the --map-file or -m option and the name of your map file.
$ ./ncluster_export -U mjones -w st4g0l33 -h 10.50.52.100 -d mydb -m "path/to/dir/mapfile"