Installation and configuration of kafka on Alibaba Cloud

Download kafka address:

https://www.apache.org/dyn/closer.cgi?path=/kafka/1.1.0/kafka_2.11-1.1.0.tgz

Mirror download kafka

wget http://mirrors.hust.edu.cn/apache/kafka/1.1.0/kafka_2.11-1.1.0.tgz

then unzip

tar -zxvf  kafka_2.11-1.1.0.tgz

Go to the kafka directory:

kafka is based on zookeeper, but kafka comes with zookeeper; then go to the /bin directory


start up 


Take a look at the startup

 vim nohup.out 

start kafka

./bin/kafka-server-start.sh config/server.properties 

Startup error:

Java HotSpot(TM) Server VM warning: INFO: os::commit_memory(0xa6e00000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)

Treatment plan:

Modify the startup file

Modify kafka-server-start.sh to export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"  

Change to export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M" 

Continue to start the error:

Caused by: java.net.UnknownHostException: iZuf68tztea6l5ccdz7wemZ: iZuf68tztea6l5ccdz7wemZ: Name or service not known

Treatment plan:

vi /etc/hosts
127.0.0.1 izwz920j4zsv1qvh2kt0efz

izwz920j4zsv1qvh2kt0efz is your own hostname

Then start successfully

Configure extranet access

vim config/server.properties 

# The id of the broker. This must be set to a unique integer for each broker.

broker.id=0

port=9092

host.name=Alibaba cloud intranet address

advertised.host.name=Alibaba Cloud external network mapping address

Start kafka in the background

 nohup ./bin/kafka-server-start.sh config/server.properties &


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324815450&siteId=291194637