项目作者: xmlking

项目描述 :
TODO: try https://github.com/thake/avro4k-kafka-serializer
高级语言: Kotlin
项目地址: git://github.com/xmlking/kstream-experiments.git
创建时间: 2017-12-25T22:13:23Z
项目社区:https://github.com/xmlking/kstream-experiments

开源协议:

下载


klogs

A set of data microservices for analysing applogs using Kafka Streams

data microservices can be deployed and orchestrated using Spring Cloud Data Flow (SCDF)

use ./gradlew instead of gradle if you didn’t installed gradle

todo try kotlin avro serializer: avro4k-kafka-serializer

Test

  1. gradle word-count:test

Build

  1. gradle word-count:build -x test
  2. # continuous build with `-t`.
  3. gradle -t word-count:build
  4. # build docker image
  5. gradle word-count:docker -x test

Deploy

Deploying to production.

  1. nohup java -jar -Dspring.profiles.active=prod word-count-0.1.0-SNAPSHOT.jar > log.log 2>&1 &

Build Spring-dataflow image

  1. docker-compose build

Run

run locally

start kafka

  1. docker-compose up kafka
  2. docker-compose -f docker-compose-local.yml up
  3. # stop and remove volumes
  4. docker-compose -f docker-compose-local.yml down -v

start elasticsearch and kibana

  1. docker-compose up kibana
  2. # test elasticsearch
  3. http://localhost:9200/peg_logs/_search?pretty

start fluentd and web

  1. docker-compose up fluentd web
  2. # use `fluentd-*` index in kibana dashboard

start kafka connect

  1. docker-compose up connect

start spring dataflow server

  1. docker-compose up dataflow
  2. # Open the dashboard at http://localhost:9393/dashboard
  3. # do https://cloud.spring.io/spring-cloud-dataflow/
  4. # bulkload http://bit.ly/Celsius-BUILD-SNAPSHOT-stream-applications-kafka-10-maven

Stop Infra services (ie., kafka, elasticsearch, kibana)

  1. # stop and remove volumes
  2. docker-compose down -v

start app

  1. gradle word-count:bootRun
  2. # run with `prod` profile.
  3. SPRING_PROFILES_ACTIVE=prod gradle word-count:bootRun
  4. # fource to enable debug logs
  5. SPRING_PROFILES_ACTIVE=prod gradle word-count:bootRun --debug
  6. # via docker
  7. docker-compose up word-count

ssh to kafka container

  1. docker-compose exec kafka bash
  2. # then you can run following commands in this shell

receive messages

  1. kafka-console-consumer --bootstrap-server kafka:9092 --from-beginning --property print.key=true --topic counts

send messages

  1. kafka-console-producer --broker-list kafka:9092 --topic words

Gradle Commands

  1. # upgrade project gradle version
  2. gradle wrapper --gradle-version 4.4.1 --distribution-type all
  3. # gradle daemon status
  4. gradle --status
  5. gradle --stop
  6. # show dependencies
  7. gradle word-count:dependencies
  8. # refresh dependencies
  9. gradle build -x test --refresh-dependencies