This guide describes how to setup Datastax Astra DB cloud for your ThingsBoard. This is an alternative having your own Cassandra cluster.
- Prerequisites
- Step 1. Get an account on Astra DB
- Step 2. Create new Keyspace on Astra DB
- Step 3. Generate Token
- Step 4. Downloading secure connect bundle
- Step 5. Set connection parameters on ThingsBoard
- Step 6. Run standard ThingsBoard install
- TL;DR
- Thingsboard test run on Astra DB cloud
Prerequisites
You need high speed and low latency Internet connection to communicate with Cassandra on Astra DB cloud. Allowed outbound connection to https://astra.datastax.com
Step 1. Get an account on Astra DB
Register a new or sign in existed account. To register a new account visit Astra DB register page
Step 2. Create new Keyspace on Astra DB
Create a new database thingsboard
with keyspace thingsboard
. Select the closest location to you and cloud provider you like.
The database list will look like on the picture below:
Step 3. Generate Token
You need a Database administrator
role to install the Thingsboard schema. Click Create a token
on the thingsboard
database.
Step 4. Downloading secure connect bundle
To connect to your Astra DB database using the drivers, download the secure database bundle from the DataStax Astra Portal that contains the connection credentials.
The detail info on how to work with secure bundle you can find at Astra DB documentation
Or simple do as shown on the picture below
The secure-connect-thingsboard.zip
file contains the security certificates and credentials for your database
Step 5. Set connection parameters on ThingsBoard
Here the environments you need to set to use your Astra DB with ThingsBoard.
ThingsBoard service
For ThingsBoard as a local service add to the /etc/thingsboard/conf/thingsboard.conf
1
2
3
4
5
6
export DATABASE_TS_TYPE=cassandra
# Cassandra on Astra DB cloud
export CASSANDRA_CLOUD_SECURE_BUNDLE_PATH=/etc/thingsboard/astra/secure-connect-thingsboard.zip
# dbadmin
export CASSANDRA_CLOUD_CLIENT_ID=KNpxZasfKNpxZasfKNpxZasf
export CASSANDRA_CLOUD_CLIENT_SECRET=6Rht+1oh8H_v4f3dbFiZ.KHBim6Rht+1oh8H_v4f3dbFiZ.KHBim6Rht+1oh8H_v4f3dbFiZ.KHBim
ThingsBoard docker compose
Here an example how to set the docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
version: '3'
services:
tb:
image: "thingsboard/tb-postgres:3.4.2"
network_mode: "host"
restart: "always"
# replace /home/your_user/Downloads/ with your local path
volumes:
- /home/your_user/Downloads/secure-connect-thingsboard.zip:/etc/thingsboard/astra/secure-connect-thingsboard.zip
environment:
HTTP_BIND_PORT: "8080"
DATABASE_TS_TYPE: "cassandra"
# Cassandra on cloud
CASSANDRA_CLOUD_SECURE_BUNDLE_PATH: "/etc/thingsboard/astra/secure-connect-thingsboard.zip"
# dbadmin
CASSANDRA_CLOUD_CLIENT_ID: "KNpxZasfKNpxZasfKNpxZasf"
CASSANDRA_CLOUD_CLIENT_SECRET: "6Rht+1oh8H_v4f3dbFiZ.KHBim6Rht+1oh8H_v4f3dbFiZ.KHBim6Rht+1oh8H_v4f3dbFiZ.KHBim"
ThingsBoard Kubernetes cluster
Create a secret with base64 encoded bundle file, client_id and client_secret.
Here how to encode the client_id or client_secret. The encoded strings will appear on your screen.
Copy and paste it to the astra-secret.yaml
.
1
2
echo -n "your_client_id" | base64 -w 0
echo -n "your_client_secret" | base64 -w 0
Here how to encode a file and put the result to the clipboard as single line:
1
base64 -w 0 /home/your_user/projects/astra/secure-connect-thingsboard.zip | xclip -selection clipboard
The resulting file will look like astra-secret.yml
. The secure-connect-thingsboard.zip
encoded string is very long.
1
2
3
4
5
6
7
8
9
10
11
apiVersion: v1
kind: Secret
metadata:
name: astra-secret
type: Opaque
data:
secure-connect-thingsboard.zip: >-
UEsDBBQACAAIAIpyYlUAAAAAAAAAAAAAAAAGAAkAY2EuY3J0VVQFAAGlfGJjZJTNkro4FMX3PMXsrSkBP5DFf3EDIYAGDfIVd4IaxAYVaQI+/VTbm6mZLE+lfvecurfO3z8PYeIFf1k4jDzHsyDCH1Whnmd3tmXBYxQgPQTCs1ATS5txf30/eGVfBMDwBjGQ5zfeULgR0GKMSmolCR0U6w0+EkGCQERwCxANmcSC2wljLpZdxNOFyvfIzokz8giHFFYfgFVSLySOqvAkUHkmBrsC+gt6RSgOXvksudE9lz58YDYetIrvFzd+XZTFLBz5XpNFbd6UTR2WJ+K8T8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bvZvIK8kNSIWFZIoGqer8J4SjNTs/vEDUi1swTe80X3WgnBadiifiY4vTElMCMGCSqGSIb3DQEJFTEWBBSNquhZEBhtl9Z0hLPx3tmTVoXQFTArMB8wBwYFKw4DAhoEFFECOoJv7jzEhf4zY36tfAyrbsqGBAhgaj2PD7fbGQEAAP//UEsHCMEKsDxpDgAAXw4AAFBLAQIUAxQACAAIAIpyYlXShxbm6AMAAEEFAAAGAAkAAAAAAAAAAACAgQAAAABjYS5jcnRVVAUAAaV8YmNQSwECFAMUAAgACACKcmJVbss7KQUFAACLBgAAAwAJAAAAAAAAAAAAgIElBAAAa2V5VVQFAAGlfGJjUEsBAhQDFAAIAAgAinJiVao26SAvBAAA9QUAAAQACQAAAAAAAAAAAICBZAkAAGNlcnRVVAUAAaV8YmNQSwECFAMUAAgACACKcmJV5jgXPUkKAAA6CwAADAAJAAAAAAAAAAAApIHODQAAaWRlbnRpdHkuamtzVVQFAAGlfGJjUEsBAhQDFAAIAAgAinJiVaNoxLtIBAAAfwUAAA4ACQAAAAAAAAAAAKSBWhgAAHRydXN0U3RvcmUuamtzVVQFAAGlfGJjUEsBAhQDFAAIAAgAinJiVcSGB5cZAQAA9wEAAAsACQAAAAAAAAAAAKSB5xwAAGNvbmZpZy5qc29uVVQFAAGlfGJjUEsBAhQDFAAIAAgAinJiVZs9ZyalAAAAzgAAAAcACQAAAAAAAAAAAKSBQh4AAGNxbHNocmNVVAUAAaV8YmNQSwECFAMUAAgACACKcmJVwQqwPGkOAABfDgAACAAJAAAAAAAAAAAApIElHwAAY2VydC5wZnhVVAUAAaV8YmNQSwUGAAAAAAgACAD5AQAAzS0AAAAA
client_id: S05weFphc2ZLTnB4WmFzZktOcHhaYXNm
client_secret: NlJodCsxb2g4SF92NGYzZGJGaVouS0hCaW02Umh0KzFvaDhIX3Y0ZjNkYkZpWi5LSEJpbTZSaHQrMW9oOEhfdjRmM2RiRmlaLktIQmlt
---
Then mount secure-connect-thingsboard.zip
from secret to the tb-node.yml
and tb-rule-engine.yml
.
Add the environment variables to provide Astra DB credentials. Here an example for tb-node.yml
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# example header
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: tb-node
spec:
serviceName: tb-node-headless
replicas: 2
podManagementPolicy: "Parallel"
selector:
matchLabels:
app: tb-node
template:
metadata:
labels:
app: tb-node
spec:
# below is the Astra DB related settings
volumes:
- name: astra-secret
secret:
secretName: "astra-secret"
items:
- key: secure-connect-thingsboard.zip
path: secure-connect-thingsboard.zip
containers:
- name: tb-node
image: thingsboard/tb-node:3.4.2
volumeMounts:
- mountPath: /etc/thingsboard/astra
name: astra-secret
readOnly: true
env:
- name: CASSANDRA_CLOUD_CLIENT_ID
valueFrom:
secretKeyRef:
name: astra-secret
key: client_id
- name: CASSANDRA_CLOUD_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: astra-secret
key: client_secret
- name: CASSANDRA_CLOUD_SECURE_BUNDLE_PATH
value: "/etc/thingsboard/astra/secure-connect-thingsboard.zip"
# merge carefully with your actual yaml file(s)
---
Take notice that you don’t need to provide Cassandra user, password, endpoint, keyspace, datacenter, SSL, etc. All details will be set automatically based on CASSANDRA_CLOUD_SECURE_BUNDLE_PATH, CASSANDRA_CLOUD_CLIENT_ID, CASSANDRA_CLOUD_CLIENT_SECRET values.
Step 6. Run standard ThingsBoard install
ThingsBoard is already support install on Astra DB cloud. It is enough to provide CASSANDRA_CLOUD_SECURE_BUNDLE_PATH, CASSANDRA_CLOUD_CLIENT_ID, CASSANDRA_CLOUD_CLIENT_SECRET values before install.
TL;DR
The key difference with stand alone Cassandra is that you are not able to create a keyspace using CQL. For the Astra DB cloud, you have to create keyspace from UI or API at first. And create user with credentials at second.
Next steps are completely the same for on-premise Cassandra and Astra DB cloud.
Thingsboard test run on Astra DB cloud
Here an example how to test your Thingsboard with your Astra DB using performance test tool.
To spin up the Thingsboard locally, use docker-compose.yml
provided couple sections above.
IMPORTANT: The test will consume your Credits. Please use it smart. Don’t forget to delete the keyspace after your test.
Let’s put some telemetry from 1000 devices each 10 seconds during 1 hour.
1
2
3
4
5
6
7
8
9
10
11
12
13
docker run -it --rm --network host --name tb-perf-test \
--pull always --log-driver none \
--env REST_URL=http://127.0.0.1:8080 \
--env MQTT_HOST=127.0.0.1 \
--env [email protected] \
--env REST_PASSWORD=tenant \
--env DEVICE_END_IDX=1000 \
--env MESSAGES_PER_SECOND=100 \
--env DURATION_IN_SECONDS=3600 \
--env ALARMS_PER_SECOND=1 \
--env DEVICE_CREATE_ON_START=true \
--env TEST_PAYLOAD_TYPE=SMART_METER \
thingsboard/tb-ce-performance-test:latest