Setup Syndeia Database.
Syndeia uses Apache Cassandra as a shared backend database when running in Database mode. Follow the steps below to setup and configure Cassandra if your organization will be using Syndeia in the shared database mode.
- 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 can be accessed by Syndeia installations on the user machines. Cassandra can be installed on any modern OS like Windows, Linux or Mac. We recommend a machine with minimum 8 GB of RAM (more the better). 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.
- Go to the Cassandra download site - http://cassandra.apache.org/download/ - and download the compressed .tar.gz file. Unzip the compressed file and include the resulting folder in your PATH environment variable (for Windows). For example, the resulting folder after unzipping may be C:\apache-cassandra-3.10 (on Windows) or /home/apache-cassandra-3.10 (on Linux or Mac), and its contents will be as below. Let’s refer to this folder location as <Cassandra Installation> in the remainder of this document.
- Now let's setup Cassandra so that you can access, start, and stop it from any folder.
- For Windows: Either 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 the following lines to your ~/.profile file.
export CASSANDRA=/home/apache-cassandra-3.10 export PATH=$PATH:$CASSANDRA/bin
- For Windows: Either 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.
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 the following:
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 first 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 <Cassandra Installation>\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
You should see an output such as below. This indicates that Cassandra is up and running.
- DataStax are the creators of DataStax Enterprise, the commercially supported version of Apache Cassandra. They have a tool called DataStax DevCenter that provides a rich UI (beyond command line tools) to 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 below.
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 behavior, you need to modify the cassandra.yaml file located in <Cassandra Installation>\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 usernames and grant access rights (view/update/delete tables and keyspaces) to all Syndeia users who will be using the database.
Read the documentation here - https://docs.datastax.com/en/cql/3.3/cql/cql_using/useSecureRoles.html - to create roles, https://docs.datastax.com/en/cql/3.3/cql/cql_using/useSecureUsers.html to create users, and https://docs.datastax.com/en/cql/3.3/cql/cql_using/useSecurePermission.html to create permissions in Cassandra. Here are a few examples commands.
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 repository-related information and a SysML project-specific keyspace to store connection-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 query editor (see screenshot above), then the keyspace name may be omitted, and the following command may be used:select * from repositories;
Similarly, all the connections may be viewed by selecting the project-specific keyspace from the dropdown menu in the DevCenter query editor and executing the following command:select * from connections;
Copyright 2018 Intercax.