jdk
219 строк · 7.4 Кб
1.\" Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
2.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3.\"
4.\" This code is free software; you can redistribute it and/or modify it
5.\" under the terms of the GNU General Public License version 2 only, as
6.\" published by the Free Software Foundation.
7.\"
8.\" This code is distributed in the hope that it will be useful, but WITHOUT
9.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11.\" version 2 for more details (a copy is included in the LICENSE file that
12.\" accompanied this code).
13.\"
14.\" You should have received a copy of the GNU General Public License version
15.\" 2 along with this work; if not, write to the Free Software Foundation,
16.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17.\"
18.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19.\" or visit www.oracle.com if you need additional information or have any
20.\" questions.
21.\"
22.\" Automatically generated by Pandoc 2.19.2
23.\"
24.\" Define V font for inline verbatim, using C font in formats
25.\" that render this, and otherwise B font.
26.ie "\f[CB]x\f[R]"x" \{\
27. ftr V B
28. ftr VI BI
29. ftr VB B
30. ftr VBI BI
31.\}
32.el \{\
33. ftr V CR
34. ftr VI CI
35. ftr VB CB
36. ftr VBI CBI
37.\}
38.TH "JSTATD" "1" "2025" "JDK 24-ea" "JDK Commands"
39.hy
40.SH NAME
41.PP
42jstatd - monitor the creation and termination of instrumented Java
43HotSpot VMs
44.SH SYNOPSIS
45.PP
46\f[B]WARNING:\f[R] This command is experimental, unsupported, and
47deprecated.
48It will be removed in a future release.
49.PP
50\f[V]jstatd\f[R] [\f[I]options\f[R]]
51.TP
52\f[I]options\f[R]
53This represents the \f[V]jstatd\f[R] command-line options.
54See \f[B]Options for the jstatd Command\f[R].
55.SH DESCRIPTION
56.PP
57The \f[V]jstatd\f[R] command is an RMI server application that monitors
58for the creation and termination of instrumented Java HotSpot VMs and
59provides an interface to enable remote monitoring tools, \f[V]jstat\f[R]
60and \f[V]jps\f[R], to attach to JVMs that are running on the local host
61and collect information about the JVM process.
62.PP
63The \f[V]jstatd\f[R] server requires an RMI registry on the local host.
64The \f[V]jstatd\f[R] server attempts to attach to the RMI registry on
65the default port, or on the port you specify with the \f[V]-p\f[R]
66\f[V]port\f[R] option.
67If an RMI registry is not found, then one is created within the
68\f[V]jstatd\f[R] application that\[aq]s bound to the port that\[aq]s
69indicated by the \f[V]-p\f[R] \f[V]port\f[R] option or to the default
70RMI registry port when the \f[V]-p\f[R] \f[V]port\f[R] option is
71omitted.
72You can stop the creation of an internal RMI registry by specifying the
73\f[V]-nr\f[R] option.
74.SH OPTIONS FOR THE JSTATD COMMAND
75.TP
76\f[V]-nr\f[R]
77This option does not attempt to create an internal RMI registry within
78the \f[V]jstatd\f[R] process when an existing RMI registry isn\[aq]t
79found.
80.TP
81\f[V]-p\f[R] \f[I]port\f[R]
82This option sets the port number where the RMI registry is expected to
83be found, or when not found, created if the \f[V]-nr\f[R] option
84isn\[aq]t specified.
85.TP
86\f[V]-r\f[R] \f[I]rmiport\f[R]
87This option sets the port number to which the RMI connector is bound.
88If not specified a random available port is used.
89.TP
90\f[V]-n\f[R] \f[I]rminame\f[R]
91This option sets the name to which the remote RMI object is bound in the
92RMI registry.
93The default name is \f[V]JStatRemoteHost\f[R].
94If multiple \f[V]jstatd\f[R] servers are started on the same host, then
95the name of the exported RMI object for each server can be made unique
96by specifying this option.
97However, doing so requires that the unique server name be included in
98the monitoring client\[aq]s \f[V]hostid\f[R] and \f[V]vmid\f[R] strings.
99.TP
100\f[V]-J\f[R]\f[I]option\f[R]
101This option passes a Java \f[V]option\f[R] to the JVM, where the option
102is one of those described on the reference page for the Java application
103launcher.
104For example, \f[V]-J-Xms48m\f[R] sets the startup memory to 48 MB.
105See \f[B]java\f[R].
106.SH SECURITY
107.PP
108The \f[V]jstatd\f[R] server can monitor only JVMs for which it has the
109appropriate native access permissions.
110Therefore, the \f[V]jstatd\f[R] process must be running with the same
111user credentials as the target JVMs.
112Some user credentials, such as the root user in Linux and macOS
113operating systems, have permission to access the instrumentation
114exported by any JVM on the system.
115A \f[V]jstatd\f[R] process running with such credentials can monitor any
116JVM on the system, but introduces additional security concerns.
117.PP
118The \f[V]jstatd\f[R] server doesn\[aq]t provide any authentication of
119remote clients.
120Therefore, running a \f[V]jstatd\f[R] server process exposes the
121instrumentation export by all JVMs for which the \f[V]jstatd\f[R]
122process has access permissions to any user on the network.
123This exposure might be undesirable in your environment, and therefore,
124local security policies should be considered before you start the
125\f[V]jstatd\f[R] process, particularly in production environments or on
126networks that aren\[aq]t secure.
127.PP
128For security purposes, the \f[V]jstatd\f[R] server uses an RMI
129ObjectInputFilter to allow only essential classes to be deserialized.
130.PP
131If your security concerns can\[aq]t be addressed, then the safest action
132is to not run the \f[V]jstatd\f[R] server and use the \f[V]jstat\f[R]
133and \f[V]jps\f[R] tools locally.
134However, when using \f[V]jps\f[R] to get a list of instrumented JVMs,
135the list will not include any JVMs running in docker containers.
136.SH REMOTE INTERFACE
137.PP
138The interface exported by the \f[V]jstatd\f[R] process is proprietary
139and guaranteed to change.
140Users and developers are discouraged from writing to this interface.
141.SH EXAMPLES
142.PP
143The following are examples of the \f[V]jstatd\f[R] command.
144The \f[V]jstatd\f[R] scripts automatically start the server in the
145background.
146.SH INTERNAL RMI REGISTRY
147.PP
148This example shows how to start a \f[V]jstatd\f[R] session with an
149internal RMI registry.
150This example assumes that no other server is bound to the default RMI
151registry port (port \f[V]1099\f[R]).
152.RS
153.PP
154\f[V]jstatd\f[R]
155.RE
156.SH EXTERNAL RMI REGISTRY
157.PP
158This example starts a \f[V]jstatd\f[R] session with an external RMI
159registry.
160.IP
161.nf
162\f[CB]
163rmiregistry&
164jstatd
165\f[R]
166.fi
167.PP
168This example starts a \f[V]jstatd\f[R] session with an external RMI
169registry server on port \f[V]2020\f[R].
170.IP
171.nf
172\f[CB]
173jrmiregistry 2020&
174jstatd -p 2020
175\f[R]
176.fi
177.PP
178This example starts a \f[V]jstatd\f[R] session with an external RMI
179registry server on port \f[V]2020\f[R] and JMX connector bound to port
180\f[V]2021\f[R].
181.IP
182.nf
183\f[CB]
184jrmiregistry 2020&
185jstatd -p 2020 -r 2021
186\f[R]
187.fi
188.PP
189This example starts a \f[V]jstatd\f[R] session with an external RMI
190registry on port 2020 that\[aq]s bound to
191\f[V]AlternateJstatdServerName\f[R].
192.IP
193.nf
194\f[CB]
195rmiregistry 2020&
196jstatd -p 2020 -n AlternateJstatdServerName
197\f[R]
198.fi
199.SH STOP THE CREATION OF AN IN-PROCESS RMI REGISTRY
200.PP
201This example starts a \f[V]jstatd\f[R] session that doesn\[aq]t create
202an RMI registry when one isn\[aq]t found.
203This example assumes an RMI registry is already running.
204If an RMI registry isn\[aq]t running, then an error message is
205displayed.
206.RS
207.PP
208\f[V]jstatd -nr\f[R]
209.RE
210.SH ENABLE RMI LOGGING
211.PP
212This example starts a \f[V]jstatd\f[R] session with RMI logging
213capabilities enabled.
214This technique is useful as a troubleshooting aid or for monitoring
215server activities.
216.RS
217.PP
218\f[V]jstatd -J-Djava.rmi.server.logCalls=true\f[R]
219.RE
220