Getting ready

First install and configure the Apache Kafka and SNAS library for parsing OpenBMP Kafka messages:

$ sh 13_3_install.sh
#!/bin/bash
#########################################################
# Python Network Programming Cookbook, Second Edition -- Chapter - 13
#########################################################
    
    
# Install Dependencies
sudo apt-get install python-dev python-pip libsnappy-dev
sudo pip install python-snappy kafka-python pyyaml
    
# Install SNAS Python API
git clone https://github.com/OpenBMP/openbmp-python-api-message.git
cd openbmp-python-api-message
sudo pip install .
    
# Go back to the root directory.
cd ..
    
# Download Apache Kafka
wget http://apache.belnet.be/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz
    
tar -xzf kafka_2.11-0.11.0.0.tgz

Follow the preceding installation script once to download the dependencies, SNAS, and Kafka. Use the following script to quick-start Kafka Server:

$ sh 13_3 quickstart.sh
#!/bin/bash
###############################################
# Python Network Programming Cookbook, Second Edition 
-- Chapter - 13
############################################### # Start Zookeeper. To view the logs real time,
in a terminal: "tail -f zk-server.out".
nohup kafka_2.11-0.11.0.0/bin/zookeeper-server-start.sh
kafka_2.11-0.11.0.0/config/zookeeper.properties >
zk-server.out &
# Start Kafka-Server. To view the logs real time, in a
terminal: "tail -f kafka-server.out".
nohup kafka_2.11-0.11.0.0/bin/kafka-server-start.sh
kafka_2.11-0.11.0.0/config/server.properties >
kafka-server.out &

As this script starts Kafka and ZooKeeper as nohup, you need to find and kill these processes when you want to stop them. You may find them by:

$ ps -xa | grep java

Then kill the process using the following command for the relevant Kafka and ZooKeeper processes:

$ kill {process-id}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.53.119