You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Apache Cassandra baseline testing on Google Axion C4A Arm Virtual machine
2
+
title: Test Cassandra baseline functionality
3
3
weight: 5
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
9
-
10
-
Since Cassandra has been successfully installed on your GCP C4A Arm virtual machine, follow these steps to verify that it is running and functioning properly.
11
-
12
-
## Baseline Testing for Apache Cassandra
13
-
14
-
This guide helps verify the installation and perform baseline testing of **Apache Cassandra**.
9
+
Now that Cassandra is installed on your GCP C4A Arm virtual machine, verify that it's running and functioning properly.
15
10
16
11
## Start Cassandra
17
12
@@ -21,20 +16,23 @@ Run Cassandra in the background:
21
16
cassandra -R
22
17
```
23
18
24
-
The `-R` flag allows Cassandra to run in the background as a daemon, so you can continue using the terminal. The first startup may take **30–60 seconds** as it initializes the necessary files and processes.
19
+
The `-R` flag allows Cassandra to run in the background as a daemon. The first startup may take 30–60 seconds as it initializes.
25
20
26
21
Check logs to ensure Cassandra started successfully:
27
22
28
23
```console
29
24
tail -f ~/cassandra/logs/system.log
30
25
```
31
-
Look for the message **"Startup complete"**, which indicates Cassandra is fully initialized.
32
26
33
-
### Check Cassandra Status
27
+
Look for the message "Startup complete", which indicates Cassandra is fully initialized.
28
+
29
+
## Check Cassandra status
30
+
34
31
```console
35
32
nodetool status
36
33
```
37
-
You should see an output similar to:
34
+
35
+
The output is similar to:
38
36
39
37
```output
40
38
Datacenter: datacenter1
@@ -44,29 +42,34 @@ Status=Up/Down
44
42
-- Address Load Tokens Owns (effective) Host ID Rack
45
43
UN 127.0.0.1 162.51 KiB 16 100.0% 78774686-39f3-47e7-87c3-3abc4f02a835 rack1
46
44
```
47
-
The `nodetool status` command displays the health and status of your Cassandra node(s). For a single-node setup, the output should indicate that the node is **Up (U)** and **Normal (N)**. This confirms that your Cassandra instance is running and ready to accept queries.
48
45
49
-
### Connect with CQLSH (Cassandra Query Shell)
50
-
**cqlsh** is the interactive command-line shell for Cassandra. It allows you to run Cassandra Query Language (CQL) commands to interact with your database, create keyspaces and tables, insert data, and perform queries.
46
+
For a single-node setup, the output should indicate that the node is Up (U) and Normal (N), confirming that your Cassandra instance is running and ready to accept queries.
47
+
48
+
### Connect with CQLSH
49
+
50
+
`cqlsh` is the interactive command-line shell for Cassandra that allows you to run Cassandra Query Language (CQL) commands.
51
51
52
52
```console
53
53
cqlsh
54
54
```
55
-
You’ll enter the CQL (Cassandra Query Language) shell.
56
55
57
-
### Create a Keyspace (like a database)
58
-
A **keyspace** in Cassandra is similar to a database in SQL systems. Here, we create a simple keyspace `testks` with a **replication factor of 1**, meaning data will only be stored on one node (suitable for a single-node setup).
56
+
You'll enter the CQL (Cassandra Query Language) shell.
57
+
58
+
### Create a keyspace
59
+
60
+
A keyspace in Cassandra is similar to a database in SQL systems. Create a simple keyspace `testks` with a replication factor of 1 (suitable for a single-node setup):
59
61
60
62
```sql
61
63
CREATE KEYSPACE testks WITH replication = {'class':'SimpleStrategy','replication_factor' : 1};
62
64
```
63
-
Check if created:
65
+
66
+
Verify the keyspace was created:
64
67
65
68
```sql
66
69
DESCRIBE KEYSPACES;
67
70
```
68
71
69
-
You should see an output similar to:
72
+
The output is similar to:
70
73
71
74
```output
72
75
cqlsh> DESCRIBE KEYSPACES;
@@ -75,8 +78,9 @@ system system_distributed system_traces system_virtual_schema
75
78
system_auth system_schema system_views testks
76
79
```
77
80
78
-
### Create a Table
79
-
Tables in Cassandra are used to store structured data. This step creates a `users` table with three columns: `id` (unique identifier), `name` (text), and `age` (integer). The `id` column is the primary key.
81
+
### Create a table
82
+
83
+
Create a `users` table with three columns:
80
84
81
85
```sql
82
86
USE testks;
@@ -88,22 +92,24 @@ CREATE TABLE users (
88
92
);
89
93
```
90
94
91
-
### Insert Data
92
-
We insert two sample rows into the `users` table. The `uuid()` function generates a unique identifier for each row, which ensures that every user entry has a unique primary key.
95
+
### Insert data
96
+
97
+
Insert two sample rows into the `users` table. The `uuid()` function generates a unique identifier for each row:
93
98
94
99
```sql
95
100
INSERT INTO users (id, name, age) VALUES (uuid(), 'Alice', 30);
96
101
INSERT INTO users (id, name, age) VALUES (uuid(), 'Bob', 25);
97
102
```
98
103
99
-
### Query Data
100
-
This command retrieves all rows from the `users` table. Successful retrieval confirms that data insertion works correctly and that queries return expected results.
104
+
### Query data
105
+
106
+
Retrieve all rows from the `users` table:
101
107
102
108
```sql
103
109
SELECT*FROM users;
104
110
```
105
111
106
-
You should see an output similar to:
112
+
The output is similar to:
107
113
108
114
```output
109
115
id | age | name
@@ -114,6 +120,6 @@ You should see an output similar to:
114
120
(2 rows)
115
121
```
116
122
117
-
This baseline test verifies that Cassandra 5.0.5 is installed and running correctly on the VM. It confirms the node status, allows connection via `cqlsh`, and ensures basic operations like creating a keyspace, table, inserting, and querying data work as expected.
123
+
This baseline test verifies that Cassandra 5.0.5 is installed and running correctly on the VM, confirming node status, CQLSH connectivity, and basic database operations.
118
124
119
-
Please now press "Ctrl-D" to exit the Cassandra Query Shell.
0 commit comments