Search code examples
marklogicmlcp

Error with MLCP copy syntax


I am using the following command

mlcp.sh copy -input_host localhost -output_host localhost \
-input_database emh-entity-manager-content \
-output_database emh-schema-map-manager-content \
-input_port 8000 -input_username admin -input_password xxxxxx \
-document_selector '/envelope[descendant::*:CustomerID = "SEVES"]'

And am getting the error

ERROR contentpump.ContentPump: Unrecognized argument: =
usage: COPY [-batch_size <number>] [-collection_filter <String>]
   [-copy_collections <true,false>] [-copy_permissions <true,false>]
   [-copy_properties <true,false>] [-copy_quality <true,false>]
   [-directory_filter <String>] [-document_selector <String>]
   [-fastload <true,false>] [-hadoop_conf_dir <directory>]
   [-input_database <database>] -input_host <host> [-input_password
   <password>] [-input_port <port>] [-input_username <username>]
   [-max_split_size <number>] [-min_split_size <number>] [-mode
   <mode>] [-output_collections <collections>] [-output_database
   <database>] [-output_directory <directory>] -output_host <host>
   [-output_partition <partition name>] [-output_password <password>]
   [-output_permissions <permissions>] [-output_port <port>]
   [-output_quality <quality>] [-output_uri_prefix <prefix>]
   [-output_uri_replace <list>] [-output_uri_suffix <suffix>]
   [-output_username <username>] [-path_namespace <String>]
   [-query_filter <String>] [-snapshot <true,false>]
   [-temporal_collection <String>] [-thread_count <count>]
   [-tolerate_errors <tolerate errors>] [-transaction_size <number>]
   [-transform_function <String>] [-transform_module <String>]
   [-transform_namespace <String>] [-transform_param <String>]

The error message is pretty much useless. I am trying to copy a set of files that match a specific xpath from one database to another on the same server.

What am I missing?

Thanks, Loren


Solution

  • There are a few things going on:

    • You are missing the output_username
    • You are missing the output_password
    • You are running across some sort of command-line escaping issue.

    MLCP has a nice option called -options_file that helps take care of the command line escaping. You simply add all options to a file and that gets parsed instead. https://docs.marklogic.com/guide/mlcp/intro#id_36150

    The command I would use is:

    /path/to/mlcp.sh -options_file options.txt
    

    With the content of the options.txt file being:

    copy
    -input_host
    localhost
    -output_host
    localhost
    -input_database
    emh-entity-manager-content
    -output_database
    emh-schema-map-manager-content
    -input_port
    8000
    -input_username
    admin
    -input_password
    xxxxxx
    -output_username
    admin
    -output_password
    xxxxxx
    -document_selector
    /envelope[descendant::*:CustomerID = "SEVES"]