Cassandra
Cassandra
menti.com
https://github.com/DataStax-Academy
/workshop-cassandra-certification
Cassandra Certification Workshop
6. Resources
Cassandra Certification Workshop
6. Resources
Which certification should I get?
Designed for professionals who Designed for professionals that
install, configure, manage and use Apache Cassandra clusters
tune the performance of Apache to manage data
Cassandra clusters
application developers
database administrators data architects
DevOps engineers database designers
Site Reliability Engineers (SREs) database administrators
What resources do I have?
Web: www.datastax.com/dev/certifications
Discord
Cassandra Certification Workshop
6. Resources
Step 1
Go to
https://www.datastax.com/dev/certifications,
read through the material, and take special
note of the Exam Rules and Process section.
https://www.datastax.com/dev/certifications
Step 5
OR
Step 5
https://github.com/DataStax-Academy/workshop
-crud-with-python-and-node
6. Resources
1. CQL - Developer and Administrator Exams (DS201)
Consider the CQL statements: How many rows will the roller_coasters table have after
CREATE TABLE roller_coasters ( executing all the CQL statements?
name TEXT,
A. none
park TEXT,
rating INT, B. 2
PRIMARY KEY((name))
); C. 3
D. 4
INSERT INTO roller_coasters (name, park, rating)
VALUES ('Millenium Force', 'Cedar Point', 8 );
INSERT INTO songs (artist, title, length_seconds) The partition key consists of artist and title
VALUES ('The Beatles', 'Let It Be', 243 ); (incidentally, it is also the whole primary key).
D.
SELECT * FROM cars
WHERE make='Ford'
AND model = 'Mustang'
AND color = 'Red';
3. Solution
Consider the CQL statement: Which of the following is a valid query for the cars table?
CREATE TABLE cars (
A.
make TEXT, SELECT * FROM cars
model TEXT, WHERE make='Ford';
year INT,
B.
color TEXT, SELECT * FROM cars
cost INT, WHERE year = 1969
AND color = 'Red';
PRIMARY KEY ((make, model), year, color)
);
C.
The partition key consists of make and model so A and B
SELECT * FROM cars
WHERE make='Ford'
are excluded because the WHERE clause does not include
AND model = 'Mustang'
the partition key.
AND year = 1969;
BEGIN BATCH
INSERT INTO employees (id, name, department)
VALUES ('AC1123', 'Joe', 'legal');
C.
CREATE MATERIALIZED VIEW IF NOT EXISTS
teams_by_wins AS
SELECT * FROM teams
WHERE name IS NOT NULL AND wins IS NOT NULL
PRIMARY KEY((name), wins);
D.
CREATE MATERIALIZED VIEW IF NOT EXISTS
teams_by_wins AS
SELECT * FROM teams
WHERE wins IS NOT NULL AND name IS NOT NULL
PRIMARY KEY((wins), name);
6. Solution
Consider the table definition and the CQL query: Which materialized view definition can be used to support the
CREATE TABLE teams ( query?
name TEXT PRIMARY KEY, A.
wins INT, CREATE MATERIALIZED VIEW IF NOT EXISTS
losses INT, teams_by_wins AS
SELECT * FROM teams
ties INT
PRIMARY KEY((name), wins);
);
C.
CREATE MATERIALIZED VIEW IF NOT EXISTS
teams_by_wins AS
Since primary key fields cannot be NULL the WHERE clause SELECT * FROM teams
must include a NULL check. WHERE name IS NOT NULL AND wins IS NOT NULL
PRIMARY KEY((name), wins);
Since the WHERE clause in the SELECT is based on wins,
wins must be the partition key. D.
CREATE MATERIALIZED VIEW IF NOT EXISTS
teams_by_wins AS
SELECT * FROM teams
WHERE wins IS NOT NULL AND name IS NOT NULL
PRIMARY KEY((wins), name);
7. CQL - Developer Exam (DS220)
Consider the table definition and the CQL query: Which secondary index can be used to support the query?
CREATE TABLE restaurants_by_city (
name TEXT, A.
city TEXT, CREATE INDEX cuisine_restaurants_by_city_2i
cuisine TEXT, ON restaurants_by_city (cuisine);
price int,
PRIMARY KEY ((city), name) B.
); CREATE INDEX cuisine_restaurants_by_city_2i
ON restaurants_by_city (city, cuisine);
SELECT * FROM restaurants_by_city
WHERE city = 'Sydney' C.
CREATE INDEX cuisine_restaurants_by_city_2i
AND cuisine = 'sushi';
ON restaurants_by_city (cuisine, city);
D.
CREATE INDEX cuisine_restaurants_by_city_2i
ON restaurants_by_city (city, name, cuisine);
7. Solution
Consider the table definition and the CQL query: Which secondary index can be used to support the query?
CREATE TABLE restaurants_by_city (
name TEXT, A.
city TEXT,
cuisine TEXT,
CREATE INDEX cuisine_restaurants_by_city_2i
price int, ON restaurants_by_city (cuisine);
PRIMARY KEY ((city), name)
); B.
CREATE INDEX cuisine_restaurants_by_city_2i
SELECT * FROM restaurants_by_city ON restaurants_by_city (city, cuisine);
WHERE city = 'Sydney'
AND cuisine = 'sushi'; C.
CREATE INDEX cuisine_restaurants_by_city_2i
ON restaurants_by_city (cuisine, city);
D.
CREATE INDEX cuisine_restaurants_by_city_2i
B, C, and D are incorrect because indexes on multiple ON restaurants_by_city (city, name, cuisine);
columns are not supported.
8. CQL - Developer and Administrator Exams (DS201)
Which statement describes the WHERE clause in a query?
A. WHERE clauses must reference all the fields of the partition key.
B. WHERE clauses must reference all the fields of the clustering key.
C. WHERE clauses must reference all the fields of the primary key.
D. WHERE clauses must reference all the fields of the partition key and
clustering key.
8. Solution
Which statement describes the WHERE clause in a query?
A. WHERE clauses must reference all the fields of the partition key.
B. WHERE clauses must reference all the fields of the clustering key.
C. WHERE clauses must reference all the fields of the primary key.
D. WHERE clauses must reference all the fields of the partition key and
clustering key.
D.
INSERT INTO people (id, name, email)
VALUES (UUID(), ('foo', 'bar), '[email protected]' );
9. Solution
Consider the CQL statements: Which INSERT statement can be used to insert a row in the
CREATE TYPE NAME ( people table?
first TEXT,
last TEXT A.
);
INSERT INTO people (id, name, email)
CREATE TABLE people ( VALUES (UUID(), {first:'foo', last:'bar'}, '[email protected]' );
id UUID,
name NAME, B.
email TEXT, INSERT INTO people (id, name, email)
VALUES (UUID(), name: {'foo', 'bar'}, '[email protected]' );
PRIMARY KEY((id), email)
);
C.
INSERT INTO people (id, name, email)
VALUES (UUID(), 'foo', 'bar', '[email protected]' );
D.
INSERT INTO people (id, name, email)
The fields of the user defined type VALUES (UUID(), ('foo', 'bar), '[email protected]' );
are passed using JSON.
10. CQL - Developer and Administrator Exams (DS201)
Consider the CQL statements: What is the result of executing theses CQL statements?
CREATE TABLE emails_by_user (
username TEXT, A.
email TEXT, username | email | nickname | description
description TEXT, ----------------+-------------------------------+---------------+-----------------
nickname TEXT STATIC, dc1234 | [email protected] | Dave | work
PRIMARY KEY((username), email) dc1234 | [email protected] | Davey | school
);
B.
INSERT INTO emails_by_user (username, email, description, nickname) username | email | nickname | description
VALUES (‘dc1234’, '[email protected]', 'work', 'Dave'); ----------------+-------------------------------+----------------+-----------------
dc1234 | [email protected] | Davey | work
INSERT INTO emails_by_user (username, email, description, nickname) dc1234 | [email protected] | Davey | school
VALUES (‘dc1234’, '[email protected]', 'personal', 'Dave');
D.
username | email | nickname | description
----------------+--------------------------------+---------------+-----------------
dc1234 | [email protected] | Dave | work
10. Solution
Consider the CQL statements: What is the result of executing theses CQL statements?
CREATE TABLE emails_by_user (
username TEXT, A.
email TEXT, username | email | nickname | description
description TEXT, ----------------+-------------------------------+---------------+-----------------
nickname TEXT STATIC, dc1234 | [email protected] | Dave | work
PRIMARY KEY((username), email) dc1234 | [email protected] | Davey | school
);
B.
INSERT INTO emails_by_user (username, email, description, nickname) username | email | nickname | description
VALUES (‘dc1234’, '[email protected]', 'work', 'Dave');
----------------+-------------------------------+----------------+-----------------
INSERT INTO emails_by_user (username, email, description, nickname) dc1234 | [email protected] | Davey | work
VALUES (‘dc1234’, '[email protected]', 'personal', 'Dave'); dc1234 | [email protected] | Davey | school
UPDATE emails_by_user SET nickname = 'Davey', description = 'school'
WHERE username = ‘dc1234’ AND email = '[email protected]'; C.
username | email | nickname | description
SELECT * FROM emails_by_user WHERE username = ‘dc1234’; ----------------+--------------------------------+---------------+-----------------
dc1234 | [email protected] | Davey | school
B. The request will be handled in data center ParisDC and will succeed.
C. The request will be retried in data center TokyoDC and will fail.
D. The request will be retried in data center TokyoDC and will succeed.
11. Solution
Consider the two datacenters in the diagram. What is a valid statement about a read request made at
consistency level of LOCAL QUORUM to coordinator node Z in
TokyoDC has six nodes (two failed and four active) and ParisDC?
a replication factor of 3, and ParisDC four nodes (one
failed and three active) and a replication factor of 3. A. The request will be handled in data center ParisDC and will fail.
C. The request will be retried in data center TokyoDC and will fail.
D. The request will be retried in data center TokyoDC and will succeed.
At what elapsed time is the data persisted so that it will survive an unexpected node shutdown?
A. 690 microseconds
B. 1834 microseconds
C. 2193 microseconds
D. 2966 microseconds
12. Solution
Consider these CQL traces (You may need to scroll to see the entire trace.):
At what elapsed time is the data persisted so that it will survive an unexpected node shutdown?
A. 690 microseconds
B. 1834 microseconds
Once data is written to commit log it will survive
an unexpected node shutdown.
C. 2193 microseconds
D. 2966 microseconds
13. Architecture Exams (DS201)
How is Replication Factor configured in Cassandra?
A. per cluster
B. per keyspace
C. per operation
D. per node
13. Solution
How is Replication Factor configured in Cassandra?
A. per cluster
B. per keyspace
C. per operation
D. per node
6. Resources
14. Administrator Exams (DS210)
What are two options for internode_encryption in
Cassandra? (Choose two.)
A. client
B. node
C. rack
D. enabled
E. dc
14. Solution
What are two options for internode_encryption in
Cassandra? (Choose two.)
A. client
B. node
C. rack
The available options are: all,
D. enabled
none, dc and rack.
E. dc
15. Administrator Exams (DS210)
Which configuration file is used to set garbage collection
properties for Cassandra?
A. cassandra.yaml
B. jvm.options
C. cassandra-env.sh
D. gc.options
15. Solution
Which configuration file is used to set garbage collection
properties for Cassandra?
A. cassandra.yaml
B. jvm.options
C. cassandra-env.sh The purpose of the jvm.options
file is to put JVM-specific
D. gc.options properties (like garbage
collection) in one place.
16. Administrator Exams (DS210)
Consider the table definition and how a single row is What are the current values for this row?
stored in one Memtable and two SSTables on a
A.
Cassandra node: id | test | score
----+-----------+-------
CREATE TABLE tests ( 11 | english | 48
id INT PRIMARY KEY,
test TEXT, B.
score int
id | test | score
);
----+--------+-------
11 | math | 75
Memtable
A. The coordinator node sends a direct read request to all The coordinator node only sends a direct read
request to one node and sends digest
replicas.
request(s) to the remainder necessary to meet
the consistency level.
B. The coordinator node sends a direct read request to
three replicas. The coordinator node then compares the data
read directly with the digest(s). If they agree
the result is returned to the client.
C. The coordinator node sends a background read repair
request to three replicas. If they do not agree the most recent
timestamped result is considered current and
sent to the client. The coordinator node may
D. The coordinator node sends a direct read request to need to request the latest timestamped version
one replica and digest requests to two replicas. from a replica.
18. Administrator Exams (DS210)
What is a valid statement about a write made at consistency level LOCAL_QUORUM
against a keyspace with replication factor of 3?
D. The coordinator node will send writes to all nodes. The coordinator node will always
attempt to write to the number of
nodes specified in the replication
factor.
Cassandra Certification Workshop
6. Resources
19. Data Modeling (DS220) What is the primary key and clustering order of the
Consider the Chebotko Diagram that captures the table trades_by_a_sd?
physical data model for investment portfolio data:
A.
PRIMARY KEY((account), trade_id, symbol)
)
WITH CLUSTERING ORDER BY (trade_id DESC, symbol ASC);
B.
PRIMARY KEY((account), trade_id, symbol)
)
WITH CLUSTERING ORDER BY (trade_id DESC);
C.
PRIMARY KEY((account), symbol, trade_id)
)
WITH CLUSTERING ORDER BY (trade_id DESC);
D.
PRIMARY KEY((account), symbol, trade_id)
)
WITH CLUSTERING ORDER BY (symbol ASC, trade_id DESC);
19. Solution What is the primary key and clustering order of the
Consider the Chebotko Diagram that captures the table trades_by_a_sd?
physical data model for investment portfolio data:
A.
PRIMARY KEY((account), trade_id, symbol)
)
WITH CLUSTERING ORDER BY (trade_id DESC, symbol ASC);
B.
PRIMARY KEY((account), trade_id, symbol)
)
WITH CLUSTERING ORDER BY (trade_id DESC);
C.
PRIMARY KEY((account), symbol, trade_id)
)
WITH CLUSTERING ORDER BY (trade_id DESC);
D.
PRIMARY KEY((account), symbol, trade_id)
)
WITH CLUSTERING ORDER BY (symbol ASC, trade_id DESC);
In Chebotko diagrams a table lists clustering keys in the order they appear in the
primary key. If the clustering order is explicitly specified for a column with WITH
CLUSTERING ORDER BY clause, the clustering order for all preceding clustering
key columns must also be explicitly specified.
20. Data Modeling (DS220)
Consider the Application Workflow Which access pattern(s) are evaluated before an
Diagram for an investment portfolio application can evaluate Q3.2?
application:
A. Q1
B. Q1 and Q2
C. Q1 and Q3
C. Q1 and Q3
6. Resources
MORE LEARNING!!!!
Developer site: datastax.com/dev
● Developer Stories
● New hands-on learning scenarios with
Katacoda
● Try it Out
● Cassandra Fundamentals
● https://katacoda.com/datastax/courses/cassandra
-intro
● New Data Modeling course
https://katacoda.com/datastax/courses/cassandra
-data-modeling
Join community.datastax.com
ASK/SHARE
Ask/answer community user questions - share your expertise
Follow us @DataStaxDevs
CONNECT
We are on Youtube - Twitter - Twitch!