[ 
https://issues.apache.org/jira/browse/DERBY-1387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ole Gunnar Borstad updated DERBY-1387:
--------------------------------------

    Attachment: DERBY-1387-1.stat
                DERBY-1387-1.diff

DERBY-1387-1.diff
DERBY-1387-1.stat

This patch adds a management and monitoring service to Derby through JMX 
extentions. The service is designed for a client/server environment. The patch 
is a refactor and expansion of Sanket Sharma's work.

No tests have been run. Only functional testing of the features has been done. 
No test cases are included.

- FEATURES

1) Deployment
Derby can be monitored locally or remotely. Both configurations use the JVM's 
built-in instrumentation as the JMX agent, where password authentication and 
SSL support is provided.

The management functionality is implemented through 4 managed beans (MBeans):

2) VersionMBean
View Derby version information.
No operations are provided.

3) DerbySystemMBean
View and change system properties. Changes to properties are not persisted in 
derby.properties, because currently no such mechanism exists in the Derby 
engine. Default values are displayed as <default>, because they are not 
accessible through the java Properties. Derby properties are visible through 
Properties only if set explicitly. There has been discussion on derby-dev on 
this issue, but no JIRA-issue is up yet.

4) MDatabaseMBean
All booted databases are wrapped by a bean which provides access to database 
properties. Changes are persistent.
The following operations are provided:
Stopping the database, backup, checking table consistency and adding database 
users. There is also an operation to connect as a user. This authenticates the 
management service and is to be used if Derby authentication is enabled.

5) NSCMBean
The public API of NetworkServerControl is made available through this bean. All 
methods of this API can now be invoked from a remote machine through the 
management service. This includes ping, shutdown, logging etc.

- HOW TO BUILD AND RUN

Build files are edited to compile the management service. The ManagementService 
and BasicManagementService classes are compiled with JDK 1.5. My edits of the 
build files might not be optimal so I would appreciate if anyone can review 
those.

Run

Start Derby with management by using the system property "derby.jmx". The 
property value is not relevant. Certain other system properties must also be 
set when starting the server-JVM to enable the built-in JMX agent. These 
properties vary with local/remote and security configurations. For details 
refer to the following URL:

http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html

This is an example of running with JMX agent enabled for local management and 
without security features:
java -Dcom.sun.management.jmxremote -Dderby.jmx=true 
org.apache.derby.drda.NetworkServerControl start -noSecurityManager

JConsole (found in JDK_HOME/bin) can be used as the management GUI. Details in 
above URL.

Implementation details

- JVM platform instrumentation
The JVM has built-in instrumentation (from JDK 1.5) that enables you to monitor 
and manage the JVM and instrumented applications using JMX. The Derby 
management service uses this for both local and remote management.

- Modifications to Derby engine code
Derby boots the management service when the system property 'derby.jmx' is set. 
The module is loaded and started through the Derby monitor as done for other 
services. The changes to the Derby code are small and should hopefully not be a 
problem. MBeans are created when instrumented Derby resources are booted. For 
example, BasicDatabase.boot() instantiates an instance of MDatabaseMBean.

- ManagementService
This is the management service interface (found in 
org.apache.derby.iapi.services.mbeans), which holds the MBeanServer and methods 
to create beans. All beans should be created through this interface. To expand 
with more beans, one needs to find the appropriate Derby code to instrument, 
code a bean for it, and make factory methods in the ManagementService.

All beans are implemented as Standard MBeans.

API documentation is provided with the source code. The attached svn stat file 
lists the modifications and added files.

> Add JMX extensions to Derby
> ---------------------------
>
>                 Key: DERBY-1387
>                 URL: https://issues.apache.org/jira/browse/DERBY-1387
>             Project: Derby
>          Issue Type: New Feature
>          Components: Services
>            Reporter: Sanket Sharma
>            Assignee: Ole Gunnar Borstad
>         Attachments: DERBY-1387-1.diff, DERBY-1387-1.stat, derbyjmx.patch, 
> jmx.diff, jmx.stat, Requirements for JMX Updated.html, Requirements for 
> JMX.html, Requirements for JMX.zip
>
>
> This is a draft requirement specification for adding monitoring and 
> management extensions to Apache Derby using JMX. The requirements document 
> has been uploaded on JIRA as well as the Derby Wiki page at 
> http://wiki.apache.org/db-derby/_Requirement_Specifications_for_Monitoring_%26_Management_Extensions_using_JMX
> Developers and Users are requested to please look at the document (feature 
> list in particular) and add their own rating to features by adding a coloumn 
> to the table.
> Comments are welcome.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to