下载地址:Apache Kafka
#创建应用目录 mkdir -p /storage
# wget -P /storage https://archive.apache.org/dist/kafka/2.3.0/kafka_2.11-2.3.0.tgz
#解压kafka应用包 tar -zxf kafka_2.11-2.3.0.tgz 修改目录名 mv kafka_2.11-2.3.0 kafka
根据实际情况创建需要的目录
修改配置文件:cd /storage/kafka/config
[root@test config]# cat zookeeper.properties
# limitations under the License.
# the directory where the snapshot is stored.
dataDir=/storage/zookeeper/data/zookeeper
dataLogDir=/storage/zookeeper/logs/zookeeper
# the port at which the clients will connect
clientPort=2181
# disable the per-ip limit on the number of connections since this is a non-production config
#maxClientCnxns=0
#为zk的基本时间单元,毫秒
tickTime=2000
#Leader-Follower初始通信时限 tickTime*10
initLimit=10
#Leader-Follower同步通信时限 tickTime*5
syncLimit=5
#设置broker Id的服务地址
server.1=192.168.19.128:2888:3888
根据server.id,创建zookeeper的myid
echo 1 > /storage/kafka/data/zookeeper/myid
[root@test config]# cat server.properties
# broker 的全局唯一编号,不能重复,每台机器递增设置
broker.id=1
#服务器监听地址
listeners=SASL_PLAINTEXT://192.168.19.128:9092,client2://192.168.19.128:9093
#外部访问监听地址,根据服务器监听地址映射端口
advertised.listeners=SASL_PLAINTEXT://192.168.19.128:9092,client2://192.168.19.128:9093
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL,client2:SASL_PLAINTEXT,client3:SASL_PLAINTEXT
# 使用的认证协议
security.inter.broker.protocol=SASL_PLAINTEXT
#SASL机制
sasl.enabled.mechanisms=PLAIN
sasl.mechanism.inter.broker.prot