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
val writer = df.write.cassandraFormat(table = "test", keyspace = "test") | |
// writer: org.apache.spark.sql.DataFrameWriter[org.apache.spark.sql.Row] = org.apache.spark.sql.DataFrameWriter@6cf47d05 |
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
{ | |
"AAPL": { | |
"quote": { | |
"latestPrice": 221.43, | |
"latestSource": "IEX real time price", | |
"latestUpdate": 1537455071032, | |
"latestVolume": 18919004, | |
"previousClose": 218.37, | |
"symbol": "AAPL" | |
} |
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
tar -xzf confluent-5.0.0-2.11.tar.gz | |
cd confluent-5.0.0/ |
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
for i=0 to 3: | |
cassandra-stress write no-warmup n=175000000 cl=ALL | |
-rate threads=500 | |
-schema 'replication(factor=2) keyspace=keyspace' | |
-col 'size=FIXED(4000) n=FIXED(1)' | |
-mode cql3 native connectionsPerHost=66 | |
-pop 'seq=((i*n)+1)..((i+1)*n)' # where n=175000000 | |
-node node2 | |
-errors ignore |
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
# On one node, start the master: | |
spark-2.4.0-bin-hadoop2.7 $ ./sbin/start-master.sh | |
# On the same node, and on the other nodes, start the Spark workers: | |
spark-2.4.0-bin-hadoop2.7 $ SPARK_WORKER_INSTANCES=8 SPARK_WORKER_CORES=2 ./sbin/start-slave.sh spark://<spark-master-ip>:7077 |
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
#!/usr/bin/python3 | |
import yaml | |
a = yaml.load("string: hello world!") | |
print(a['string']) |
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
cqlsh> desc SCHEMA | |
CREATE KEYSPACE catalog WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true; | |
CREATE TABLE catalog.apparel ( | |
sku text, | |
color text, | |
size text, | |
brand text, | |
gender text, | |
group text, |
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
val connector = | |
new CassandraConnector(CassandraConnectorConf(sparkContext.getConf)) |
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
$ tar -xzf confluent-5.2.0-2.12.tar.gz | |
$ cd confluent-5.2.0/ |
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
CREATE TABLE ks.tbl ( | |
uuid int, | |
time timestamp, | |
property text, | |
PRIMARY KEY (uuid, time)) |
OlderNewer