Spark集羣IDE配置

1、jupyter notebook

修改配置文件

(a) 在個人賬戶下建立配置文件:jupyter notebook --generate-config

(b) Python環境下設置密碼:

>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:d66351142f0a:9eea3d7f99e434a6837f5e73af18d03cf0353392'(複製此行密碼)
>>>exit()

© 打開jupyter notebook --generate-config文件:
/home/***(用戶名)/.jupyter/jupyter_notebook_config.py
(d)

c.NotebookApp.ip='*'                        # * 代表所有iP都能訪問 ,也可以指定ip
c.NotebookApp.password =u'sha1:d66351142f0a:9eea3d7f99e434a6837f5e73af18d03cf0353392'       # 剛纔複製的那個密文
c.NotebookApp.open_browser = False       # 禁止自動打開瀏覽器
c.NotebookApp.port =9444                         #指定一個端口
c.NotebookApp.port_retries = 50
c.NotebookApp.notebook_dir = '/home/user'  #指定工作空間
c.PAMAuthenticator.encoding = 'utf8'   
c.NotebookApp.allow_remote_access =True #出現錯誤就陪着這個

(e)爲notebook配置spark環境
編輯 user/.bashrc,增加:

export SPARK_HOME=/home/hadoop/spark-2.4.2-bin-hadoop2.6
export PATH=$SPARK_HOME/bin:$PATH
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS='notebook'

source .bashrc,然後在終端輸入pysaprk,就會啓動notebook。

2、VScode

1、安裝插件Remote-SSH
2、F1,輸入ssh,找到Remote-SSH:settings
2.1 找到Remote.SSH: Show Login Terminal,勾選Always reveal the SSH login terminal.
2.2 配置config,此處有個坑,windows會出現權限問題,不能用默認config。解決辦法是使用另外的config文件並在,在Remote-SSH:settings,填寫Remote.SSH: Config File路徑。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章