日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ssh 执行远程命令卡住问题解决

發布時間:2024/1/1 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ssh 执行远程命令卡住问题解决 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

問題現象

我這邊執行的pc-ctl命令,這個是tidb的pd命令行工具
命令本地會自行的結果如下:

[root@centos7 ~]# /root/pd-ctl -u 10.226.157.132:2900 region {"count": 1,"regions": [{"id": 2,"start_key": "","end_key": "","epoch": {"conf_ver": 128,"version": 9},"peers": [{"id": 65,"store_id": 28},{"id": 66,"store_id": 11},{"id": 70,"store_id": 31},{"id": 71,"store_id": 4},{"id": 75,"store_id": 6}],"leader": {"id": 70,"store_id": 31},"approximate_size": 4986}] }[root@centos7 ~]#

但是通過ssh遠程執行pd-ctl會卡住

[root@centos7 ~]# ssh root@127.0.0.1 "/root/pd-ctl -u 10.226.157.132:2900 region" The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established. ECDSA key fingerprint is SHA256:yWPZSs92gAknt9ycN17tNs9NBZGIF/RA0PSn9evBx7o. ECDSA key fingerprint is MD5:00:74:b3:d5:bc:2f:14:dc:8a:e6:88:03:12:9f:7f:67. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts. root@127.0.0.1's password: #輸入密碼后卡住了^CKilled by signal 2. #通過ctrl + c停止 [root@centos7 ~]#

解決方法

是用ssh -t 就可以了

[root@centos7 ~]# ssh -t root@127.0.0.1 "/root/pd-ctl -u 10.226.157.132:2900 region" root@127.0.0.1's password: {"count": 1,"regions": [{"id": 2,"start_key": "","end_key": "","epoch": {"conf_ver": 128,"version": 9},"peers": [{"id": 65,"store_id": 28},{"id": 66,"store_id": 11},{"id": 70,"store_id": 31},{"id": 71,"store_id": 4},{"id": 75,"store_id": 6}],"leader": {"id": 70,"store_id": 31},"approximate_size": 4986}] }Connection to 127.0.0.1 closed. [root@centos7 ~]#

man ssh 查看-t參數的含義如下:

-t Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful,e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.#強制偽終端分配。 這可用于在遠程機器上執行任意基于屏幕的程序,這非常有用,例如 實現菜單服務時。 多個 -t 選項強制分配 tty,即使 ssh 沒有本地 tty。

總結

以上是生活随笔為你收集整理的ssh 执行远程命令卡住问题解决的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。