Syndeia uses Apache Cassandra as a shared backend database. Follow the steps below to setup and configure Cassandra.
- You will be installing the latest Apache Cassandra release - 3.10. Since this is a database that will be shared by all Syndeia users in your group / organization, you must install it on a shared machine (on-premise or cloud) that be accessed by the Syndeia installations on the user machines.
- Go to the Cassandra download site - http://cassandra.apache.org/download/ - and download the compressed .tar.gz file. Unzip the compressed file in a folder on your machine and include that folder in your PATH environment variable (for Windows). For example, say, you unzip it to C:\apache-cassandra-3.10 (on Windows) or /home/apache-cassandra-3.10 (on Linux or Mac), then you’ll see a folder structure like below –
Let’s refer to this folder location C:\apache-cassandra-3.10 or /home/apache-cassandra-3.10 as <Cassandra Installation> and the remaining document will use this placeholder instead of the OS specific location.
- For Windows: Now either you may create a new environment variable called CASSANDRA_HOME which points to <Cassandra Installation>, or you may edit the PATH environment variable and append <Cassandra Installation> at the end of it.
For Linux / Mac: Add to your ~/.profile file - export PATH=$PATH: <Cassandra Installation>
Once you’ve done this, open a command prompt (terminal) and type
cassandra -f
You’ll see a lot of output being printed at the terminal and at the end of it you’ll see –
INFO 09:16:08 Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
INFO 09:16:09 Not starting RPC server as requested. Use JMX (StorageService->startRPCServer()) or nodetool (enablethrift) to start it
The highlighted line above means that Cassandra is running on the default port number 9042.
If you encounter “command cassandra not found” or a similar error, then there is some problem with the environment variable not being properly set (because the OS is not able to find cassandra (.bat or .sh file). In that case you can navigate to the C:\ apache-cassandra-3.10\bin folder and then run the above command.
To double check if Cassandra is running, run the following command in another terminal window -
nodetool status - DataStax are the creators of DataStax Enterprise, the commercially supported version of Apache Cassandra. They have a tool called DataStax DevCenter which can be used to visually connect to a running instance of Cassandra. Using this tool, you can create keyspaces, run CQL queries etc. However, to download DevCenter, you’ll first need to create an account on the DataStax site, and then go to https://academy.datastax.com/downloads/ops-center to download DevCenter. Once you run DevCenter, you’ll need to create a connection to the server where Cassandra is running, and then you may run queries in the editor as shown in the below images –
DataStax DevCenter Connections pane –
DataStax DevCenter Schema pane –
DataStax DevCenter query editor – By default, Cassandra is configured to let any user access the database without asking for any username / password combination. To change this behaviour, we need to modify the cassandra.yaml file located in C:\ apache-cassandra-3.10\conf folder. Search for the string – “authenticator:” in the file. You’ll notice that the default value is set to – AllowAllAuthenticator. As is mentioned in the comments (in the yaml file) starting with # character, AllowAllAuthenticator performs no checks and is used to disable authentication. Change this value to PasswordAuthenticator. Similarly, search for the string – “authorizer:” (this section is exactly below the authenticator section described above). The default value is set to AllowAllAuthorizer which allows any action to any user and is used to disable authorization. Change this value to CassandraAuthorizer. Now, Cassandra will ask for username / password combination to login to it and the admin will have to create different usernames and grant them proper access rights to view / update / delete tables / keyspaces etc.
Please read the documentation to create database roles, users and permissions in Apache Cassandra. Here are a few examples to accomplish the above –
CREATE USER IF NOT EXISTS sandy WITH PASSWORD 'Ride2Win@' NOSUPERUSER;
CREATE ROLE IF NOT EXISTS team_manager WITH PASSWORD = 'RockIt4Us!';
GRANT MODIFY ON KEYSPACE cycling TO team_manager;
GRANT DESCRIBE ON ALL ROLES TO sys_admin;Syndeia uses syndeia_general keyspace to store repositories related information and a SysML project specific keyspace to store connections related information. To find all the repositories the following command may be run –
select * from syndeia_general.repositories;
If the keyspace has already been selected in the dropdown in DevCenter, then the keyspace name may be omitted –
select * from repositories;
Similarly, all the connections may be viewed by –
select * from connections;- Cassandra can be installed on any modern OS like Windows, Linux or Mac. Ideally the machine should have 4 GB of RAM (at the minimum) but the more memory, the better. So with dedicated hardware there is no reason to use less than 8GB or 16GB, and you often see clusters with 32GB or more per node.