In the customer site and some special environment was underlined by the N power of the pit, but also to help a lot of people to solve many times the host name with underlined pit events, here record two typical case analysis, I hope you can see the pit is mining.

No.1 Kafka The host name is underlined

Kafka starts with an error when the host name of the host on which you installed the kafka instance is underlined:

(kafka. Server. KafkaConfig) [the 12:14:20 2018-04-13, 779] FATAL (kafka. Kafka $) mon. Kafka.com KafkaException: Unable to parse PLAINTEXT://news_bj_kafka1:9092 to a broker endpoint at kafka.cluster.EndPoint$.createEndPoint(EndPoint.scala:49) at kafka.utils.CoreUtils$$anonfun$listenerListToEndPointsThe $1.apply(CoreUtils.scala:309)
	at kafka.utils.CoreUtils$$anonfun$listenerListToEndPointsThe $1.apply(CoreUtils.scala:309)
	at scala.collection.TraversableLike$$anonfun$mapThe $1.apply(TraversableLike.scala:244)
	at scala.collection.TraversableLike$$anonfun$mapThe $1.apply(TraversableLike.scala:244)
Copy the code

From kafka.com mon. KafkaException: Unable to parse PLAINTEXT://news_bj_kafka1:9092 to a broker endpoint That’s because hostnames with underscores ‘_’ are not valid, kafka doesn’t parse your hostnames with underscores, So when you configure the kafka configuration file with host.name or advertise.host. name the host name should not contain _ or. Is a special character.

About the parameters of kafka advertised. Host. Name, advertised. Listeners, advertised. The port and host. The name you can refer to the following link to understand: https://kafka.apache.org/090/documentation.html#brokerconfigs http://www.cnblogs.com/snifferhu/p/5102629.html

No.2 Hadoop host name marked with underscores

If the host name of the hadoop cluster is underlined, hadoop startup error is as follows:

ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: java.lang.IllegalArgumentException: Does not contain a valid host:port authority: hdfs://news_bj_hm1:9000
Copy the code

Does not contain a valid host:port Does not contain a valid host:port.

Education significance

While Linux supports some special characters, Java does not; However, in general, a hyphen (-) is acceptable, and I have verified that the hyphen (-) is supported when deploying Kafka and Hadoop clusters.

When we want to do a large-scale host naming specification online, I hope you should remember not to underline (_), don’t listen to some people nonsense, who knows who pain; Unless all of your online configuration is based on IP address publishing, you should be careful.