Configuration Management API(CMA) details
12 November 2020 09:59 AM
Marklogic Server persists its configuration in XML files (for example, databases.xml, hosts.xml, etc.), copies of which exist on each node of a cluster. While you could use the Admin UI to manage an individual cluster's configuration, at scale and over multiple environments, the best practice is to build a source-control managed script that uses MarkLogic's configuration management APIs - specifically Configuration Management API (CMA) and REST Management API (RMA).
What is RMA?
RMA (REST Management API- /manage/v2) provides the ability to easily capture detailed information about MarkLogic Server objects and processes such as hosts, databases, forests, application servers, and groups from any tool that can make a RESTful call.
You can read more about the MarkLogic REST Management API at - http://docs.marklogic.com/REST/management.
What is CMA?
Configuration Management API (CMA) is a new, higher-level interface built on top of the REST Management API (RMA). CMA is intended to more easily integrate with downstream tooling like MarkLogic's ml-gradle and Java API, as well as third party options like node.js, bash, and curl.
Customers will typically want to package up configurations to manage the deployment of applications into development, test, and production environments. CMA makes it easier to set up complex MarkLogic features such as replication and failover across these different environments by providing common 'canned' scenarios.
You can read more about the MarkLogic Configuration Management API at - http://docs.marklogic.com/REST/configuration-management-api
How to invoke CMA?
Customer can create and apply configurations in three ways:
1. REST Management API: manage/v3: REST endpoint for generating and applying configurations.
Please refer to http://docs.marklogic.com/REST/configuration-management-api
1.1 http://host:8002/manage/v3?format=json : This will return the configuration data in json format. If we change the format to xml, we will get the configurations in xml format.
1.2 http://host:8002/manage/v3?format=zip: This will return package.zip. This archive contains the configuration files (database, forest hosts..etc), README, and ml-gradle property/build files. README from the zip file has the details about how to install ml-gradle and apply the configurations to the other instances.
2. XQuery: cma.xqy --- XQuery library for generating and applying configurations.
Please refer to https://docs.marklogic.com/cma for more details.
Please refer to https://docs.marklogic.com/js/cma for more details.
For example, to create a REST server: