-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automate the pipleline initializatgions
- Loading branch information
Abdullah Alqahtani
committed
Nov 19, 2023
1 parent
b1e7927
commit 4d16cc1
Showing
4 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Function to check if Cassandra is up and running | ||
function check_cassandra { | ||
while ! cqlsh -e "describe keyspaces" &>/dev/null; do | ||
echo "Waiting for Cassandra to be up..." | ||
sleep 10 | ||
done | ||
} | ||
|
||
echo "Setting up Cassandra schema..." | ||
|
||
# Wait for Cassandra to be ready | ||
check_cassandra | ||
|
||
# Execute schema setup commands | ||
cqlsh -f /init-cassandra/init.cql -u cassandra -p cassandra | ||
|
||
echo "Cassandra schema setup complete." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
/opt/bitnami/scripts/kafka/entrypoint.sh /opt/bitnami/scripts/kafka/run.sh & | ||
|
||
echo "Waiting for Kafka to be up..." | ||
sleep 10 | ||
|
||
kafka-topics.sh --create --topic stocks --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 | ||
|
||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
spark-submit \ | ||
--conf "spark.jars.ivy=/opt/bitnami/spark/.ivy2" \ | ||
--conf "spark.executor.extraJavaOptions=-Djava.security.krb5.conf=/path/to/krb5.conf" \ | ||
--conf "spark.driver.extraJavaOptions=-Djava.security.krb5.conf=/path/to/krb5.conf" \ | ||
--packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.3.1,com.datastax.spark:spark-cassandra-connector_2.12:3.0.0 \ | ||
/opt/bitnami/spark/jobs/spark_job.py stocks |