raunak-r / tech-notes

A repository to store code snippets, general functions, and any other notes taken for various technologies and tools. See ISSUES Tab for in-depth studies.
2 stars 0 forks source link

Data Engineering | Kafka | ElasticSearch | ELK | Esper | Nifi #19

Open raunak-r opened 3 years ago

raunak-r commented 3 years ago

Nifi

minifi, and scenarios of using multiple consumers vs partitions. - https://bryanbende.com/development/2016/09/15/apache-nifi-and-apache-kafka

raunak-r commented 3 years ago

Esper

esper is the software to handle complex event processing, and EPL is the language (similar to SQL), to achieve this.

raunak-r commented 3 years ago

Redis and Celery with Django

Using Docker-Compose - https://testdriven.io/blog/django-and-celery/ Naked setup in Ubuntu - https://stackabuse.com/asynchronous-tasks-in-django-with-redis-and-celery

Running inside a simple docker container.

Protected Mode is required when connecting from a different server to a different server. Since the container is a different server from localhost, that's why required.

FROM        ubuntu:20.04
RUN         apt-get update && apt-get install -y redis-server
EXPOSE      6379
ENTRYPOINT  ["/usr/bin/redis-server", "--protected-mode no"]

Running Redis

Deploying Celery | Dockerfile

Dockerfile - https://stackoverflow.com/questions/59651428/runtimewarningyoure-running-the-worker-with-superuser-privilegesthis-is-absol

# --uid and --gid options are required
# else this warning will show up RuntimeWarning:You're running the worker with superuser privileges:this is absolutely not recommended
- celery --app=app worker --loglevel=info --uid=nobody --gid=nogroup &

Testing

Steps

  1. Run Redis on a terminal as a docker container
  2. Run Celery Worker on a different terminal
  3. Call API from Postman.
raunak-r commented 3 years ago

ELK elastic - logstash - kibana

raunak-r commented 3 years ago

ElasticSearch

ES Setup

> echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
> sudo apt update
> sudo apt install elasticsearch

Optional - Port Configuration

> sudo nano /etc/elasticsearch/elasticsearch.yml

Run ES

> sudo systemctl start elasticsearch

Create Indexes

> curl -X PUT "localhost:9200/INDEX_NAME?pretty"

Verify Elastic Search


> List of all indexes
    curl -X GET "localhost:9200/_cat/indices?pretty"
> Cluster Health
    curl -X GET "localhost:9200/_cluster/health?pretty"
raunak-r commented 2 years ago

Data at Scale