Host
>> from notebook.auth import passwd
>> passwd()
Enter password:
Verify password:
'sha1:673a8456a8e8:4377bd9ee8dc33d4cb5a2011f7a89643de15c11c'
# vi .jupyter-config.py
c.NotebookApp.ip = 'localhost'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8081
c.NotebookApp.password =u'sha1:c0792e86dce2:e6fe5ee529a238b0dc33f4f1960499d6fbd02927'
nohup jupyter notebook --config=.jupyter-config.py >> nohup.out &!
Client
ssh -N -f -L 127.0.0.1:8888:127.0.0.1:8081 chencanyi2018@10.224.255.112 -p 5102 # Node A
-
-N
:不执行任何命令
-
-f
:后台运行
-
-L
:转发端口
-
-vvv
:调试
跳板机
sudo apt-get install autossh
autossh -N -f -L 127.0.0.1:8888:127.0.0.1:8081 chencanyi2018@10.0.0.2 -p 22 # Node B
ssh -N -f -L 127.0.0.1:8887:127.0.0.1:8888 chencanyi2018@116.196.81.58 -p 22 # Node C
cat .zshrc
# alias jupyter_gpu="ssh -N -f -L 127.0.0.1:8887:127.0.0.1:8888 chencanyi2018@116.196.81.58 -p 22"
kill nohup
ps -eaf | grep "jupyter" | grep -v grep | awk '{ print $2 }' | xargs kill -9
References
网友评论