Setting administrative metadata for Liberty resources
You can use the admin-metadata.xml file to set administrative metadata for server, cluster, application, and runtime resources. Administrative metadata enables you to associate information such as tags, owners, contacts, and notes with resources. The metadata can simplify resource management and make it easier to find information about resources in large topologies. For example, server metadata that shows the owner of a server can assist you in more quickly finding the correct person to contact if the server requires changes. The admin-metadata.xml file uses XML format and does not exist by default. You must create the file and place it in a server configuration directory or in the Liberty (runtime) etc directory. After placing the admin-metadata.xml file in a supported directory, you can view the metadata in Admin Center or augment the metadata through application programming interfaces (APIs).
Procedure
Results
Server metadata in the server configuration directory is deployed to, or undeployed from, the collective repository when the following events occur:
- The server joins to the collective controller through the collective join command
- The controller or member server starts
- A member is removed from the collective controller through the collective remove command
- The admin-metadata.xml file changes
The product monitors the admin-metadata.xml file after the server starts and dynamically updates server metadata in the collective repository to reflect any file changes.
Important: Ensure the server is running when you delete an admin-metadata.xml file. If an admin-metadata.xml file is deleted while the server is running then the product removes the metadata from the repository. If some elements are deleted from the file when the server is stopped, the product removes those elements from the repository when the server starts. However, if the admin-metadata.xml file is deleted while the server is stopped, the metadata will not be removed from the repository when the server starts.
Cluster metadata is deployed to, or undeployed from, the collective repository when the following events occur:
- A cluster member connects with the controller, such as when a cluster member starts
- The admin-metadata.xml file changes for a cluster member
- The last cluster member is removed, such as when the last cluster member stops
Application metadata is deployed to the collective repository when the following events occur:
- An application is installed on a server or cluster
- The admin-metadata.xml file changes for an application
Runtime metadata is deployed to, or undeployed from, the collective repository when the following events occur:
- A server joins the collective controller through the collective join command
- The runtime installation directory (${wlp.install.dir}) is unregistered, resulting in undeployment
- No dynamic updating through the file monitor or AdminMetadataManager MBean
The product does not monitor the admin-metadata.xml file in the etc directory. You must restart the server to update the runtime metadata in the collective repository.
Example admin-metadata.xml files
The following examples show admin-metadata.xml files for server and runtime metadata:
Example: admin-metadata.xml in a server configuration directory
<admin-metadata>
<server owner="John Doe">
<tag>servertag1</tag>
<tag>servertag2</tag>
<tag>servertag3</tag>
<contact>Mike</contact>
<contact>Fred</contact>
<contact>Susan</contact>
<note>This server is the best server.</note>
</server>
<cluster name="cluster1" owner="Tom Wood">
<tag>clustertag1</tag>
<tag>clustertag2</tag>
<tag>clustertag3</tag>
<contact>Roger</contact>
<contact>Steve</contact>
<contact>David</contact>
<note>This cluster is the best cluster.</note>
</cluster>
<application name="app1" owner="Sam Hardison">
<tag>app1tag1</tag>
<tag>app1tag2</tag>
<tag>app1tag3</tag>
<contact>Jack</contact>
<contact>Tom</contact>
<contact>Michael</contact>
<note>Liberty 8.5.5.x with IBM JDK</note>
</application>
<application name="app2" owner="Michael Dell">
<tag>app2tag1</tag>
<tag>app2tag2</tag>
<tag>app2tag3</tag>
<contact>Susan</contact>
<contact>Roger</contact>
<contact>Fred</contact>
<note>Liberty 8.5.5.x with IBM JDK</note>
</application>
</admin-metadata>
Example: admin-metadata.xml in the runtime etc directory
<admin-metadata>
<runtime owner="Admin Boss">
<tag>runtimetag1</tag>
<tag>runtimetag2</tag>
<tag>runtimetag3</tag>
<contact>Steven</contact>
<note>Liberty 8.5.5.x with IBM JDK</note>
</runtime>
</admin-metadata>
What to do next
You can view administrative metadata in Admin Center.
For example, suppose a collective controller named controller1
has the following
admin-metadata.xml file in its server configuration directory,
$WLP_USER_DIR/servers/controller1:
<admin-metadata>
<server owner="John Doe">
<tag>controller</tag>
<tag>replica_controller</tag>
<contact>Michal</contact>
<contact>Felix</contact>
<contact>Travis</contact>
<contact>Philippa</contact>
<contact>Amy</contact>
<note>The first of three replica controllers. At least three replica controllers are needed for high availability.</note>
</server>
</admin-metadata>
When the controller has <feature>adminCenter-1.0</feature>
in its
<featureManager>
configuration, the Admin Center Explore tool displays the metadata in details
about the controller1
server:
For information about viewing administrative metadata in the Explore tool, see Setting and viewing administrative metadata in Admin Center.
Also, you can use methods in AdminMetadataManagerMBean to add, retrieve and set application metadata in the collective repository, as well as remove it from the collective repository.