我正在运行一个autossh脚本使用暴发户ssh隧道/端口转发到我的postgresql数据库。 它看起来像这样:
# Remote server role: database-master # Remote hostname: srv-08.aa.com # Local/remote port: 5432 # autossh startup Script http://www.async.fi/2013/07/autossh-with-ubuntu-upstart/ description "autossh tunnel for role database-master to srv-08.aa.com:5432" start on (local-filesystems and net-device-up IFACE=eth0) stop on runlevel [016] respawn respawn limit 5 60 # respawn max 5 times in 60 seconds exec autossh \ -M 0 \ -N \ -L 5432:localhost:5432 \ -o "ServerAliveInterval=60" \ -o "ServerAliveCountMax=3" \ -o "BatchMode=yes" \ -i /home/the_user/.ssh/id_rsa \ [email protected]
我一般的转发工作很好。 然而,有时,例如,当远程服务器重新启动postgresql服务,它发生隧道变得无用(无法通过它连接),并在/var/log/upstart/autossh-master-db-tunnel.log我看到发生以下错误:
channel 2: open failed: administratively prohibited: open failed channel 2: open failed: administratively prohibited: open failed channel 2: open failed: administratively prohibited: open failed channel 2: open failed: administratively prohibited: open failed channel 2: open failed: administratively prohibited: open failed channel 2: open failed: administratively prohibited: open failed
这继续下去,直到我做一个sudo restart autossh-master-db-tunnel然后一切再次工作。
什么是错的,我该如何解决? 或者一开始就更聪明些?