tags | displayed_sidebar | |
---|---|---|
|
docsEnglish |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
This guide explains how to configure your ScalarDB properties file and creating schemas to run transactions through a one-phase or a two-phase commit interface by using ScalarDB Cluster SQL.
:::warning
You need to have a license key (trial license or commercial license) for ScalarDB Cluster. If you don't have a license key, please contact us.
:::
For the purpose of this guide, you will set up a database and ScalarDB Cluster in standalone mode by using a sample in the ScalarDB samples repository.
:::note
ScalarDB Cluster in standalone mode is primarily for development and testing purposes.
:::
Open Terminal, then clone the ScalarDB samples repository by running the following command:
git clone https://github.com/scalar-labs/scalardb-samples
Then, go to the directory that contains the necessary files by running the following command:
cd scalardb-samples/scalardb-cluster-standalone-mode
Select your database, and follow the instructions to configure it for ScalarDB Cluster.
For a list of databases that ScalarDB supports, see Databases.
You can run MySQL in Docker Compose by using the `docker-compose.yaml` file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory.
To start MySQL, run the following command:
```console
docker compose up -d mysql
```
<h3>Configure ScalarDB Cluster</h3>
The **scalardb-cluster-node.properties** file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory contains database configurations for ScalarDB Cluster. Please uncomment the properties for MySQL in the **scalardb-cluster-node.properties** file so that the configuration looks as follows:
```properties
# For MySQL
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:mysql://mysql-1:3306/
scalar.db.username=root
scalar.db.password=mysql
```
You can run PostgreSQL in Docker Compose by using the `docker-compose.yaml` file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory.
To start PostgreSQL, run the following command:
```console
docker compose up -d postgres
```
<h3>Configure ScalarDB Cluster</h3>
The **scalardb-cluster-node.properties** file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory contains database configurations for ScalarDB Cluster. Please uncomment the properties for PostgreSQL in the **scalardb-cluster-node.properties** file so that the configuration looks as follows:
```properties
# For PostgreSQL
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:postgresql://postgres-1:5432/
scalar.db.username=postgres
scalar.db.password=postgres
```
You can run Oracle Database in Docker Compose by using the `docker-compose.yaml` file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory.
To start Oracle Database, run the following command:
```console
docker compose up -d oracle
```
<h3>Configure ScalarDB Cluster</h3>
The **scalardb-cluster-node.properties** file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory contains database configurations for ScalarDB Cluster. Please uncomment the properties for Oracle Database in the **scalardb-cluster-node.properties** file so that the configuration looks as follows:
```properties
# For Oracle
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:oracle:thin:@//oracle-1:1521/FREEPDB1
scalar.db.username=SYSTEM
scalar.db.password=Oracle
```
You can run SQL Server in Docker Compose by using the `docker-compose.yaml` file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory.
To start SQL Server, run the following command:
```console
docker compose up -d sqlserver
```
<h3>Configure ScalarDB Cluster</h3>
The **scalardb-cluster-node.properties** file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory contains database configurations for ScalarDB Cluster. Please uncomment the properties for SQL Server in the **scalardb-cluster-node.properties** file so that the configuration looks as follows:
```properties
# For SQL Server
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:sqlserver://sqlserver-1:1433;encrypt=true;trustServerCertificate=true
scalar.db.username=sa
scalar.db.password=SqlServer22
```
You can run Amazon DynamoDB Local in Docker Compose by using the `docker-compose.yaml` file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory.
To start Amazon DynamoDB Local, run the following command:
```console
docker compose up -d dynamodb
```
<h3>Configure ScalarDB Cluster</h3>
The **scalardb-cluster-node.properties** file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory contains database configurations for ScalarDB Cluster. Please uncomment the properties for Amazon DynamoDB Local in the **scalardb-cluster-node.properties** file so that the configuration looks as follows:
```properties
# For DynamoDB Local
scalar.db.storage=dynamo
scalar.db.contact_points=sample
scalar.db.username=sample
scalar.db.password=sample
scalar.db.dynamo.endpoint_override=http://dynamodb-1:8000
```
<h3>Configure Cosmos DB for NoSQL</h3>
Set the **default consistency level** to **Strong** according to the official document at [Configure the default consistency level](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-manage-consistency#configure-the-default-consistency-level).
<h3>Configure ScalarDB Cluster</h3>
The following instructions assume that you have properly installed and configured the JDK in your local environment and properly configured your Cosmos DB for NoSQL account in Azure.
The **scalardb-cluster-node.properties** file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory contains database configurations for ScalarDB Cluster. Be sure to change the values for `scalar.db.contact_points` and `scalar.db.password` as described.
```properties
# For Cosmos DB
scalar.db.storage=cosmos
scalar.db.contact_points=<COSMOS_DB_FOR_NOSQL_URI>
scalar.db.password=<COSMOS_DB_FOR_NOSQL_KEY>
```
:::note
You can use the primary key or the secondary key in your Azure Cosmos DB account as the value for scalar.db.password
.
:::
You can run Apache Cassandra in Docker Compose by using the `docker-compose.yaml` file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory.
To start Apache Cassandra, run the following command:
```console
docker compose up -d cassandra
```
<h3>Configure ScalarDB Cluster</h3>
The **scalardb-cluster-node.properties** file in the `scalardb-samples/scalardb-cluster-standalone-mode` directory contains database configurations for ScalarDB Cluster. Please uncomment the properties for Cassandra in the **scalardb-cluster-node.properties** file so that the configuration looks as follows:
```properties
# For Cassandra
scalar.db.storage=cassandra
scalar.db.contact_points=cassandra-1
scalar.db.username=cassandra
scalar.db.password=cassandra
```
For a comprehensive list of configurations for ScalarDB Cluster SQL, see ScalarDB Cluster SQL client configurations.
To set up ScalarDB Cluster in standalone mode, you'll need to set a license key and then start ScalarDB Cluster.
Set the license key (trial license or commercial license) for the ScalarDB Clusters in the properties file. For details, see How to Configure a Product License Key.
To start ScalarDB Cluster in standalone mode, run the following command:
:::note
If you want to change other configurations for ScalarDB Cluster, update the scalardb-cluster-node.properties
file before running the command below.
:::
docker compose up -d scalardb-cluster-node
ScalarDB has its own data model and schema that maps to the implementation-specific data model and schema.
- Need to create a database schema? See SQL CLI.
- Need to import an existing database? See Importing Existing Tables to ScalarDB by Using ScalarDB Schema Loader.
You can run transactions by using a one-phase or a two-phase commit interface. Select your method for running transactions.
For details about how to run transactions by using a one-phase commit interface, see the [ScalarDB SQL JDBC Guide](../scalardb-sql/jdbc-guide.mdx).
:::note
Documentation for how to run transactions in a two-phase commit interface is coming soon.
:::
For details about how to run transactions by using a one-phase commit interface, see the [ScalarDB SQL API Guide](../scalardb-sql/sql-api-guide.mdx).
:::note
Documentation for how to run transactions in a two-phase commit interface is coming soon.
:::
<h3>Learn more</h3>
To learn more about running transactions by using ScalarDB Cluster SQL, see the following:
- [ScalarDB Cluster SQL gRPC API Guide](scalardb-cluster-sql-grpc-api-guide.mdx)
For details about how to run transactions by using a one-phase or a two-phase commit interface, see the [Getting Started with LINQ in the ScalarDB Cluster .NET Client SDK](../scalardb-cluster-dotnet-client-sdk/getting-started-with-linq.mdx#manage-transactions).
For details about how to run transactions by using a one-phase commit interface, see the [Getting Started with Distributed SQL Transactions in the ScalarDB Cluster .NET Client SDK](../scalardb-cluster-dotnet-client-sdk/getting-started-with-distributed-sql-transactions.mdx).
:::note
Documentation for how to run transactions in a two-phase commit interface is coming soon. For now, please refer to Getting Started with Distributed Transactions with a Two-Phase Commit Interface in the ScalarDB Cluster .NET Client SDK.
:::