---
schema_version: "1"
id: adf484f681fee843152dd6bc0ebf44f015d8a566d006e2fe9c5823befe6e5d2f
title: 启用 JMX 端口
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/server-linux/ports_jmx.md
canonical_url: https://help.tableau.com/current/server-linux/zh-cn/ports_jmx.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 86b3e2588ba16513116ee13b6e7cd7f8acd012e89bbdde4c9e431f13b9bd066b
description: Enable the JMX ports on Tableau Server for monitoring and troubleshooting.
---
[跳转到主要内容](#main-content)

# 启用 JMX 端口

为帮助您解决 Tableau Server 的问题，Tableau 支持人员可能会要求您启用服务器的 JMX 端口。这些端口对于通常使用像 JConsole 这样的工具进行监视和故障排除的情况会非常有用。在版本 2022.1 及更高版本中，可以安全地启用 JMX 端口，这是推荐的方法。在 2022.1 之前的版本中，您只能启用不安全的端口。

## 启用安全的 JMX 端口

从 Tableau Server 的版本 2022.1 开始，您可以安全地启用 JMX 端口。本过程介绍了如何启用安全的 JMX。若要在早期版本中启用 JMX，请参见下面的[启用不安全的 JMX 端口](#EnableUnsecureJMX)。

在 Tableau Server 上启用安全的 JMX 端口：

1. 以具有 `sudo` 访问权限的用户身份登录到安装了 TSM 的计算机。
2. 运行此命令：
    
    tsm maintenance jmx enable
    
    该命令有几个选项，您可以在运行时提供。如果您在运行命令时未提供任何选项，系统将根据您给出的答案提示您提供选项。
    
    例如：
    
    C:\\Windows\\system32>tsm maintenance jmx enable
    We do not recommend you enable JMX unsecured on a production environment. Would you like to enable security features for JMX?
    (y/n): y
    JMX access is readonly by default. Would you like to add readwrite access?
    (y/n): n
    Would you like to enable SSL?
    (y/n): y
    Would you like to require client authentication (mTLS)?
    (y/n): n
    Enabling JMX with the specified settings. This will perform a server restart. Do you want to continue?
    (y/n): y
    Starting enable JMX asynchronous job.
    
    有关该命令及其选项的详细信息，请参见[tsm maintenance jmx enable](https://help.tableau.com/current/server-linux/zh-cn/cli_maintenance_tsm.htm#jmx_enable)。

启用不安全的 JMX 端口

对于 2022.1.0 之前的 Tableau Server 版本，如果您启用 JMX 端口，则只能以不安全的方式启用它们。

**重要信息**：启用不安全的 JMX 端口可能会引入一些安全风险。我们强烈建议使用安全的 JMX。如果您没有支持这一点的 Tableau Server 版本，请注意风险，并通过将 JMX 端口的访问限制为对您的场景实用的最少客户端数量来减轻风险。您通常使用主机防火墙规则、外部安全设备或路由规则来限制访问。

在 Tableau Server 上启用不安全的 JMX 端口：

1. [停止服务器。](https://help.tableau.com/current/server-linux/zh-cn/cli_stop_tsm.htm#stop)
2. 输入以下命令：
    
    ```
    tsm configuration set -k service.jmx_enabled -v true
    ```
3. 应用待处理的更改：
    
    ```
    tsm pending-changes apply
    ```
    
    如果待定更改需要重新启动服务器，`pending-changes apply` 命令将显示一个提示，告知您将进行重新启动。即使服务器已停止，此提示也会显示，但在这种情况下不会重新启动。您可以使用 `--ignore-prompt` 选项隐藏提示，但这样做不会改变重新启动行为。如果更改不需要重新启动，则会在不提示的情况下应用更改。有关详细信息，请参见[tsm pending-changes apply](https://help.tableau.com/current/server-linux/zh-cn/cli_pending-changes.htm#pending-changes-apply)。
4. （以 _tableau_ 系统帐户身份）重新启动协调服务和 TSM 管理控制器：
    
    `sudo su -l tableau -c "systemctl --user restart appzookeeper_0.service"`
    
    `sudo su -l tableau -c "systemctl --user restart tabadmincontroller_0.service"`
    
    tabadmincontroller 可能需要几分钟才会重新启动。如果尝试在下一步中控制器重新启动之前应用待处理更改，则 TSM 将无法连接到控制器。您可以使用 `tsm status -v` 命令验证控制器是否正在运行。Tableau Server 管理控制器应列为“正在运行”。
5. [启动服务器](https://help.tableau.com/current/server-linux/zh-cn/cli_start_tsm.htm#start)。

## 如何确定 JMX 端口

默认情况下，会从可用端口范围内动态分配 JMX 端口。有关如何完成端口分配以及如何覆盖动态映射的详细信息，请参见[Tableau 服务管理器端口](https://help.tableau.com/current/server-linux/zh-cn/ports.htm)。