Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

8/24/2021

Reading time:2 min

Apache Cassandra Lunch #60: Apache Cassandra and Apache Nifi - Business Platform Team

by Arpan Patel

Apache Cassandra Lunch #60: Apache Cassandra and Apache Nifi, we discussed how we can connect Apache Cassandra and Apache Nifi. The live recording of Cassandra Lunch, which includes a more in-depth discussion and a demo, is embedded below in case you were not able to attend live. If you would like to attend Apache Cassandra Lunch live, it is hosted every Wednesday at 12 PM EST. Register here now!Apache Cassandra Lunch #60, we discussed how we can connect Apache Cassandra and Apache Nifi with a demo on how to set up the Cassandra Session Provider and run a simple CQL query via Nifi. If you want an introduction to Apache Nifi and to learn how to do some other kinds of data transformations, check out Data Engineer’s Lunch #29: Introduction to Apache Nifi. You can also check out the GitHub repo for that Data Engineer’s Lunch here!WalkthroughIn this walkthrough, we show you how to set up the Cassandra session provider and use Nifi to run a simple `SELECT *` query on our Cassandra instance. For a more in-depth discussion of the demo, be sure to check out the live recording embedded below!PrerequisitesDockerNifi 1.14.01. Setup Dockerized Apache Cassandra1.1 – Start Apache Cassandra Container and Mount Directorydocker run --name cassandra -p 9042:9042 -d cassandra:latest1.2 – Run cqlshdocker exec -it cassandra cqlsh1.3 – Copy and paste below items into the CQLSH terminalCREATE KEYSPACE demo WITH REPLICATION={'class': 'SimpleStrategy', 'replication_factor': 1};CREATE TABLE demo.previous_employees_by_job_title ( job_title text, employee_id uuid, employee_name text, first_day timestamp, last_day timestamp, PRIMARY KEY (job_title, employee_id)) WITH CLUSTERING ORDER BY (employee_id ASC);insert into previous_employees_by_job_title (job_title, employee_id, employee_name, first_day, last_day)values('Biologist', e48fd2c9-3abb-4592-a7d6-ccccf06e991e, 'Fiona Lane', '2009-02-26 20:47:18Z', '2005-10-13 20:01:22Z') ;2. Start Nifi2.1 – Navigate to Apache Nifi directory and start in background mode./bin/nifi.sh start2.2 – Log into Apache NifiNavigate to https://localhost:8443/nifi/loginIf this is your first time logging into local Apache Nifi, you will need to find the autogenerated credentials. You can do so by running the below command within the Apache Nifi directory and then searching for Username and Password:cat logs/nifi-app_<date>.log3. Watch the rest of the walkthrough below! Resourceshttps://nifi.apache.org/docs.htmlhttps://youtu.be/PO_4yarPBrwCassandra.LinkCassandra.Link is a knowledge base that we created for all things Apache Cassandra. Our goal with Cassandra.Link was to not only fill the gap of Planet Cassandra but to bring the Cassandra community together. Feel free to reach out if you wish to collaborate with us on this project in any capacity.We are a technology company that specializes in building business platforms. If you have any questions about the tools discussed in this post or about any of our services, feel free to send us an email! Posted in Data & Analytics, Events | Comments Off on Apache Cassandra Lunch #60: Apache Cassandra and Apache Nifi

Illustration Image

Apache Cassandra Lunch #60: Apache Cassandra and Apache Nifi, we discussed how we can connect Apache Cassandra and Apache Nifi. The live recording of Cassandra Lunch, which includes a more in-depth discussion and a demo, is embedded below in case you were not able to attend live. If you would like to attend Apache Cassandra Lunch live, it is hosted every Wednesday at 12 PM EST. Register here now!

Apache Cassandra Lunch #60, we discussed how we can connect Apache Cassandra and Apache Nifi with a demo on how to set up the Cassandra Session Provider and run a simple CQL query via Nifi.

If you want an introduction to Apache Nifi and to learn how to do some other kinds of data transformations, check out Data Engineer’s Lunch #29: Introduction to Apache Nifi. You can also check out the GitHub repo for that Data Engineer’s Lunch here!

Walkthrough

In this walkthrough, we show you how to set up the Cassandra session provider and use Nifi to run a simple `SELECT *` query on our Cassandra instance. For a more in-depth discussion of the demo, be sure to check out the live recording embedded below!

Prerequisites

1. Setup Dockerized Apache Cassandra

1.1 – Start Apache Cassandra Container and Mount Directory

docker run --name cassandra -p 9042:9042 -d cassandra:latest

1.2 – Run cqlsh

docker exec -it cassandra cqlsh

1.3 – Copy and paste below items into the CQLSH terminal

CREATE KEYSPACE demo WITH REPLICATION={'class': 'SimpleStrategy', 'replication_factor': 1};
CREATE TABLE demo.previous_employees_by_job_title (
    job_title text,
    employee_id uuid,
    employee_name text,
    first_day timestamp,
    last_day timestamp,
    PRIMARY KEY (job_title, employee_id)
) WITH CLUSTERING ORDER BY (employee_id ASC);
insert into previous_employees_by_job_title (job_title, employee_id, employee_name, first_day, last_day)
values('Biologist', e48fd2c9-3abb-4592-a7d6-ccccf06e991e, 'Fiona Lane', '2009-02-26 20:47:18Z', '2005-10-13 20:01:22Z') ;

2. Start Nifi

2.1 – Navigate to Apache Nifi directory and start in background mode

./bin/nifi.sh start

2.2 – Log into Apache Nifi

Navigate to https://localhost:8443/nifi/login

If this is your first time logging into local Apache Nifi, you will need to find the autogenerated credentials. You can do so by running the below command within the Apache Nifi directory and then searching for Username and Password:

cat logs/nifi-app_<date>.log

3. Watch the rest of the walkthrough below!

Resources

Cassandra.Link

Cassandra.Link is a knowledge base that we created for all things Apache Cassandra. Our goal with Cassandra.Link was to not only fill the gap of Planet Cassandra but to bring the Cassandra community together. Feel free to reach out if you wish to collaborate with us on this project in any capacity.

We are a technology company that specializes in building business platforms. If you have any questions about the tools discussed in this post or about any of our services, feel free to send us an email!

Related Articles

stargate
cassandra.lunch
cassandra

Apache Cassandra Lunch #87: Cassandra.api, Astra, and Stargate - Business Platform Team

Obioma Anomnachi

7/8/2022

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

cassandra.lunch