做三国mod的网站,国际商务网站,自己网站做搜索引擎优化,深圳摇号申请注册阅读目录#xff1a;1. 关闭防火墙和Selinux2. 安装所需环境JDK,Zookeeper3. 下载Kafka 1.0.0版本4. 配置Kafka5. 启动Kafka并验证6. 报错及解决7. 说明1. 关闭防火墙和SelinuxLinux的防火墙是咱们新手的噩梦#xff0c;很多情况会出现能ping通#xff0c;但是访问不了Web页…阅读目录1. 关闭防火墙和Selinux2. 安装所需环境JDK,Zookeeper3. 下载Kafka 1.0.0版本4. 配置Kafka5. 启动Kafka并验证6. 报错及解决7. 说明1. 关闭防火墙和SelinuxLinux的防火墙是咱们新手的噩梦很多情况会出现能ping通但是访问不了Web页面。所以开始就干掉它1.1 关闭防火墙[rootlocalhost ~]# /etc/init.d/iptables stopiptables: Setting chains to policy ACCEPT: filter [ OK ]iptables: Flushing firewall rules: [ OK ]iptables: Unloading modules: [ OK ]1.2 开机自动关闭防火墙[rootlocalhost ~]# chkconfig iptables off1.3 查看Selinux状态[rootlocalhost ~]# sestatusSELinux status: enabledSELinuxfs mount: /sys/fs/selinuxSELinux root directory: /etc/selinuxLoaded policy name: targetedCurrent mode: enforcingMode from config file: enforcingPolicy MLS status: enabledPolicy deny_unknown status: allowedMax kernel policy version: 281.4 关闭selinux[rootlocalhost ~]# vim /etc/selinux/config修改 SELINUXdisabled注永久开启-改成SELINUXenforcing2. 安装所需环境JDK,Zookeeper3. 下载Kafka 1.0.0版本注创建一个kafka消息目录主要存放kafka消息[rootlocalhost /]# mkdir /usr/local/kafka[rootlocalhost /]# mkdir /usr/local/kafka/kafka-logs3.1 下载Kafka 1.0.0版本[rootlocalhost /]# cd /usr/local/kafka[rootlocalhost kafka]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/1.0.0/kafka_2.12-1.0.0.tgz3.2 解压[rootlocalhost kafka]# tar -zxvf kafka_2.12-1.0.0.tgz4.配置并启动Kafka4.1 进入到config目录[rootlocalhost kafka]# cd /usr/local/kafka/kafka_2.12-1.0.0/config4.2 备份并修改server.properties[rootlocalhost config]# cp server.properties server.properties.bak[rootlocalhost config]# vim server.properties修改标红的三行,# Licensed to the Apache Software Foundation (ASF) under one or more# contributor license agreements. See the NOTICE file distributed with# this work for additional information regarding copyright ownership.# The ASF licenses this file to You under the Apache License, Version 2.0# (the License); you may not use this file except in compliance with# the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an AS IS BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.# see kafka.server.KafkaConfig for additional details and defaults############################# Server Basics ############################## The id of the broker. This must be set to a unique integer for each broker.broker.id0############################# Socket Server Settings ############################## The address the socket server listens on. It will get the value returned from# java.net.InetAddress.getCanonicalHostName() if not configured.# FORMAT:# listeners listener_name://host_name:port# EXAMPLE:# listeners PLAINTEXT://your.host.name:9092#listenersPLAINTEXT://:9092port9092#这是你本机的ip地址host.name172.17.44.141# returned from java.net.InetAddress.getCanonicalHostName().#advertised.listenersPLAINTEXT://your.host.name:9092num.network.threads3# The send buffer (SO_SNDBUF) used by the socket serversocket.send.buffer.bytes102400socket.request.max.bytes104857600############################# Log Basics ############################## A comma seperated list of directories under which to store log fileslog.dirs/usr/local/kafka/kafka-logs# The default number of log partitions per topic. More partitions allow greater# parallelism for consumption, but this will also result in more files across# the brokers.num.partitions1....4.3 配置Kafka环境变量[rootlocalhost config]# vim /etc/profile在文本末最后一行添加如下代码export KAFKA_HOME/usr/local/kafka/kafka_2.12-1.0.0export PATH$KAFKA_HOME/bin:$PATH保存退出。4.4 使配置立即生效[rootlocalhost config]# source /etc/profile5. 启动Kafka并验证5.1 启动zookeeper服务[rootlocalhost config]# /usr/local/zookeeper/zookeeper-3.4.11/bin/zkServer.sh start5.2 进入到kafka的bin目录[rootlocalhost config]# cd /usr/local/kafka/kafka_2.12-1.0.05.3 启动kafka[rootlocalhost kafka_2.12-1.0.0]# bin/kafka-server-start.sh config/server.properties 5.4 验证[rootlocalhost kafka_2.12-1.0.0]# jps3584 Jps3299 QuorumPeerMainl3519 Kafka5.5 关闭kafka命令[rootlocalhost kafka_2.12-1.0.0]# bin/kafka-server-stop.sh6. 报错及解决启动kafka报错[rootlocalhost kafka_2.12-1.0.0]# bin/kafka-server-start.sh config/server.properties Exception in thread main java.lang.UnsupportedClassVersionError: kafka/Kafka : Unsupported major.minor version 52.0解决请查看kafka对应的jdk版本此次选用JDK版本为1.87. 说明说明本次使用操作系统CentOS 6.8 64位Kafka版本1.0.0JDK版本1.8.0_144