This section describes details of the Cassandra Database used by ShCM nodes.
Overview
The Sh Cache Microservice uses Cassandra to cache the HSS Data.
As of Sentinel version 3.1, the Cassandra database is now provided by the TSN (TAS Storage Node). In Sentinel version 3.0, the Cassandra database was normally provided by the MAG node.
Database Schema
The below schema is for information only. During the initial configuration process the schema is automatically created on the TSNs. There is no need to run any CQL commands manually. |
Cassandra’s tables exist in a 'keyspace', which, for illustrative purposes, can be thought of as a 'database' in SQL implementations.
-
The keyspace must be named
opencloud_sh_cache_microservice
. -
For a production environment, the keyspace is created with replication (that is, each row in a table is replicated to many of the Cassandra nodes in the cluster, rather than just one). A sample CQL command for creating such a keyspace is:
CREATE KEYSPACE IF NOT EXISTS opencloud_sh_cache_microservice WITH REPLICATION={'class' : 'SimpleStrategy', 'replication_factor' : 3};
-
For testing purposes, replication may not be necessary. A sample CQL command for creating such a keyspace is:
CREATE KEYSPACE IF NOT EXISTS opencloud_sh_cache_microservice WITH REPLICATION={'class' : 'SimpleStrategy', 'replication_factor' : 1};
Once a keyspace is created, the required tables can be created. The following CQL statements provide both the structure and insight into the tables that are required.
USE opencloud_sh_cache_microservice;
CREATE TABLE IF NOT EXISTS repository_data_cache (
public_id text,
service_ind text,
sequence_number int,
user_data blob,
valid_until timestamp,
PRIMARY KEY (public_id, service_ind)
)
WITH gc_grace_seconds = 518400; //6 days
CREATE TABLE IF NOT EXISTS repository_data_lock (
public_id text,
service_ind text,
owner_id uuid,
count int,
held boolean,
held_until timestamp,
PRIMARY KEY (public_id, service_ind)
)
WITH gc_grace_seconds = 864000; //10 days
CREATE TABLE IF NOT EXISTS repository_data_subscription (
public_id text,
service_ind text,
expires timestamp,
PRIMARY KEY (public_id, service_ind)
)
WITH gc_grace_seconds = 518400; //6 days
USE opencloud_sh_cache_microservice;
CREATE TABLE IF NOT EXISTS dataref_cache (
public_id text,
dataref_id int,
private_id text,
user_data blob,
valid_until timestamp,
PRIMARY KEY (public_id, dataref_id, private_id)
)
WITH gc_grace_seconds = 518400; //6 days
CREATE TABLE IF NOT EXISTS dataref_lock (
public_id text,
dataref_id int,
private_id text,
owner_id uuid,
count int,
held boolean,
held_until timestamp,
PRIMARY KEY (public_id, dataref_id, private_id)
)
WITH gc_grace_seconds = 864000; //10 days
CREATE TABLE IF NOT EXISTS dataref_subscription (
public_id text,
dataref_id int,
private_id text,
expires timestamp,
PRIMARY KEY (public_id, dataref_id, private_id)
)
WITH gc_grace_seconds = 518400; //6 days
USE opencloud_sh_cache_microservice;
CREATE TABLE IF NOT EXISTS as_dataref_cache (
public_id text,
dataref_id int,
as_name text,
dsai_tags frozen<set<text>>,
user_data blob,
valid_until timestamp,
PRIMARY KEY (public_id, dataref_id, as_name, dsai_tags)
)
WITH gc_grace_seconds = 518400; //6 days
CREATE TABLE IF NOT EXISTS as_dataref_lock (
public_id text,
dataref_id int,
as_name text,
dsai_tags frozen<set<text>>,
owner_id uuid,
count int,
held boolean,
held_until timestamp,
PRIMARY KEY (public_id, dataref_id, as_name, dsai_tags)
)
WITH gc_grace_seconds = 864000; //10 days
CREATE TABLE IF NOT EXISTS as_dataref_subscription (
public_id text,
dataref_id int,
as_name text,
dsai_tags frozen<set<text>>,
expires timestamp,
PRIMARY KEY (public_id, dataref_id, as_name, dsai_tags)
)
WITH gc_grace_seconds = 518400; //6 days
USE opencloud_sh_cache_microservice;
CREATE TABLE IF NOT EXISTS impu_cache (
public_id text,
identity_sets frozen<set<int>>,
user_data blob,
valid_until timestamp,
PRIMARY KEY (public_id, identity_sets)
)
WITH gc_grace_seconds = 518400; //6 days
CREATE TABLE IF NOT EXISTS impu_lock (
public_id text,
identity_sets frozen<set<int>>,
owner_id uuid,
count int,
held boolean,
held_until timestamp,
PRIMARY KEY (public_id, identity_sets)
)
WITH gc_grace_seconds = 864000; //10 days
CREATE TABLE IF NOT EXISTS impu_subscription (
public_id text,
identity_sets frozen<set<int>>,
expires timestamp,
PRIMARY KEY (public_id, identity_sets)
)
WITH gc_grace_seconds = 518400; //6 days
USE opencloud_sh_cache_microservice;
CREATE TABLE IF NOT EXISTS subscribe_ue_reachability (
public_id text,
private_id text,
notification_url text,
notification_data text,
subscription_id uuid,
span_id uuid,
PRIMARY KEY (public_id, private_id, subscription_id)
)
WITH gc_grace_seconds = 172800; //2 days