如标题所述,我该如何知道在CentOS中安装了哪个版本的Spark?
当前系统已安装cdh5.1.0。
如标题所述,我该如何知道在CentOS中安装了哪个版本的Spark?
当前系统已安装cdh5.1.0。
SparkContext.version
。您可以使用spark-submit命令:
spark-submit --version
使用
spark.version
spark
变量是一个SparkSession
对象。
spark-shell
开始时使用控制台日志[root@bdhost001 ~]$ spark-shell
Setting the default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel).
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.2.0
/_/
spark-shell --version
[root@bdhost001 ~]$ spark-shell --version
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.2.0
/_/
Type --help for more information.
spark-submit --version
[root@bdhost001 ~]$ spark-submit --version
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.2.0
/_/
Type --help for more information.
spark2-shell --version
或者 spark2-submit --version
。 - mrsrinivas如果你正在使用 Databricks 并与笔记本交互,只需运行:
spark.version
如果你正在使用pyspark,你可以在下面显示的粗体Spark标志旁看到正在使用的Spark版本:
manoj@hadoop-host:~$ pyspark
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel).
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/__ / .__/\_,_/_/ /_/\_\ version 1.6.0
/_/
Using Python version 2.7.6 (default, Jun 22 2015 17:58:13)
SparkContext available as sc, HiveContext available as sqlContext.
>>>
如果您想明确获取Spark版本,可以使用下面显示的SparkContext版本方法:
>>>
>>> sc.version
u'1.6.0'
>>>
如果您使用的是Zeppelin笔记本,可以运行以下命令:
sc.version
要知道Scala版本,您可以运行以下命令:
util.Properties.versionString
使用以下命令获取Spark版本号:
spark-submit --version
如果您想通过程序打印版本,请使用以下方法
from pyspark.sql import SparkSession
spark = SparkSession.builder.master("local").getOrCreate()
print(spark.sparkContext.version)
<property object at 0x7f8d2afb2998>
。 - Piko Monde