Changes

Kafka with ELK on swarm

2,910 bytes added, 23:04, 22 March 2019
AVRO
</pre>
* '''clientPort''': Ez az a port, ahol a Kafka broker-ek csatlakozni fognak a zookeper node-okhoz. Ez is a közös swarm overlay hálózaton lesz elérhető a broker-ek számára. * '''server.X=zookeeper1:peerPort:leaderPort'''** '''X''':Az X egy egész szám lehet csak, fontos hogy egyedi legyen. ** '''peerPort''':A ensemble node tagok ezen a porton kommunikálnak egymással. A node-ok is a közös swarm overlay hálózaton érik el egymást. Az itt megadott host név a swarm service neve, amit a swarm fel tud oldani. ** '''leaderPort''':Ezen a porton zajlik a vezető választás   A kafka cluster jelentéktelen terhelést fog eredményezni a zookeeper ensemble (cluster)-ben. Ezért egy központi zookeeper cluster általában elég egy szervezeten belül. Viszont arra figyelni kell, hogy ha lehet a zookeepr ensemble más alkalmazásokat ne szolgáljon ki csak a Kafa cluster-eket. A Kafka broker-ek allergiásak a zookeeper kommunikációban fellépő késleltetésre. Ha nem kapnak közel azonnal választ, akkor úgy gondolhatják, hogy bizonyos node-ok nem elérhetőek és széteshet a cluster.  A consumer-ekben be lehet állítani, hogy az aktuális offset értéküket a Kafak-ban egy erre a célra fenntartott topic-ban tárolják (__consumer_offsets) vagy zookeeper-ben. Az utóbbi nem ajánlatos, mert ezzel is túlterhelhetjük a zookeeper ensemble-t (cluster-t).
==Swarm stack==
<source syntaxhighlight lang="jamlYAML">
version: '3'
driver_opts:
share: 192.168.42.1:/home/adam/dockerStore/zookeeper/zk-web/
</sourcesyntaxhighlight>
==Produkciós futtatás==
ZooKeeper runs as a JVM. It is not notably heap intensive when running for the Kafka use case. A heap size of 1 GB is recommended for most use cases and monitoring heap usage to ensure no delays are caused by garbage collection.
=Kafka=
==Configuration==
* Broker Configuration* Topic Defaults =Kafka=* Hardware Selection
</source>
Aztán ezt a Kafa producer-t ugyan úgy kell használni, mint ha nem Avro-t használnánk, de a Comsumer-nek ugyan így kell majd deserializálnija.
 
 
=Log4J with Kafa=
</dependency>
</source>
 
 
=AVRO=
 
http://avro.apache.org/docs/current/spec.html#schemas<br>
 
<pre>
{"type": "typeName" ...attributes...}
</pre>
A typeName értéke lehet primitív típus vagy összetett típus.
 
Összetett típusok: records, enums, arrays, maps, unions, fixed
 
A record típus
* name: a JSON string providing the name of the record (required).
* namespace, a JSON string that qualifies the name;
* doc: a JSON string providing documentation to the user of this schema (optional).
* aliases: a JSON array of strings, providing alternate names for this record (optional).
* fields: a JSON array, listing fields (required). Each field is a JSON object with the following attributes:
** name: a JSON string providing the name of the field (required), and
** doc: a JSON string describing this field for users (optional).
** type: A JSON object defining a schema, or a JSON string naming a record definition (required).
 
 
<source lang="java">
package com.ippontech.kafkatutorials;
 
class Person(
String firstName;
String lastName;
Date birthDate;
)
</source>
 
<pre>
{
"type": "record",
"name": "Person",
"namespace": "com.ippontech.kafkatutorials",
"fields": [
{
"name": "firstName",
"type": "string"
},
{
"name": "lastName",
"type": "string"
},
{
"name": "birthDate",
"type": "long"
}
]
}
</pre>
 
 
 
 
 
 
 
 
 
 
 
 
 
https://docs.confluent.io/current/installation/docker/config-reference.html
 
 
https://kafka.apache.org/quickstart