本地机器(Git Bash(新版Windows10也可以直接使用命令))
1 2
| scp ./jdk-8u91-linux-x64.tar.gz root@公网IP:/root scp ./kafka_2.12-2.2.0.tgz root@公网IP:/root
|
云服务器登录后
1 2 3 4 5 6 7 8 9 10 11 12
| tar zxvf jdk-8u91-linux-x64.tar.gz mv jdk1.8.0_91 /opt/java
JAVA_HOME=/opt/java PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME PATH
java -version
tar zxvf kafka_2.12-2.2.0.tgz cd kafka_2.12-2.2.0 vi config/server.properties
|
将listeners=PLAINTEXT://:9092注释去掉
将advertised.listeners=PLAINTEXT://your.host.name:9092注释去掉,your.host.name改成公网IP
1 2 3 4 5 6
| bin/zookeeper-server-start.sh -daemon config/zookeeper.properties bin/kafka-server-start.sh -daemon config/server.properties bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test bin/kafka-topics.sh --list --zookeeper localhost:2181 bin/kafka-console-producer.sh --broker-list 公网IP:9092 --topic test bin/kafka-console-consumer.sh --bootstrap-server 公网IP:9092 --topic test --from-beginning
|