Chapter 6. Administration
MarkLogic takes less work to administer than many databases, but there are still things to do. The first recipe helps out those who don’t have admin privileges; the second helps track the progress of the MarkLogic version 9 rolling upgrade feature.
Find Hostnames in a Cluster
Someone with access to Query Console, but not to the Admin UI, wants to know the names of hosts in the cluster.
Applies to MarkLogic versions 7 and higher
The Admin UI provides a lot of information about a MarkLogic cluster: configuration of the databases, application servers, groups, and other information. It also provides a means to change all these things. As such, access to it is limited to those who have the admin privilege. This permits a user to do anything in MarkLogic, including seeing and updating any data, so this role should be held tightly to an administration team that uses procedures to ensure mistakes don’t happen, especially in production.
Query Console, on the other hand, can be much more widely available. Developers working on a project will likely be able to use Query Console to try out queries. Their rights will likely be limited to what they need, but it doesn’t take much to run Query Console.
Sometimes team members may want to get the list of hostnames in a cluster. This recipe is a simple one-liner, but very useful all the same.
xdmp:hosts() returns the IDs of all hosts in the cluster. We then ...