Error phenomenon:Java client programming as the consumer of Kafka, connecting Kafka's broker error650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/91/6A/wKiom1j12BGgUkKgAACUSA5Q0tU565.png-wh_500x0-wm_ 3-wmp_4-s_64493172.png "title=" Qq20170418170758.png "alt=" Wkiom1j12bggukkgaacusa5q0tu565.png-wh_50 "/>Error reason analysis:When the server configuration or network environment is poor, there will be a connection ZK time-out situation occurs
some time ago in the Kafka QQ Group was asked about this--about how Java consumer dynamically modify topic subscription issues. It's really a good question to think about it, because if you simply hold the consumer instance in another thread and then call subscribe to modify it, the consumer side will inevitably throw an exception Concurrentmodificationexception:kafkaconsumer is isn'tsafe for multi-threade
Big Data Architecture Development mining analysis Hadoop Hive HBase Storm Spark Flume ZooKeeper Kafka Redis MongoDB Java cloud computing machine learning video tutorial, flumekafkastorm
Training big data architecture development, mining and analysis!
From basic to advanced, one-on-one training! Full technical guidance! [Technical QQ: 2937765541]
Get the big data video tutorial and training address
Byt
Big Data Architecture Development mining analysis Hadoop HBase Hive Storm Spark Flume ZooKeeper Kafka Redis MongoDB Java cloud computing machine learning video tutorial, flumekafkastorm
Training big data architecture development, mining and analysis!
From basic to advanced, one-on-one training! Full technical guidance! [Technical QQ: 2937765541]
Get the big data video tutorial and training address
Byt
)); Stringdecoder Keydecoder = new Stringdecoder (new Verifiableproperties ());Stringdecoder Valuedecoder = new Stringdecoder (new Verifiableproperties ()); MapConsumer.createmessagestreams (Topiccountmap,keydecoder,valuedecoder);kafkastreamConsumeriterator int messagecount = 0;while (It.hasnext ()) {System.out.println (It.next (). message ());messagecount++;if (Messagecount = = 100) {SYSTEM.OUT.PRINTLN ("Consumer end of the total consumption of" + Messagecount + "Message! ");}}} public static v
frame: jQuery1.9.CSS Framework: Bootstrap 4 MetronicClient authentication: Jqueryvalidation Plugin.Rich Text: CkecitorFile Management: CkfinderDynamic tab: JerichotabData table: Jqgriddialog box: JQuery jboxTree structure controls: JQuery ZtreeOther components: Bootstrap 4 metronic3. SupportServer middleware: Tomcat 6, 7, Jboss 7, WebLogic 10, WebSphere 8Database support: Currently only support MySQL database, but not limited to the database, the next version of the upgrade multi-data source sw
frame: jQuery1.9.CSS Framework: Bootstrap 4 MetronicClient authentication: Jqueryvalidation Plugin.Rich Text: CkecitorFile Management: CkfinderDynamic tab: JerichotabData table: Jqgriddialog box: JQuery jboxTree structure controls: JQuery ZtreeOther components: Bootstrap 4 metronic3. SupportServer middleware: Tomcat 6, 7, Jboss 7, WebLogic 10, WebSphere 8Database support: Currently only support MySQL database, but not limited to the database, the next version of the upgrade multi-data source sw
-dependencies.jar# another window$ nc-lk 9999# input data2. Receive Kafka Data and Count (WordCount) Packagecom.xiaoju.dqa.realtime_streaming;ImportJava.util.*;Importorg.apache.spark.SparkConf;ImportOrg.apache.spark.api.java.JavaSparkContext;Importorg.apache.spark.api.java.function.FlatMapFunction;ImportOrg.apache.spark.api.java.function.Function2;Importorg.apache.spark.api.java.function.PairFunction;ImportOrg.apache.spark.streaming.api.java.*;ImportO
The Kafka version I use is: 0.7.2
The JDK version is: 1.6.0_20
Http://kafka.apache.org/07/quickstart.html The official example is not very complete, the following code is my supplement and can be run after compiling.
Producer Code
[Java] View Plain copy importjava.util.*; importkafka.message.message; Import kafka.producer.ProducerConfig; importkafka.javaapi.producer.producer; Import kafka.javaapi.producer
Training Big Data architecture development, mining and analysis!from zero-based to advanced, one-to-one technical training! Full Technical guidance! [Technical qq:2937765541] https://item.taobao.com/item.htm?id=535950178794-------------------------------------------------------------------------------------Java Internet Architect Training!https://item.taobao.com/item.htm?id=536055176638Big Data Architecture Development Mining Analytics Hadoop HBase
management solution, realize the software pipelining production, guarantee the correctness, the reliabilityGuided creation, import of projects, integrated version control (GIT/SVN), project Management (trac/redmine), Code quality (Sonar), continuous integration (Jenkins)Private deployment, unified management, for developersDistributedDistributed services: Dubbo+zookeeper+proxy+restfulDistributed message Middleware: Kafka+flume+zookeeperDistributed ca
First, import the package to create the jar bundle in the Libs in the Kafka directory using Maven
write the properties configuration file.For the project structure
#kafka集群地址
bootstrap.servers = 192.168.222.131:9092,192.168.222.130:9092,192.168.222.132:9092,192.168.222.133:9092
client.id = testProducer
Key.serializer = Org.apache.kafka.common.serialization.IntegerSerializer
Value.serializer = Org.apache.k
is important to note the CPU usage statistics. You may have heard this: my Kafka Broker CPU usage is 400%, what's going on? For such a problem, we must first understand how this usage rate is observed? Many people use the VSS or RSS fields in the top command to characterize CPU usage, but in fact they are not real CPU usage-it's just a fraction of the time slices that all CPUs spend together on the Kafka p
for storage to improve parallel processing power. Replication: Copy. A partition consists of one copy or multiple replicas. Replicas are used for partitioned backups. 4. Installation Steps(1) Download the kafka_2.10-0.9.0.0.tgz package and put it in the/usr/local directoryTar zxvf kafka_2.10-0.9.0.0.tgzLN-SV kafka_2.10-0.9.0.0 Kafka(2) Configure the Java Runtime Environment,
Build a Kafka cluster environment and a kafka ClusterEstablish a Kafka Cluster Environment
This article only describes how to build a Kafka cluster environment. Other related knowledge about kafka will be organized in the future.1. Preparations
Linux Server
3 (th
is one of the simplest and most convenient ways to view Kafka server metrics without installing other tools (since you have installed Kafka and you have already installed Java, and Jconsole is a tool that comes with Java).You must first enable Kafka JMX Reporter by setting
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.