如何在两跳SSH隧道中使用JProfiler [英] How to use JProfiler over two-hop SSH tunnel

查看:668
本文介绍了如何在两跳SSH隧道中使用JProfiler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将JProfiler连接到运行在我称之为远程的服务器上的JVM。此服务器只能通过我的工作站(本地)通过另一台我称之为中间的服务器访问。我将JProfiler连接到远程的计划如下:


  1. 上安装JProfiler工具远程


  2. 建立从本地中间的SSH隧道远程



    ssh -v -N -L 8849:[remote的私人地址(192.168 ......等)]:8849 [middle]


  3. localhost:8849 上建立一个新的JProfiler会话,选择立即启动,稍后使用JProfiler GUI连接

但是,我最终收到错误:


连接错误



旧版本的使用本机库或另一个
应用程序正在侦听端口8849.请检查
DYLD_LIBRARY_PATH环境变量和您的端口配置


我没有任何其他程序b除了我的SSH隧道,我还确认SSH隧道本身应该正常工作 - 我能够将测试HTTP服务器的连接从远程转发到本地通过类似配置的隧道。



我发现这个类似的问题,但没有提供解决方案。



我的配置中缺少什么?

解决方案

使用



建立直接隧道

  ssh -t user @ remote -L [localPort]:localhost:[remotePort] -N 

使用链式ssh命令构建 2跳隧道

  ssh -t user @ middle -L [localPort]:localhost:[remotePort] \ 
ssh -t user @ remote -L [remotePort]:localhost:[remotePort] -N

其中 localPort 是您要在本地使用的端口, remotePort 是配置文件代理正在侦听的端口。所有这些都在本地计算机上的单个命令中执行。可以使用第一行中的其他ssh调用添加更多跃点。对于整个命令,必须只有一个尾随 -N



这种方法适用于JProfiler。



如果隧道出现故障或者分析代理没有侦听,您将收到您提到的消息,因为在SSH隧道的情况下连接失败的方式。 / p>

I'm trying to connect JProfiler to a JVM running on a server that I'll call remote. This server is only accessible from my workstation (local) via another server that I'll call middle. My plan for connecting JProfiler to remote was this:

  1. Install the JProfiler instrumentation on remote

  2. Establish SSH tunnel from local, through middle, to remote:

    ssh -v -N -L 8849:[remote's private address (192.168... etc)]:8849 [middle]

  3. Establish a new JProfiler session on localhost:8849, choosing "Startup immediately, connect later with JProfiler GUI"

However, I end up getting an error:

Connection error

Either an old version of the native library is used or another application is listening on port 8849. Please check your DYLD_LIBRARY_PATH environment variable and your port configuration

I don't have any other programs bound to local port 8849, aside from my SSH tunnel, and I have confirmed that the SSH tunnel itself should be working correctly - I'm able to forward connections for a test HTTP server from remote to local via a similarly configured tunnel.

I found this similar question, but no solution was provided.

What am I missing from my configuration?

解决方案

A direct tunnel is established with

ssh -t user@remote -L [localPort]:localhost:[remotePort] -N

A 2-hop tunnel is built with chained ssh commands:

ssh -t user@middle -L [localPort]:localhost:[remotePort] \
ssh -t user@remote -L [remotePort]:localhost:[remotePort] -N

where localPort is the port you want to use locally, and remotePort is the port that the profiling agent is listening on. All of this is executed in a single command on your local machine. More hops can be added with additional ssh calls like in the first line. There must by exactly one trailing -N for the entire command.

This approach works with JProfiler.

If the tunnels fails or if the profiling agent is not listening, you will get the message that you mentioned because of the way that the connection fails in the case of an SSH tunnel.

这篇关于如何在两跳SSH隧道中使用JProfiler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆