我正在尝试将远程(ec2)端口转发到本地端口,以便在我的本地浏览器中观看在amazon ec2集群上运行的jobtracker。但无法转发远程端口。
这是我的代码:
Net::SSH.start('ec2-23-23-4-229.compute-1.amazonaws.com' ,'hadoop' ,:keys =>"mykeypair.pem",:forward_agent => true) do |ssh|
ssh.forward.remote(9033, "localhost",9101,"ec2-23-22-4-249.compute-1.amazonaws.com")
ssh.loop { !ssh.forward.active_remotes.include?([9033, "localhost"]) }
end
答案 0 :(得分:0)
根据原始海报:
找到解决方案。它可能对某人有所帮助:
ssh=Net::SSH.start(dns, 'hadoop' ,:keys => ["src/#{$parameters_hash['pem_file_name']}"],:forward_agent => true) ssh.forward.local(port_available, 'localhost', 9100)