JMX

From AlfrescoWiki

Jump to: navigation, search


IMPORTANT: This document details the JMX interface available for the Alfresco Repository Server. This feature is targeted for Alfresco 2.2 Enterprise. It is also available on HEAD and nightly builds (2.9.0C_dev)

Contents


[edit] Background

By default, sys-admins can re-configure Alfresco by shutting down the server, editing certain property/configuration files and then re-starting the server. However, there are certain support operations that sys-admins would like to perform on-demand at runtime without needing to restart the server. For example, it should be possible to temporarily change log levels in order to debug and/or troubleshoot a live system.

[edit] Introduction

The new JMX interface allows sys-admins to access Alfresco via a standard JMX console that supports JMX Remoting (JSR-160).

Example consoles include:

  • JConsole (supplied with Java SE 5.0 and higher)
  • MC4J
  • JManage

Some of these consoles also provide basic graphs and/or alerts for monitoring JMX managed attributes.

[edit] Features

The new server management features include:

  • JSR-160 support
  • change log levels (eg. turn debug on/off)
  • enable/disable file servers (FTP/CIFS/NFS)
  • server read-only mode
  • server single-user mode
  • server max user limit - including ability to prevent further logins
  • user session/ticket count
  • user session/ticket invalidation

[edit] Connecting through JMX Consoles / JSR-160

Alfresco supports JMX Remoting (JSR-160) using Spring JMX. The Alfresco MBean server can be accessed using a suitable JMX console.

To access Alfresco remotely, you will need to enter the following:

  • JMX URL: service:jmx:rmi:///jndi/rmi://<hostname>:50500/alfresco/jmxrmi
  • JMX Username: controlRole
  • JMX Password: change_asap

IMPORTANT: The default JMX password MUST be changed asap !! Refer to Repository Configuration and files:

  • <configRoot>/alfresco/alfresco-jmxrmi.access
  • <configRoot>/alfresco/alfresco-jmxrmi.password


[edit] JConsole (example)

For more details refer to JConsole

Note: the example screenshot maybe slightly out-of-date with respect to latest managed attributes/operations.

[edit] MC4J (example)

For more details refer to MC4J

Note: the example screenshot maybe slightly out-of-date with respect to latest managed attributes/operations.

[edit] JManage (example)

For more details refer to JManage

Note: the example screenshot maybe slightly out-of-date with respect to latest managed attributes/operations.

[edit] Interface Summary

[edit] Logging

Uses Log4J's HierarchyDynamicMBean

Note: This is not cluster-aware. If needed, the log level change will need to be applied to each machine. Some consoles (e.g. JManage) may provide basic facilities for accessing each machine in an application cluster.

[edit] Editable Attributes

  • dynamic list of loggers with logLevel attribute - can change to ERROR, WARN, INFO, DEBUG (editable)

[edit] Operations with Impact

  • addLoggerMBean - add logger, if it has been loaded


[edit] File Server Config

Note: This is not cluster-aware. If more than one file server is running (eg. load-balanced FTP) then the change will need to be applied to each machine. Some consoles (e.g. JManage) may provide basic facilities for accessing each machine in an application cluster.

[edit] Editable Attributes

  • ftpEnabled - true = enable FTP server, false = disable FTP server
  • cifsEnabled - true = enable CIFS server, false = disable CIFS server
  • nfsEnabled - true = enable NFS server, false = disable NFS server

[edit] Non-Editable Attributes

  • cifsServerName - get CIFS server name, if available
  • cifsServerAddress - (not implemented)


[edit] Repo Server Management

Note: The managed attributes/operations below are cluster-aware.

[edit] Editable Attributes

  • readOnly - - set repository transaction mode - true = READONLY, false = WRITABLE
  • singleUserOnly - set single username (eg. 'admin') or blank to disable single user mode and allow all usernames
  • maxUsers - limit for non-expired user logins, -1 if no limit set, 0 to prevent further logins
  • linkValidationDisabled - disable or re-enabled link validation service

[edit] Non-Editable Attributes

  • ticketCountNonExpired - count of non-expired tickets
  • ticketCountAll - count of all tickets, including non-expired
  • userCountNonExpired - count of non-expired users
  • userCountAll - count of all users, including non-expired

[edit] Operations with Impact

  • invalidateTicketsExpired - invalidate expired tickets only
  • invalidateTicketsAll - invalidate all tickets, expired and non-expired
  • invalidateUser - invalidate all tickets for given username

[edit] Operations with No Impact

  • listUserNamesNonExpired - return set of non-expired usernames
  • listUserNamesAll - return set of all usernames, expired and non-expired


[edit] Virt Server Registry

Added here for completeness only. This is currently used directly by the Alfresco Virtualization Server - see here, here and here


[edit] Change Management

Any dynamic changes made via the JMX interface are intended to be transient, such as changing a log level temporarily. Hence, these changes will be lost after a server restart. If certain dynamic changes need to also be persisted (so that they survive a server restart) then they should also be applied to the appropriate configuration file, where applicable.

For example:

  • log level change - edit log4j.properties on the classpath
  • max users - edit custom repository properties file (server.maxusers property)
  • singe-user mode - edit custom repository properties file (server.singleuseronly.name property)
  • read-only mode - edit custom transaction properties file (server.transaction.allow-writes property)
  • disable/enable file servers (FTP/CIFS/NFS) - edit custom file servers config xml file