sudo apt install apache2- check with Browser:
localhost - Install the
shfiles. in/opt/kafkause install likekafka-start-server.sh,kafka-topics.sh, etc. - Installating
pythonconfluent-kafka-python - Follow the Tutorial
- Use
virtualenvandpip install confluent-kafka
-
Producer:
on_commitcallback for each messageproducer.flushorclient.poll) -
Consumer:
on_deliverycallback when async error for each messageclient.poll -
Topic: file that contains key value pairs (similar to a database table, ), it containslogs(not queues) so they are indexed in sequence (henceoffset) -
Partitionbreaks atopicinto multiplelogs(`files``), the logs are push in a round robin manner into the partitions, if the logs contain a key, the key will determine the partition -
Brokers(server/containers running kafka process) -
Replication:LeaderReplica (original data) andFollowerreplicas (copies) -
Consumer: The order is sustained within a partition but not across partitions. With 1 consumer: all messages from all partitions are accessed. If multiple consumers from a same app (consumer-group). each consumer will have a subset of partions but the union will cover all partitions -
Connectors: programs that are either aSink Connector(a kafka consumer) or aSource Connector(a kafka producer) Check Confluent Hub -
Could create Connector with DataGen
-
Schema Registry(a process outside the broker that serves as a Schema database) managesjson,protobuf, andavro. Can generate schemas for both thekeyandvalueof entries in a topic. -
ksqlDBdatabase optimized forkafkastream (in a sql language)
Python Tutorial
- need a
config.iniwithkafkaendpoint and API and secret keys (using a cli, rest or connector)
- Check if it is running
sudo systemctl status apache2 - if not runninng:
systemctl start apache2(orsystemctl reload apache2)
- Check what is available:
sudo apt search libapache2-mod - Install with
apt, e.g.,sudo apt install libapache2-mod-python - Enable:
a2enmodor disable:a2dismod
- Websites available by listing the
sites-available:ls /etc/apache2/sites-availables, e.g.,000-default - Enabled:
a2ensiteDisablea2dissite
- Create the
.conffile insites-available, e.g.,/etc/apache2/sites-available/example.net.conf - Example of content
<VirtualHost *:80>
ServerAdmin webmaster@example.net
ServerName example.net
ServerAlias www.example.net
DocumentRoot /mnt/d/Repos/apache2/www/example.net/public_html/
ErrorLog /mnt/d/Repos/apache2/www/example.net/logs/error.log
CustomLog /mnt/d/Repos/apache2/www/example.net/logs/access.log
</VirtualHost>
-
In
/etc/apache2/apache2.conf -
Change Hostname in
/etc/hostname -
Change
/etc/hosts
KRaftif newer and reduces complexity and latency (as everything is handled withingkafka)
npm install express kafka-node --save