使用ssh端口转发运行Erlang Observer [英] Run Erlang Observer with ssh port forwarding

查看:180
本文介绍了使用ssh端口转发运行Erlang Observer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个远程Erlang节点和本地开发人员的PC.我要启动本地节点debug@127.0.0.1,启动观察器,调用c:nl/1和其他调试操作.我是这样写的:

I have a remote Erlang node and local developer's PC. I want to start local node debug@127.0.0.1, start observer, call c:nl/1 and other debug actions. I wrote this:

   #!/bin/sh
   export ERL_EPMD_PORT=43690
   PORT=`ssh -l user target -p 5022 "/usr/bin/epmd -names" | awk '$2 == "target-node" {print $5}'`
   pkill -f ssh.*-fxN.*target
   ssh -fxNL 43690:`hostname`:4369 target -p 5022 -l user
   ssh -fxNL $PORT:`hostname`:$PORT target -p 5022 -l user
   ssh -fxNR 9001:`hostname`:9001 target -p 5022 -l user
   erl -name dev@127.0.0.1 -setcookie ABCDEFFJKGSK \
   -kernel inet_dist_listen_min 9001 inet_dist_listen_max 9001 \
   -eval "net_adm:ping('nodename@target')."
   pkill -f ssh.*-fxN.*target

但是当我运行此脚本时,会收到如下消息:

But when I run this script I get message like:

bind:地址已在使用中本地转发规范不正确 ':debian:'Erlang/OTP 17 [erts-6.1] [源代码] [64位] [smp:4:4] [async-threads:10] [kernel-poll:false]

bind: Address already in use Bad local forwarding specification ':debian:' Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]

Eshell V6.1(用^ G中止)(dev@127.0.0.1)1>

Eshell V6.1 (abort with ^G) (dev@127.0.0.1)1>

如何在本地计算机上运行观察器并将其连接到远程节点?

How can I run observer on local machine and connect them to the remote node?

推荐答案

至少有三件事:

  • 无法正确关闭TCP连接
  • 节点名称
  • 隧道错误

如果关闭进程,该进程与kill保持TCP连接,则它可以进入TIME_WAIT状态一两分钟:

If you close process, that holds TCP connection with kill it can go to TIME_WAIT state for a couple of minutes: read more

ssh -L port:host:hostport中,您有2个组成部分:

In the ssh -L port:host:hostport, you have 2 components:

  • 第一个是port,它说,请在我的 local 计算机上使用此端口
  • host:hostport的意思是:可以从远程机器连接到该主机和端口",您可以想象,您已经在远程机器上并且想要连接到第三台机器
  • first one is port and this says, use this port on my local machine
  • host:hostport mean: "connect to this host and port from remote machine", you can imagine, that you are already on the remote machine and you want to connect to the third one

您正在使用内部的hostname,该计算机在本地计算机上进行评估并返回debian,但这没有任何意义,因为在远程计算机上,debian可能没有任何意义.尝试使用:

You are using hostname inside, which is evaluated on your local machine and returns debian and this doesn't make sense, because probably debian doesn't mean anything on your remote machine. Try using:

ssh -fxNR 9001:localhost:9001 target -p 5022 -l user

这应该可以正常工作,而不会出现有关规范的错误.

This should work as expected without the error about specification.

Erlang Distributed使用节点名称来定位计算机.在您的本地节点上,您正在呼叫:

Erlang distributed uses node names to locate the machines. On your local node you are calling:

net_adm:ping('nodename@target').

试图直接在目标上联系端口4369,而不进行端口转发.

which tries to contact port 4369 directly on target without port forwarding.

Erlang分布式设计用于本地受信任的网络.很难通过端口转发进行设置. 您可以在远程计算机上启动调试节点并连接到系统-这应该很容易.如果远程系统具有X服务器,则您甚至可以转发观察者窗口(ssh -Y).

Erlang distributed was designed to be used in local trusted networks. It is really hard to set it up with port forwarding. You can start the debug node on the remote machine and connect to your system - this should be easy. If the remote system has X server, you can even forward the observer window (ssh -Y).

这篇关于使用ssh端口转发运行Erlang Observer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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