Illustration Image

6/25/2022

Reading time:2

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

logo

This resource is based on an article originally published here.

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 connectApache CassandraandApache Nifiwith 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

logo
stargate
cassandra.lunch
cassandra

Explore Further

cassandra.lunch

cassandra

nifi

Become part of our
growing community!
Welcome to Planet Cassandra, a community for Apache Cassandra®! We're a passionate and dedicated group of users, developers, and enthusiasts who are working together to make Cassandra the best it can be. Whether you're just getting started with Cassandra or you're an experienced user, there's a place for you in our community.
A dinosaur
Planet Cassandra is a service for the Apache Cassandra® user community to share with each other. From tutorials and guides, to discussions and updates, we're here to help you get the most out of Cassandra. Connect with us and become part of our growing community today.
© 2009-2023 The Apache Software Foundation under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation. Sponsored by Anant Corporation and Datastax, and Developed by Anant Corporation.

Get Involved with Planet Cassandra!

We believe that the power of the Planet Cassandra community lies in the contributions of its members. Do you have content, articles, videos, or use cases you want to share with the world?