In this lab, you will learn how to migrate an application running on Apache Cassandra™ to DataStax Enterprise (DSE). To do this, you will deploy a Cassandra™ database and an application that writes data into it. You will then deploy a DataStax Enterprise database and connect the same application to the database. Finally, you will learn how to migrate data from Apache Cassandra™ to DSE using the DataStax Bulk Loader dsbulk.
Objectives
In this lab, you will learn how to perform the following tasks:
Deploy an Apache Cassandra™ database using Docker
Deploy a DataStax Enterprise database using Docker
Connect an application to both Cassandra™ and DSE
Migrate data from Apache Cassandra™ to DSE using dsbulk
Setup and requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.
How to start your lab and sign in to the Google Cloud console
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method.
On the left is the Lab Details pane with the following:
The Open Google Cloud console button
Time remaining
The temporary credentials that you must use for this lab
Other information, if needed, to step through this lab
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
Note: If you see the Choose an account dialog, click Use Another Account.
If necessary, copy the Username below and paste it into the Sign in dialog.
{{{user_0.username | "Username"}}}
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
{{{user_0.password | "Password"}}}
You can also find the Password in the Lab Details pane.
Click Next.
Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials.
Note: Using your own Google Cloud account for this lab may incur extra charges.
Click through the subsequent pages:
Accept the terms and conditions.
Do not add recovery options or two-factor authentication (because this is a temporary account).
Do not sign up for free trials.
After a few moments, the Google Cloud console opens in this tab.
Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field.
Activate Cloud Shell
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
Continue through the Cloud Shell information window.
Authorize Cloud Shell to use your credentials to make Google Cloud API calls.
When you are connected, you are already authenticated, and the project is set to your Project_ID, . The output contains a line that declares the Project_ID for this session:
Your Cloud Platform project in this session is set to {{{project_0.project_id | "PROJECT_ID"}}}
gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
(Optional) You can list the active account name with this command:
gcloud auth list
Click Authorize.
Output:
ACTIVE: *
ACCOUNT: {{{user_0.username | "ACCOUNT"}}}
To set the active account, run:
$ gcloud config set account `ACCOUNT`
(Optional) You can list the project ID with this command:
gcloud config list project
Output:
[core]
project = {{{project_0.project_id | "PROJECT_ID"}}}
Note: For full documentation of gcloud, in Google Cloud, refer to the gcloud CLI overview guide.
Task 1. Deploy Apache Cassandra™ using Docker
In the Cloud Console, select Navigation menu > Compute Engine > VM instances.
To create a new instance, click Create Instance.
In the Machine configuration.
Name: apache-cassandra
Series: E2
Machine Type: e2-medium
Click OS And storage.
Scroll down to the Container section and click Deploy Container.
In the Container Image field, enter the following:
bitnami/cassandra:latest
Leave the rest of the fields as default and click Select.
Click Networking.
Network tag: cql-server.
Click Create.
Click Check my progress to verify the objective.
Deploy Apache Cassandra™ using Docker
When the instance is available, click on the instance to view the VM instance details.
Click the SSH button to connect in a browser.
Enter the following command to view the running containers:
sudo docker ps
You should see a container using an image called bitnami/cassandra:latest. If you don't, give it a few seconds and run the previous command again. Eventually you should see something similar to this output:
Note the name of the Docker container. It will be something similar to klt-apache-cassandra-ynvd.
Then, connect to the database by typing the following command, replacing <<image-name>> with the name of your container:
sudo docker exec -it <<image-name>> cqlsh -u cassandra -p cassandra
Note: it may take a couple of minutes for your container to be ready to connect to cqlsh. If you get an authentication error, try again in a few minutes.
Once you are logged in to the database, create a keyspace for the application to connect to:
CREATE KEYSPACE simpleapp WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
Create a table for the application to use when reading and writing data:
Keep the CQL shell active but return to the Console in another browser window.
Click Check my progress to verify the objective.
Create a keyspace and table for application in Docker container
Task 2. Create a firewall rule
Before you connect an application to the database, you'll need to create a firewall rule that allows CQL connections to the server. CQL connections are made over TCP on port 9042.
In the Cloud Console, navigate to VPC Network > Firewall.
Click Create Firewall Rule.
For the name, use allow-cql.
In the Target tags field enter cql-server.
For Source IP ranges enter 0.0.0.0/0.
Under Protocols and ports check the box next to tcp and enter 9042 in the field.
Click Create.
Click Check my progress to verify the objective.
Create a firewall rule
Task 3. Run an application to load data into Apache Cassandra™
In Cloud Shell, download a simple java application with the following command:
The Docker image will deploy without authentication enabled. After deployment, you will create a modified config file that will override the default configurations to enable authentication. To do this, you will use a Configuration Volume. You can learn more about this from the Using the DSE configuration volume documentation. For now, all you need to know is that you need to mount a directory in the container.
Under Volume mounts, click Add a volume mount. The New volume mount section should expand.
For Volume Type, select Directory.
For Mount path, use: /config.
For Host path, use: /tmp/dse-config.
Set Mode to Read/write.
Click Done, then click Select.
Click Networking.
Network tag: cql-server.
Click Create.
Click Check my progress to verify the objective.
Create an instance named dse-server
Task 5. Enable authentication on DataStax Enterprise
When the VM Instance is available, click the dse-server instance.
Click the SSH button to connect in a browser.
Enter the following command to confirm that the DSE container loaded:
sudo docker ps
You should see a container using an image called registry.hub.docker.com/datastax/dse-server:6.8.18. Note the name of this container. It should be similar to klt-dse-server-llpl.
You will now need to enable authentication. To do this, you will copy a config file dse.yaml from inside the container to the host VM's local filesystem.
Run the following command, replacing <<container-name>> with the name of your DSE container:
Use Ctrl+c to save the file, type :wq, and hit ENTER to save and exit the editor.
Now, restart the container, replacing <<container-name>> with the name of your DSE container:
sudo docker restart <<container-name>>
Click Check my progress to verify the objective.
Enable Authentication on DataStax Enterprise
Task 6. Connect to DataStax Enterprise
Once it has restarted, open a shell in the container, replacing <<container-name>> with the name of your DSE container:
sudo docker exec -it <<container-name>> bash
Run CQLSH:
cqlsh
You should see the following error because authentication is enabled: Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")}).
Run CQLSH again, this time passing the default username and password:
cqlsh -u cassandra -p cassandra
Once you are logged in to the database, create a keyspace for the application to connect to:
CREATE KEYSPACE simpleapp WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
Create a table for the application to use when reading and writing data:
Keep the CQL Shell open and return to the Cloud Console.
Click Check my progress to verify the objective.
Create a keyspace and table for application on dse-server instance
Task 7. Run the application to load data into DataStax Enterprise
In the Console, navigate to the Compute Engine > VM Instances page. Note the external IP address of the dse-server VM.
Open Cloud Shell and run the application again, replacing <<dse-external-ip>> with the external IP address of the VM hosting the DSE Docker image.
Note, we are using a different datacenter name dc1:
Reconnect to the CQL Shell on the DSE VM and rerun the count query:
cqlsh -u cassandra -p cassandra
select count(*) from simpleapp.data;
You should now see that the number of records has increased following the import.
Click Check my progress to verify the objective.
Migrate the data from Apache Cassandra™ to DSE
Congratulations!
In this lab, you migrated an application running on Apache Cassandra™ to DataStax Enterprise. You first deployed a Cassandra™ database and a DataStax Enterprise database using Docker. Next, you connected an application to both Cassandra™ and DSE using CQL Shell and ran some simple DDL commands to create a table, load some data, and query it. You then migrated the data from the Apache Cassandra™ database to the DSE database using the DataStax Bulk Loader dsbulk.
Take advantage of the largest library of technical courses at DataStax Academy
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated December 11, 2024
Lab Last Tested October 04, 2024
Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
Los labs crean un proyecto de Google Cloud y recursos por un tiempo determinado
.
Los labs tienen un límite de tiempo y no tienen la función de pausa. Si finalizas el lab, deberás reiniciarlo desde el principio.
En la parte superior izquierda de la pantalla, haz clic en Comenzar lab para empezar
Usa la navegación privada
Copia el nombre de usuario y la contraseña proporcionados para el lab
Haz clic en Abrir la consola en modo privado
Accede a la consola
Accede con tus credenciales del lab. Si usas otras credenciales, se generarán errores o se incurrirá en cargos.
Acepta las condiciones y omite la página de recursos de recuperación
No hagas clic en Finalizar lab, a menos que lo hayas terminado o quieras reiniciarlo, ya que se borrará tu trabajo y se quitará el proyecto
Este contenido no está disponible en este momento
Te enviaremos una notificación por correo electrónico cuando esté disponible
¡Genial!
Nos comunicaremos contigo por correo electrónico si está disponible
Un lab a la vez
Confirma para finalizar todos los labs existentes y comenzar este
Usa la navegación privada para ejecutar el lab
Usa una ventana de navegación privada o de Incógnito para ejecutar el lab. Así
evitarás cualquier conflicto entre tu cuenta personal y la cuenta
de estudiante, lo que podría generar cargos adicionales en tu cuenta personal.
In this lab, you will learn how to migrate an application running on Apache Cassandra™ to DataStax Enterprise (DSE). To do this, you will deploy a Cassandra™ database and an application that writes data into it. You will then deploy a DataStax Enterprise database and connect the same application to the database. Finally, you will learn how to migrate data from Apache Cassandra™ to DSE using the The DataStax Bulk Loader dsbulk.
Duración:
0 min de configuración
·
Acceso por 60 min
·
60 min para completar