scala
[spark] .java.net.BindException: Can't assign requested address: Service 'sparkDriver' failed after 16 retries!
'김용환'
2019. 2. 22. 04:05
spark 앱을 로컬(Intellij)에서 테스트/실행할 때
아래와 같이 SparkDriver 를 바인딩하지 못해 에러가 나는 경우가 종종 발견할 수 있다.
WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
..java.net.BindException: Can't assign requested address: Service 'sparkDriver' failed after 16 retries!
이럴 때는 다음 코드를 참조해서 SparkConf 인스턴스를 생성할 때 다음 코드로 수정한다. 더 이상 발생하지 않을 것이다.
lazy val sparkConf: SparkConf = new SparkConf().setMaster("local[1]") //상관없음
.setAppName("spark-test")
.set("spark.driver.host", "localhost"); // 반드시 필수