For Marklogic version below 6.0 on different platforms, XQSync is a tool that can copy documents and their metadata between databases, package documents and their metadata as zip archives, or write them directly to a filesystem. It deals with an entire database, a collection, a directory, or the results of evaluating an XQuery expression. If you're using Marklogic version 6.0 and above, the way to do this is to use a new Marklogic supported tool named mlcp. Install XQsyncXQsync is a Java program. First, download dependency JARs:
Then, test it out, cd <xqy-installation> You should get the following error about the source Marklogic is not specified: Exception in thread "main" java.io.IOException: missing required property: INPUT_CONNECTION_STRING You should be good to proceed. Export Marklogic DataTo export data from a source Marklogic, the target Marklogic need need an XDBC server to allow XML Content base Connector (XCC) applications (e.g. XQsync) to communicate with MarkLogic Server. Assuming you the source Marklogic already has one setup, the following command will export data to a .zip file: java -cp xqsync.jar:marklogic-xcc-6.0.4.jar:xstream-1.4.5.jar:xpp3-1.1.3_8.jar \ [1] In case heap memory size is not enough. [2] Limit export to a subset (directory) of the whole database. [3] Output file name. The actual output file will be /tmp/cq-content-000.zip Import Marklogic DataTo import data into a target Marklogic, the target Marklogic need need an XDBC server to allow XML Content base Connector (XCC) applications (e.g. XQsync) to communicate with MarkLogic Server. To set one up, use the MarkLogic Server admin interface, which runs on port 8001. http://<server>:8001 [1] XDBC server display name. [2] Module directory root. Once the XDBC server is ready, the following command imported the exported file into the target Marklogic's 'Documents' database: java -cp xqsync.jar:marklogic-xcc-6.0.4.jar:xstream-1.4.5.jar:xpp3-1.1.3_8.jar \ For debugging purposes, you may tail the Marklogic log to see what's going on as it goes. On my Mac, cd ~/Library/Application Support/MarkLogic/Data/Logs URI privileges are stored in the security database, as are exec privileges, roles, and users. None of these are copied by xqsync. So if the imported documents has roles (e.g. ml-read) not yet exist in the target Marklogic, the log may spit out errors: ==> ErrorLog.txt <== It would be possible to use xqsync to export your Security database to fix the above missing user, but importing to Security database would be somewhat tricky. I'd suggest you to first manually create the required missing roles (via Configure > Security > Roles > Create ...) in the target Marklogic and re-import again. On success, the output of the import will look like: >>> ... References
0 Comments
Leave a Reply. |
Categories
All
Archives
May 2020
|