Giter VIP home page Giter VIP logo

kafka-neo4j-stream's Introduction

kafka-neo4j-stream

Install

Setup

Kafka

  • Start ZooKeeper server:
sh bin/zookeeper-server-start.sh config/zookeeper.properties
  • Start Kafka server:
sh bin/kafka-server-start.sh config/server.properties
  • Create Topic:
sh bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic user-track
  • Create Comsumer:
sh bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic user-track --from-beginning
  • Create multiple server:

Change broker.id and log.dirs in server.properties

Neo4j

streams.source.topic.nodes.<TOPIC_NAME>=<PATTERN>
streams.source.topic.relationships.<TOPIC_NAME>=<PATTERN>
streams.source.enable=<true/false, default=true>
  • Update config/neo4j.conf with <TOPIC_NAME> and <PATTERN>:
kafka.zookeeper.connect=localhost:2181
kafka.bootstrap.servers=localhost:9092
kafka.acks=1
kafka.num.partitions=1
kafka.retries=2
kafka.batch.size=16384
kafka.buffer.memory=33554432
kafka.reindex.batch.size=1000
kafka.session.timeout.ms=15000
kafka.connection.timeout.ms=10000
kafka.replication=1
kafka.linger.ms=1
kafka.transactional.id=

streams.source.topic.nodes.user-track=action{*}

Copy neo4j-streams-3.4.1.jar into plugins folder

  • Start neo4j server:
bin/neo4j console
  • Access Neo4j Browser via http://localhost:7474. Connect to database with neo4j/neo4j and update new password later.

Create Web UI

  • Install AngularJs and Angular Material:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js"></script>
<script src="https://cdn.gitcdn.link/cdn/angular/bower-material/v1.1.5/angular-material.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.gitcdn.link/cdn/angular/bower-material/v1.1.5/angular-material.css" />
  • Install Neo4j client:
<script src="js/neo4j-web.min.js"></script>
  • Connect to neo4j server:
neo4j = neo4j.v1;
var driver = neo4j.driver('bolt://127.0.0.1:7687', neo4j.auth.basic('neo4j', '123456'));
var session = driver.session();
  • Create a record:
var query = `CREATE (n:action {userId: '${USER_ID}', type: '${type}'})`;
var result = session.run(query);
result.then(function(data) {
    console.log(data);
}, function(e) {
    console.log(e)
});

kafka-neo4j-stream's People

Contributors

phongca22 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.