Support #891
Updated by Daniel Curtis over 7 years ago
This is a guide for setting up Apache Kafka on FreeBSD 10. h2. Prepare the Environment * Make sure the system is up to date: <pre> pkg update && pkg upgrade </pre> * Install a few dependencies: <pre> pkg install bash git gradle openjdk7 </pre> * Create a symlink of bash: <pre> ln -s /usr/local/bin/bash /bin/bash </pre> * Install Zookeeper and ensure its running, Zookeeper, refer to issue #890 <pre> service zookeeper start </pre> * Download Kafka from GitHub: <pre> git clone https://github.com/apache/kafka.git /usr/local/kafka </pre> * Bootstrap Kafka: <pre> cd /usr/local/kafka gradle </pre> * Build the Kafka jar: <pre> ./gradlew jar </pre> * Create log file directory for Kafka: <pre> mkdir /var/log/kafka </pre> * Edit the Kafka config: <pre> vi /usr/local/kafka/config/server.properties </pre> #* And modify the following parameters: <pre> # The id of the broker. This must be set to a unique integer for each broker. broker.id=1 # Increase the message size limit message.max.bytes=20000000 replica.fetch.max.bytes=30000000 log.dirs=/var/log/kafka listeners=PLAINTEXT://192.168.1.104:9092 zookeeper.connect=localhost:2181 #zookeeper.connect=192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181 </pre> * Test start the Kafka server: <pre> /usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties </pre> #* Once finished testing press CTRL+C to stop the kafka server. h3. System service * Install supervisor: <pre> pkg install py27-supervisor </pre> * Create a supervisor config directory: <pre> mkdir /usr/local/etc/supervisord.conf.d </pre> * Add a folder inclusion statement: <pre> echo '[include]' >> /usr/local/etc/supervisord.conf echo 'files = supervisord.conf.d/*.ini' >> /usr/local/etc/supervisord.conf </pre> * Create a kafka supervisord config: <pre> vi /usr/local/etc/supervisord.conf.d/kafka.ini </pre> #* And add the following: <pre> [program:kafka] directory=/usr/local/kafka command=/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties autostart=true autorestart=true startsecs=6 startretries=20 </pre> * Start and enable supervisord at boot: <pre> echo 'supervisord_enable="YES"' >> /etc/rc.conf service supervisord start </pre> * Run the supervisord control prompt: <pre> supervisorctl </pre> #* h2. Resources * https://github.com/apache/kafka * http://kafka.apache.org/documentation.html#quickstart *https://github.com/btccom/btcpool/blob/master/docs/INSTALL-Kafka.md