-
Notifications
You must be signed in to change notification settings - Fork 952
Expand file tree
/
Copy pathflux-create.sh
More file actions
executable file
·30 lines (25 loc) · 1.67 KB
/
Copy pathflux-create.sh
File metadata and controls
executable file
·30 lines (25 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
echo ...Creating Kafka Topics...
kafka-topics --zookeeper localhost:2181 --create --topic ratings --partitions 1 --replication-factor 1
kafka-topics --zookeeper localhost:2181 --create --topic likes --partitions 1 --replication-factor 1
echo Creating ElasticSearch Indexes
curl -XPUT 'http://localhost:9200/pipeline/' -d '{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}'
echo ...Creating Cassandra Keyspaces Column Families and Tables...
#cqlsh -e "DROP KEYSPACE IF EXISTS pipeline;"
cqlsh -e "CREATE KEYSPACE pipeline WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor':1};"
#cqlsh -e "USE pipeline; DROP TABLE IF EXISTS real_time_ratings;"
cqlsh -e "USE pipeline; CREATE TABLE real_time_ratings (fromUserId int, toUserId int, rating int, batchTime timestamp, PRIMARY KEY(fromUserId, toUserId));"
#cqlsh -e "USE pipeline; DROP TABLE IF EXISTS real_time_likes;"
cqlsh -e "USE pipeline; CREATE TABLE real_time_likes (fromUserId int, toUserId int, batchTime timestamp, PRIMARY KEY(fromUserId, toUserId));"
echo ...Creating HDFS...
hdfs namenode -format
echo ...Creating Reference Data in Hive...
#spark-sql --jars $MYSQL_CONNECTOR_JAR -e 'DROP TABLE IF EXISTS gender_json_file'
spark-sql --jars $MYSQL_CONNECTOR_JAR -e 'CREATE TABLE gender_json_file(id INT, gender STRING) USING org.apache.spark.sql.json OPTIONS (path "datasets/dating/gender.json.bz2")'
#spark-sql --jars $MYSQL_CONNECTOR_JAR -e 'DROP TABLE IF EXISTS likes_parquet_file'
spark-sql --jars $MYSQL_CONNECTOR_JAR -e 'CREATE TABLE likes_parquet_file(from_user_id INT, to_user_id INT) USING org.apache.spark.sql.parquet OPTIONS (path "datasets/sparkafterdark/likes.parquet")'