Search code examples
windowsbackupmarklogicrestore

How to copy MarkLogic database between platforms


I need to confirm the process to copy a database from a Linux ML 9.x server to a Windows ML 9.x server and wanted to make sure I understood properly.

Apparently I cant use a backup of a ML database taken on a Linux to restore onto a Windows server.

Here is what I think the high level process is and would welcome correction/assistance please :

On Linux source server :

(1) Export the database configuration on source server ( to file )

xquery version "1.0-ml";
 import module namespace admin = "http://marklogic.com/xdmp/admin" 
     at "/MarkLogic/admin.xqy";
 let $config := admin:get-configuration()
 let $config := admin:database-copy($config,xdmp:database("<The_existing_db>"),"<The_new_database>")

(2) Export all forest structures on source servers ( to file - where are these stored on disk? )

xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin" 
     at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
let $config := admin:forest-copy($config,xdmp:forest("<original_forest>"),"<forest_copy>",())

(3) Export source data using mlcp ( to file/s - or db? )

On Windows destination server :

(4) Create new database from exported configuration files (5) Create forests from exported forest configuration files & attach to database (6) Import data using mlcp from exported files

Have I missed anything / got it wrong?

Thanks in advance.


Solution

  • To move data between platforms, use MLCP and ask it to make an archive. Please see the relevant docs at https://docs.marklogic.com/guide/mlcp/export#id_93332

    To move configuration, you can use Configuration Manager (https://docs.marklogic.com/guide/admin/config_manager) but it’s deprecated because the best practice these days is to script the construction of all things, perhaps with ml-gradle (https://developer.marklogic.com/code/ml-gradle/), and to check those construction scripts into your source control and control configuration that way across your multiple environments.