Spark bind on port 0. Attempting port 1 problem Resolution
Linux running spark local bind on port 0. Attempting port 1
2016-11-01 16:04:56 [org.apache.spark.util.Utils]-[WARN] - Service 'sparkDriver' could not bind on port 0. Attempting port 1.
2016-11-01 16:04:56 [org.apache.spark.SparkContext]-[ERROR] - Error initializing SparkContext.
java.net.BindException: Can't assign requested address: Service 'sparkDriver' failed after 16 retries! Consider explicitly setting the appropriate port for the service 'sparkDriver' (for example spark.ui.port for SparkUI) to an available port or increasing spark.port.maxRetries.
The reason is that the IP address corresponding to the host cannot be found, not the port binding is incorrect.
Add the following code to hosts
127.0.0.1 hostname
The username here is written according to the actual situation, so that spark local can find the local corresponding ip, and the startup is successful.