Boss provides a simple command line tool that allows for interaction with a remote JMX server instance. This tool is called jboss twiddle (for twiddling bits via JMX) and is located in the bin directory of the distribution. Twiddle is a command execution tool, not a general command shell.
The syntax of this tool is:
twiddle.sh [options] <command> [command_arguments]
So if you want to see the list of MBeans published simply pass the "-l" argument to serverinfo
twiddle -s localhost serverinfo -l (for Win Users)
or for Unix machines:
twiddle.sh -s localhost serverinfo -l
How to change the Connection Pool size via twiddle
Supposing you need to change at runtime the size of your datasource named "DefaultDS", then you can use twiddle command (or modify it manually from the JMX-Console)
twiddle.sh set jboss.jca:name=DefaultDS,service=ManagedConnectionPool MaxSize 300
This sets the Max ConnectionPool size to 300
How to count the number of Connections available in a Datasource:
(In this example we are checking DefaultDS Datasource)
"jboss.jca:name=DefaultDS,service=ManagedConnectionPool" AvailableConnectionCount
How to shut down JBoss with twiddle:
twiddle.sh -s hostname invoke jboss.system:type=Server shutdown
How to shut fown JBoss with twiddle using authentication:
twiddle.sh -s hostname -u admin -p admin invoke jboss.system:type=Server shutdown
How to check the amount of free memory available:
twiddle.sh -s localhost:1099 get "jboss.system:type=ServerInfo" FreeMemory
Take ThreadDump :
twiddle.sh -s localhost:1099 invoke 'jboss.system:type=ServerInfo' listThreadDump
How to suggest the JVM to run the Garbage collector:
twiddle.sh invoke jboss.system:type=Server runGarbageCollector
Then you should see from the server log the following message:
13:52:39,281 INFO [Server] Hinted to the JVM to run garbage collection
13:52:39,281 INFO [Server] Total/free memory: 170065920/139849848
How to list Thread x CPU Usage:
twiddle.sh -s localhost:1099 invoke jboss.system:type=ServerInfo listThreadCpuUtilization
How to count active Sessions in a Web application:
twiddle -s localhost get "jboss.web:host=localhost,path=/SampleApp,type=Manager" activeSessions
activeSessions=3
How to inspect session attributes of a Web application:
First get the list of session ids running:
twiddle.sh -s localhost invoke "jboss.web:host=localhost,path=/Sample,type=Manager" listSessionIds
C01C7A10A4209D8A87F6467F5439FEF0
Then query for the session attibute:
twiddle.sh -s localhost invoke "jboss.web:host=localhost,path=/Sample,type=Manager" getSessionAttribute C01C7A10A4209D8A87F6467F5439FEF0 name
name=John Smith
Deploying an Application :
twiddle.sh -s localhost:1099 invoke 'jboss.service:MainDeployer' deploy "file:///tmp/Application.war"
Undeploying an Application :
twiddle.sh -s localhost:1099 invoke 'jboss.service:MainDeployer' undeploy "file:///tmp/Application.war"
Redeploying an Application :
twiddle.sh -s localhost:1099 invoke 'jboss.service:MainDeployer' redeploy "file:///tmp/Application.war"
https://community.jboss.org/wiki/Twiddle
Connecting to a remote host with twiddle:
By default (pre AS 6 M3) the twiddle command will connect to the localhost at port 1099 to lookup the default jmx/rmi/RMIAdaptor binding of the RMIAdaptor service as the connector for communicating with the JMX server. To connect to a different server/port combination you can use the -s (--server) option:
$ ./twiddle.sh -s host serverinfo -d
jboss
$ ./twiddle.sh -s host:1099 serverinfo -d jboss
In AS 6 M3 or later, by default, the twiddle command will connect to the localhost at port 1090 (using JSR-160 support). To connect to a different server/port combination, use the --host= and --port= options:
$ ./twiddle.sh --host=host serverinfo -d
$ ./twiddle.sh --host=host --port=1090 serverinfo -d
$ ./twiddle.sh -s service:jmx:rmi:///jndi/rmi://host:1090/jmxrmi
分享到:
相关推荐
三、EJB3.0使用说明 EJB(Enterprise JavaBeans)是Java EE的一部分,用于构建分布式企业级应用。EJB3.0引入了许多改进,简化了开发过程。 1. EJB类型:EJB3.0包含三种主要类型:Stateless Session Beans(无状态...
### JBoss服务器使用详解 JBoss是一款开源的应用服务器,它基于Java平台,支持JavaEE标准。本文将详细介绍JBoss服务器的安装、配置、部署及使用方法,并特别关注其与数据库的连接过程。 #### 一、JBoss服务器安装 ...
### JBoss 使用详细操作步骤 #### 一、安装与配置 JBoss 在开始介绍 JBoss 的使用之前,我们首先需要确保已经正确安装并配置了 JBoss。以下是一些基本的操作步骤: 1. **下载 JBoss**:访问 JBoss 官方网站下载...
【JBOSS使用手册】 JBOSSEAP(Java Business Service Suite Enterprise Application Platform)是由Red Hat公司开发的一个开源中间件平台,主要用于部署和管理Java企业级应用程序。本手册将全面介绍JBOSSEAP,即...
JBOSS5.1安装配置说明 JBOSS 是一个基于 Java 的开源应用服务器,可以运行在 Windows、Linux、Unix 等多种操作系统平台上。为了在 Windows 下安装和配置 JBOSS,我们需要按照以下步骤进行操作。 安装 JAVA 环境 ...
JBoss IDE,全称为JBoss Integrated Development Environment,是一款专为JBoss应用服务器设计的集成开发环境,它提供了丰富的工具和功能来简化JBoss应用的开发、部署和管理过程。本指南将详细介绍JBoss IDE的几个...
jboss配置说明,主要是jboss的安全性方面的配置说明;
这个压缩包包含的文档主要涵盖了JBoss的安装、启动、配置以及集群等核心主题,对于理解并使用JBoss至关重要。下面将详细阐述这些知识点。 1. **JBoss安装**: JBoss的安装过程包括下载合适的版本、解压到指定目录...
jboss-4.2.2.GA安装程序。办公区上不了官网,只能先传到CSDN了。办公区有需要的兄弟下了用吧。
- **是否使用Java上下文**:`false`,表示不使用。 - **用户名和密码**:分别为`vnetoo61`和`vnetoo61`,用于数据库认证。 - **异常分类器类名**:`org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter`,...
JBoss 引用自定义 Module 的示例
JBOSSRULES使用文档
### 一台机器部署多个JBoss服务器的配置方法 在企业级应用开发中,有时需要在同一台物理机器上部署多个JBoss应用服务器实例。这可能是出于性能测试、开发环境搭建或是资源利用等多种考虑因素。然而,在同一台机器上...