Rolling Upgrades Using XQuery
- Last Updated: April 14, 2026
- 1 minute read
- MarkLogic Server
- Version 10.0
- Documentation
The XQuery Admin APIs can be used to set up and perform a rolling upgrade through the Query Console. This section contains sample code that you can use from the Query Console.
To get the host versions via REST, use this code:
xquery version "1.0-ml";
<hosts>{
for $i in xdmp:host-name(xdmp:hosts())
return (
let $response := xdmp:http-get(concat("http://localhost:8002/manage/v2/hosts/",$i,"?view=status&format=json"),
<options xmlns="xdmp:http">
<authentication method="digest">
<username>admin</username>
<password>admin</password>
</authentication>
<headers>
<content-type>application/json</content-type>
</headers>
</options>)
return (
<host>
<name>{$response[2]//*:name/data()}</name>
<host-software-version>{$response[2]//*:software-version/value/data()}</host-software-version>
<cluster-effective-version>{$response[2]//*:effective-version/value/data()}</cluster-effective-version>
</host>
)
)
}</hosts>
To complete the upgrade, log onto the Admin Interface to upgrade the Security database.
Note:
Committing the upgrade results in the updated configuration being saved with a re-read delay of 5 seconds to ensure that all online hosts have received the new file before XDQP connections start dropping.
See Step 8 in Upgrading an EC2 Instance. If the servers do not have the correct version, then there may be a host that is in maintenance mode. The admin.canCommitUpgrade() or admin:can-commit-upgrade() function returns true if all servers have the correct software version. See Admin APIs for more about the Admin APIs available.