启动pyspark报错,如下:
[root@hadoop-senior spark-1.6.0-cdh5.13.0]# pyspark
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] 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).
18/09/17 10:39:29 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
18/09/17 10:39:30 WARN SparkConf:
SPARK_WORKER_INSTANCES was detected (set to '1').
This is deprecated in Spark 1.0+.
Please instead use:
- ./spark-submit with --num-executors to specify the number of executors
- Or set SPARK_EXECUTOR_INSTANCES
- spark.executor.instances to configure the number of instances in the spark config.
Traceback (most recent call last):
File "/opt/cdh5.13.0/spark-1.6.0-cdh5.13.0/python/pyspark/shell.py", line 43, in <module>
sc = SparkContext(pyFiles=add_files)
File "/opt/cdh5.13.0/spark-1.6.0-cdh5.13.0/python/pyspark/context.py", line 115, in __init__
conf, jsc, profiler_cls)
File "/opt/cdh5.13.0/spark-1.6.0-cdh5.13.0/python/pyspark/context.py", line 176, in _do_init
self._accumulatorServer = accumulators._start_update_server()
File "/opt/cdh5.13.0/spark-1.6.0-cdh5.13.0/python/pyspark/accumulators.py", line 259, in _start_update_server
server = AccumulatorServer(("localhost", 0), _UpdateRequestHandler)
File "/usr/lib64/python2.6/SocketServer.py", line 412, in __init__
self.server_bind()
File "/usr/lib64/python2.6/SocketServer.py", line 423, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.gaierror: [Errno -2] Name or service not known
>>>
解决方法:在/etc/hosts添加“127.0.0.1 localhost”这个映射