From b0477e4684fd80c3fac9bf7faf704f0d6dab5b59 Mon Sep 17 00:00:00 2001 From: josh-wong Date: Mon, 17 Nov 2025 04:26:48 +0000 Subject: [PATCH 1/3] AUTO: Sync Helm Charts docs to ScalarDL docs site repo --- .../configure-custom-values-file.mdx | 1 - ...stom-values-scalar-admin-for-kubernetes.mdx | 2 +- .../getting-started-scalar-helm-charts.mdx | 1 - .../how-to-deploy-scalar-products.mdx | 2 -- .../mount-files-or-volumes-on-scalar-pods.mdx | 3 +-- .../helm-charts/use-secret-for-credentials.mdx | 18 ------------------ 6 files changed, 2 insertions(+), 25 deletions(-) diff --git a/docs/helm-charts/configure-custom-values-file.mdx b/docs/helm-charts/configure-custom-values-file.mdx index 9e59653a..e11a49c5 100644 --- a/docs/helm-charts/configure-custom-values-file.mdx +++ b/docs/helm-charts/configure-custom-values-file.mdx @@ -10,7 +10,6 @@ displayed_sidebar: docsEnglish When you deploy Scalar products using Scalar Helm Charts, you must prepare your custom values file based on your environment. Please refer to the following documents for more details on how to a create custom values file for each product. * [ScalarDB Cluster](configure-custom-values-scalardb-cluster.mdx) -* [ScalarDB Analytics with PostgreSQL](configure-custom-values-scalardb-analytics-postgresql.mdx) * [ScalarDL Ledger](configure-custom-values-scalardl-ledger.mdx) * [ScalarDL Auditor](configure-custom-values-scalardl-auditor.mdx) * [ScalarDL Schema Loader](configure-custom-values-scalardl-schema-loader.mdx) diff --git a/docs/helm-charts/configure-custom-values-scalar-admin-for-kubernetes.mdx b/docs/helm-charts/configure-custom-values-scalar-admin-for-kubernetes.mdx index 43b8f5e3..88cfbb0d 100644 --- a/docs/helm-charts/configure-custom-values-scalar-admin-for-kubernetes.mdx +++ b/docs/helm-charts/configure-custom-values-scalar-admin-for-kubernetes.mdx @@ -103,7 +103,7 @@ scalarAdminForKubernetes: - effect: NoSchedule key: scalar-labs.com/dedicated-node operator: Equal - value: scalardb-analytics-postgresql + value: scalardb-cluster ``` ### TLS configurations (optional based on your environment) diff --git a/docs/helm-charts/getting-started-scalar-helm-charts.mdx b/docs/helm-charts/getting-started-scalar-helm-charts.mdx index d51d95db..b149ca1f 100644 --- a/docs/helm-charts/getting-started-scalar-helm-charts.mdx +++ b/docs/helm-charts/getting-started-scalar-helm-charts.mdx @@ -71,7 +71,6 @@ After the Kubernetes cluster starts, you can try each Scalar Helm Charts on it. * [ScalarDB Cluster with TLS](getting-started-scalardb-cluster-tls.mdx) * [ScalarDB Cluster with TLS by Using cert-manager](getting-started-scalardb-cluster-tls-cert-manager.mdx) -* [ScalarDB Analytics with PostgreSQL](getting-started-scalardb-analytics-postgresql.mdx) * [ScalarDL Ledger and Auditor with TLS (Auditor mode)](getting-started-scalardl-auditor-tls.mdx) * [ScalarDL Ledger and Auditor with TLS by Using cert-manager (Auditor mode)](getting-started-scalardl-auditor-tls-cert-manager.mdx) * [ScalarDL Ledger (Ledger only)](getting-started-scalardl-ledger.mdx) diff --git a/docs/helm-charts/how-to-deploy-scalar-products.mdx b/docs/helm-charts/how-to-deploy-scalar-products.mdx index a9489c1b..52d6cf01 100644 --- a/docs/helm-charts/how-to-deploy-scalar-products.mdx +++ b/docs/helm-charts/how-to-deploy-scalar-products.mdx @@ -56,14 +56,12 @@ If you're using any of the following products from the public container reposito * Scalar Envoy (deploy with ScalarDB Cluster, ScalarDL Ledger, or ScalarDL Auditor) * ScalarDL Schema Loader * Scalar Admin for Kubernetes -* ScalarDB Analytics with PostgreSQL ## Deploy Scalar products Please refer to the following documents for more details on how to deploy each product. * [ScalarDB Cluster](how-to-deploy-scalardb-cluster.mdx) -* [ScalarDB Analytics with PostgreSQL](how-to-deploy-scalardb-analytics-postgresql.mdx) * [ScalarDL Ledger](how-to-deploy-scalardl-ledger.mdx) * [ScalarDL Auditor](how-to-deploy-scalardl-auditor.mdx) * [Scalar Admin for Kubernetes](how-to-deploy-scalar-admin-for-kubernetes.mdx) diff --git a/docs/helm-charts/mount-files-or-volumes-on-scalar-pods.mdx b/docs/helm-charts/mount-files-or-volumes-on-scalar-pods.mdx index a8adcce6..2260cd6e 100644 --- a/docs/helm-charts/mount-files-or-volumes-on-scalar-pods.mdx +++ b/docs/helm-charts/mount-files-or-volumes-on-scalar-pods.mdx @@ -7,7 +7,7 @@ displayed_sidebar: docsEnglish # Mount any files or volumes on Scalar product pods -You can mount any files or volumes on Scalar product pods when you use ScalarDB Server, ScalarDB Cluster, ScalarDB Analytics with PostgreSQL, or ScalarDL Helm Charts (ScalarDL Ledger and ScalarDL Auditor). +You can mount any files or volumes on Scalar product pods when you use ScalarDB Server, ScalarDB Cluster, or ScalarDL Helm Charts (ScalarDL Ledger and ScalarDL Auditor). ## Mount key and certificate files on a pod in ScalarDL Helm Charts @@ -115,7 +115,6 @@ You can mount emptyDir to Scalar product pods by using the following keys in you * Keys * `scalardb.extraVolumes` / `scalardb.extraVolumeMounts` (ScalarDB Server) * `scalardbCluster.extraVolumes` / `scalardbCluster.extraVolumeMounts` (ScalarDB Cluster) - * `scalardbAnalyticsPostgreSQL.extraVolumes` / `scalardbAnalyticsPostgreSQL.extraVolumeMounts` (ScalarDB Analytics with PostgreSQL) * `ledger.extraVolumes` / `ledger.extraVolumeMounts` (ScalarDL Ledger) * `auditor.extraVolumes` / `auditor.extraVolumeMounts` (ScalarDL Auditor) diff --git a/docs/helm-charts/use-secret-for-credentials.mdx b/docs/helm-charts/use-secret-for-credentials.mdx index 12499460..ffd5e1eb 100644 --- a/docs/helm-charts/use-secret-for-credentials.mdx +++ b/docs/helm-charts/use-secret-for-credentials.mdx @@ -51,16 +51,6 @@ SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAME ... ``` - - ```yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - ... - scalar.db.username=${env:SCALAR_DB_USERNAME} - scalar.db.password=${env:SCALAR_DB_PASSWORD} - ... - ``` -

ScalarDB Server 3.8 or later (Apache Commons Text syntax)

@@ -176,14 +166,6 @@ SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAME secretName: "scalardb-cluster-credentials-secret" ```
- - **Key:** `scalardbAnalyticsPostgreSQL.secretName` - - ```yaml - scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" - ``` - **Key:** `scalardb.secretName` From 5ca1e9cb26fa2f14ec01b3410c69c8493bfe0bc0 Mon Sep 17 00:00:00 2001 From: Josh Wong <23216828+josh-wong@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:03:27 +0900 Subject: [PATCH 2/3] Fix misspelling in `HashStore` --- sidebars.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sidebars.js b/sidebars.js index de64e5b7..3077749b 100644 --- a/sidebars.js +++ b/sidebars.js @@ -240,7 +240,7 @@ const sidebars = { { type: 'doc', id: 'scalardl-hashstore-command-reference', - label: 'Hashstore Commands', + label: 'HashStore Commands', }, { type: 'doc', @@ -869,7 +869,7 @@ const sidebars = { { type: 'doc', id: 'scalardl-hashstore-command-reference', - label: 'Hashstore コマンドリファレンス', + label: 'HashStore コマンドリファレンス', }, { type: 'doc', From 679ee6d9964c569c6699f9c9689bd515955a3500 Mon Sep 17 00:00:00 2001 From: Josh Wong <23216828+josh-wong@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:15:15 +0900 Subject: [PATCH 3/3] Remove ScalarDB Analytics with PostgreSQL docs --- ...m-values-scalardb-analytics-postgresql.mdx | 189 ------- ...-started-scalardb-analytics-postgresql.mdx | 511 ----------------- ...o-deploy-scalardb-analytics-postgresql.mdx | 41 -- ...m-values-scalardb-analytics-postgresql.mdx | 193 ------- ...-started-scalardb-analytics-postgresql.mdx | 533 ------------------ ...o-deploy-scalardb-analytics-postgresql.mdx | 45 -- ...m-values-scalardb-analytics-postgresql.mdx | 193 ------- ...-started-scalardb-analytics-postgresql.mdx | 533 ------------------ ...o-deploy-scalardb-analytics-postgresql.mdx | 45 -- ...m-values-scalardb-analytics-postgresql.mdx | 193 ------- ...-started-scalardb-analytics-postgresql.mdx | 533 ------------------ ...o-deploy-scalardb-analytics-postgresql.mdx | 45 -- ...m-values-scalardb-analytics-postgresql.mdx | 193 ------- ...-started-scalardb-analytics-postgresql.mdx | 533 ------------------ ...o-deploy-scalardb-analytics-postgresql.mdx | 45 -- ...m-values-scalardb-analytics-postgresql.mdx | 189 ------- ...-started-scalardb-analytics-postgresql.mdx | 511 ----------------- ...o-deploy-scalardb-analytics-postgresql.mdx | 41 -- ...m-values-scalardb-analytics-postgresql.mdx | 189 ------- ...-started-scalardb-analytics-postgresql.mdx | 511 ----------------- ...o-deploy-scalardb-analytics-postgresql.mdx | 41 -- ...m-values-scalardb-analytics-postgresql.mdx | 189 ------- ...-started-scalardb-analytics-postgresql.mdx | 511 ----------------- ...o-deploy-scalardb-analytics-postgresql.mdx | 41 -- 24 files changed, 6048 deletions(-) delete mode 100644 docs/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 docs/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 docs/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx delete mode 100644 versioned_docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx diff --git a/docs/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/docs/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 5d1eb638..00000000 --- a/docs/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,189 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Configure a custom values file for ScalarDB Analytics with PostgreSQL - -This document explains how to create your custom values file for the ScalarDB Analytics with PostgreSQL chart. For details on the parameters, see the [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) of the ScalarDB Analytics with PostgreSQL chart. - -## Required configurations - -This section explains the required configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Database configurations - -To access databases via ScalarDB Analytics with PostgreSQL, you must set the `scalardbAnalyticsPostgreSQL.databaseProperties` parameter by following the same syntax that you use to configure the `database.properties` file. For details about configurations, see [ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/). - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### Database namespaces configurations - -You must set `schemaImporter.namespaces` to all the database namespaces that include tables you want to read via ScalarDB Analytics with PostgreSQL. - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## Optional configurations - -This section explains the optional configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Resource configurations (recommended in production environments) - -To control pod resources by using requests and limits in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.resources`. - -You can configure requests and limits by using the same syntax as requests and limits in Kubernetes. For more details on requests and limits in Kubernetes, see [Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### Secret configurations (recommended in production environments) - -To use environment variables to set some properties, like credentials, in `scalardbAnalyticsPostgreSQL.databaseProperties`, you can use `scalardbAnalyticsPostgreSQL.secretName` to specify the secret resource that includes some credentials. - -For example, you can set credentials for a backend database (`scalar.db.username` and `scalar.db.password`) by using environment variables, which makes your pods more secure. - -For more details on how to use a secret resource, see [How to use Secret resources to pass the credentials as the environment variables into the properties file](use-secret-for-credentials.mdx). - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### Affinity configurations (recommended in production environments) - -To control pod deployment by using affinity and anti-affinity in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.affinity`. - -You can configure affinity and anti-affinity by using the same syntax for affinity and anti-affinity in Kubernetes. For more details on configuring affinity in Kubernetes, see [Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/). - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext configurations (default value is recommended) - -To set SecurityContext and PodSecurityContext for ScalarDB Analytics with PostgreSQL pods, you can use `scalardbAnalyticsPostgreSQL.securityContext`, `scalardbAnalyticsPostgreSQL.podSecurityContext`, and `schemaImporter.securityContext`. - -You can configure SecurityContext and PodSecurityContext by using the same syntax as SecurityContext and PodSecurityContext in Kubernetes. For more details on the SecurityContext and PodSecurityContext configurations in Kubernetes, see [Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### Image configurations (default value is recommended) - -If you want to change the image repository, you can use `scalardbAnalyticsPostgreSQL.image.repository` and `schemaImporter.image.repository` to specify the container repository information of the ScalarDB Analytics with PostgreSQL and Schema Importer images that you want to pull. - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### Replica configurations (optional based on your environment) - -You can specify the number of ScalarDB Analytics with PostgreSQL replicas (pods) by using `scalardbAnalyticsPostgreSQL.replicaCount`. - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL database name configuration (optional based on your environment) - -You can specify the database name that you create in PostgreSQL. Schema Importer creates some objects, such as a view of ScalarDB Analytics with PostgreSQL, in this database. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL superuser password configuration (optional based on your environment) - -You can specify the secret name that includes the superuser password for PostgreSQL. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -You must create a secret resource with this name (`scalardb-analytics-postgresql-superuser-password` by default) before you deploy ScalarDB Analytics with PostgreSQL. For details, see [Prepare a secret resource](how-to-deploy-scalardb-analytics-postgresql.mdx#prepare-a-secret-resource). - -::: - -### Taint and toleration configurations (optional based on your environment) - -If you want to control pod deployment by using taints and tolerations in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.tolerations`. - -You can configure taints and tolerations by using the same syntax as the tolerations in Kubernetes. For details on configuring tolerations in Kubernetes, see the official Kubernetes documentation [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/). - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/docs/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/docs/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 1807de98..00000000 --- a/docs/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,511 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Getting Started with Helm Charts (ScalarDB Analytics with PostgreSQL) - -This guide explains how to get started with ScalarDB Analytics with PostgreSQL by using a Helm Chart in a Kubernetes cluster as a test environment. In addition, the contents of this guide assume that you already have a Mac or Linux environment set up for testing. Although **minikube** is mentioned, the steps described should work in any Kubernetes cluster. - -## What you will create - -You will deploy the following components in a Kubernetes cluster: - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes cluster] | -| | -| [Pod] [Pod] [Pod] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL ("customer" schema) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP client | ---> | Service | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL ("order" schema) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP client | ---(Load sample data with a test OLTP workload)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## Step 1. Start a Kubernetes cluster - -First, you need to prepare a Kubernetes cluster. If you're using a **minikube** environment, please refer to the [Getting Started with Scalar Helm Charts](getting-started-scalar-helm-charts.mdx). If you have already started a Kubernetes cluster, you can skip this step. - -## Step 2. Start MySQL and PostgreSQL pods - -ScalarDB including ScalarDB Analytics with PostgreSQL can use several types of database systems as a backend database. In this guide, you will use MySQL and PostgreSQL. - -You can deploy MySQL and PostgreSQL on the Kubernetes cluster as follows: - -1. Add the Bitnami helm repository. - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Update the helm repository. - - ```console - helm repo update bitnami - ``` - -1. Deploy MySQL. - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. Deploy PostgreSQL. - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. Check if the MySQL and PostgreSQL pods are running. - - ```console - kubectl get pod - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## Step 3. Create a working directory - -Since you'll be creating some configuration files locally, create a working directory for those files. - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## Step 4. Set the versions of ScalarDB, ScalarDB Analytics with PostgreSQL, and the chart - -Set the following three environment variables. If you want to use another version of ScalarDB and ScalarDB Analytics with PostgreSQL, be sure to set them to the versions that you want to use. - -:::note - -You must use the same minor versions (for example, 3.10.x) of ScalarDB Analytics with PostgreSQL as ScalarDB, but you don't need to make the patch versions match. For example, you can use ScalarDB 3.10.1 and ScalarDB Analytics with PostgreSQL 3.10.3 together. - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## Step 5. Run OLTP transactions to load sample data to MySQL and PostgreSQL - -Before deploying ScalarDB Analytics with PostgreSQL, run the OLTP transactions to create sample data. - -1. Start an OLTP client pod in the Kubernetes cluster. - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. Check if the OLTP client pod is running. - - ```console - kubectl get pod oltp-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. Run bash in the OLTP client pod. - - ```console - kubectl exec -it oltp-client -- bash - ``` - - After this step, run each command in the OLTP client pod. - -1. Install the git and curl commands in the OLTP client pod. - - ```console - apt update && apt install -y curl git - ``` - -1. Clone the ScalarDB samples repository. - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. Go to the directory `scalardb-samples/multi-storage-transaction-sample/`. - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - You should see the following output: - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Create a configuration file (`database.properties`) to access MySQL and PostgreSQL in the Kubernetes cluster. - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. Download Schema Loader from [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases). - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Run Schema Loader to create sample tables. - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. Load initial data for the sample workload. - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. Run the sample workload of OLTP transactions. Running these commands will create several `order` entries as sample data. - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. Exit from OLTP client. - - ```console - exit - ``` - -## Step 6. Deploy ScalarDB Analytics with PostgreSQL - -After creating sample data via ScalarDB in the backend databases, deploy ScalarDB Analytics with PostgreSQL. - -1. Create a custom values file for ScalarDB Analytics with PostgreSQL (`scalardb-analytics-postgresql-custom-values.yaml`). - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. Create a secret resource to set a superuser password for PostgreSQL. - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. Deploy ScalarDB Analytics with PostgreSQL. - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## Step 7. Run an OLAP client pod - -To run some queries via ScalarDB Analytics with PostgreSQL, run an OLAP client pod. - -1. Start an OLAP client pod in the Kubernetes cluster. - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. Check if the OLAP client pod is running. - - ```console - kubectl get pod olap-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## Step 8. Run sample queries via ScalarDB Analytics with PostgreSQL - -After running the OLAP client pod, you can run some queries via ScalarDB Analytics with PostgreSQL. - -1. Run bash in the OLAP client pod. - - ```console - kubectl exec -it olap-client -- bash - ``` - - After this step, run each command in the OLAP client pod. - -1. Run the psql command to access ScalarDB Analytics with PostgreSQL. - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - The password is `scalardb-analytics`. - -1. Read sample data in the `customer.customers` table. - - ```sql - SELECT * FROM customer.customers; - ``` - - You should see the following output: - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. Read sample data in the `order.orders` table. - - ```sql - SELECT * FROM "order".orders; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. Read sample data in the `order.statements` table. - - ```sql - SELECT * FROM "order".statements; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. Read sample data in the `order.items` table. - - ```sql - SELECT * FROM "order".items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. Run the `JOIN` query. For example, you can see the credit remaining information of each user as follows. - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. Exit from the psql command. - - ```console - \q - ``` - -1. Exit from the OLAP client pod. - - ```console - exit - ``` - -## Step 9. Delete all resources - -After completing the ScalarDB Analytics with PostgreSQL tests on the Kubernetes cluster, remove all resources. - -1. Uninstall MySQL, PostgreSQL, and ScalarDB Analytics with PostgreSQL. - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. Remove the client pods. - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. Remove the secret resource. - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. Remove the working directory and sample files. - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/docs/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/docs/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index fb190064..00000000 --- a/docs/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# How to deploy ScalarDB Analytics with PostgreSQL - -This document explains how to deploy ScalarDB Analytics with PostgreSQL by using Scalar Helm Charts. For details on the custom values file for ScalarDB Analytics with PostgreSQL, see [Configure a custom values file for ScalarDB Analytics with PostgreSQL](configure-custom-values-scalardb-analytics-postgresql.mdx). - -## Prepare a secret resource - -You must create a secret resource `scalardb-analytics-postgresql-superuser-password` with the key `superuser-password` that includes a superuser password for PostgreSQL before you deploy ScalarDB Analytics with PostgreSQL. Scalar Helm Chart mounts this secret resource and sets the `POSTGRES_PASSWORD` environment variable to the value of the `superuser-password` key. - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## Deploy ScalarDB Analytics with PostgreSQL - -To deploy ScalarDB Analytics with PostgreSQL, run the following command, replacing the contents in the angle brackets as described: - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Upgrade a ScalarDB Analytics with PostgreSQL deployment - -To upgrade a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Delete a ScalarDB Analytics with PostgreSQL deployment - -To delete a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm uninstall -n -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 0c6b8bf9..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,193 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL のカスタム値ファイルを構成する - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、PostgreSQL チャートを使用した ScalarDB Analytics のカスタム値ファイルを作成する方法について説明します。パラメーターの詳細については、ScalarDB Analytics with PostgreSQL チャートの [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) を参照してください。 - -## 必要な構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定するときに必要な構成について説明します。 - -### データベース構成 - -ScalarDB Analytics with PostgreSQL 経由でデータベースにアクセスするには、`database.properties` ファイルの構成に使用するのと同じ構文に従って、`scalardbAnalyticsPostgreSQL.databaseProperties` パラメータを設定する必要があります。設定の詳細については、[ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### データベース名前空間の構成 - -ScalarDB Analytics with PostgreSQL 経由で読み取りたいテーブルを含むすべてのデータベース名前空間に `schemaImporter.namespaces` を設定する必要があります。 - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## オプションの構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定する場合のオプションの構成について説明します。 - -### リソース構成 (実稼働環境で推奨) - -Kubernetes でリクエストと制限を使用してポッドリソースを制御するには、`scalardbAnalyticsPostgreSQL.resources` を使用できます。 - -Kubernetes のリクエストと制限と同じ構文を使用して、リクエストと制限を構成できます。Kubernetes のリクエストと制限の詳細については、[Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### シークレット構成 (運用環境で推奨) - -環境変数を使用して `scalardbAnalyticsPostgreSQL.databaseProperties` で資格情報などのいくつかのプロパティを設定するには、`scalardbAnalyticsPostgreSQL.secretName` を使用していくつかの資格情報を含むシークレットリソースを指定します。 - -たとえば、環境変数を使用してバックエンドデータベースの資格情報 (`scalar.db.username` および `scalar.db.password`) を設定できるため、ポッドの安全性が高まります。 - -シークレットリソースの使用方法の詳細については、[シークレットリソースを使用して資格情報を環境変数としてプロパティファイルに渡す方法(./use-secret-for-credentials.mdx)を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### アフィニティ構成 (運用環境で推奨) - -Kubernetes でアフィニティとアンチアフィニティを使用してポッドのデプロイメントを制御するには、`scalardbAnalyticsPostgreSQL.affinity` を使用できます。 - -Kubernetes のアフィニティとアンチアフィニティと同じ構文を使用して、アフィニティとアンチアフィニティを構成できます。Kubernetes でのアフィニティの構成の詳細については、[Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext 設定 (デフォルト値を推奨) - -PostgreSQL ポッドを使用して ScalarDB Analytics の SecurityContext と PodSecurityContext を設定するには、`scalardbAnalyticsPostgreSQL.securityContext`、`scalardbAnalyticsPostgreSQL.podSecurityContext`、および `schemaImporter.securityContext` を使用できます。 - -Kubernetes の SecurityContext および PodSecurityContext と同じ構文を使用して、SecurityContext および PodSecurityContext を構成できます。Kubernetes の SecurityContext および PodSecurityContext 構成の詳細については、[Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### 画像構成 (デフォルト値を推奨) - -イメージリポジトリを変更する場合は、`scalardbAnalyticsPostgreSQL.image.repository` と `schemaImporter.image.repository` を使用して、プルする ScalarDB Analytics with PostgreSQL および Schema Importer イメージのコンテナリポジトリ情報を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### レプリカ構成 (環境に応じてオプション) - -`scalardbAnalyticsPostgreSQL.replicaCount` を使用して、PostgreSQL レプリカ (ポッド) を使用した ScalarDB Analytics の数を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL データベース名の構成 (環境に応じてオプション) - -PostgreSQL で作成するデータベース名を指定できます。Schema Importer は、ScalarDB Analytics with PostgreSQL のビューなど、いくつかのオブジェクトをこのデータベースに作成します。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL スーパーユーザーのパスワード設定 (環境に応じてオプション) - -PostgreSQL のスーパーユーザーのパスワードを含むシークレット名を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -ScalarDB Analytics with PostgreSQL をデプロイする前に、この名前 (デフォルトでは `scalardb-analytics-postgresql-superuser-password`) でシークレットリソースを作成する必要があります。詳細については、[シークレットリソースを準備する](how-to-deploy-scalardb-analytics-postgresql.mdx#シークレットリソースを準備する)を参照してください。 - -::: - -### 汚染と許容の構成 (環境に応じてオプション) - -Kubernetes でテイントと許容を使用してポッドのデプロイメントを制御したい場合は、`scalardbAnalyticsPostgreSQL.tolerations` を使用できます。 - -Kubernetes の許容と同じ構文を使用して、テイントと許容を構成できます。Kubernetes での許容設定の詳細については、Kubernetes の公式ドキュメント [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 57f8d795..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,533 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# Helm Charts をはじめよう (ScalarDB Analytics with PostgreSQL) - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このガイドでは、Kubernetes クラスターの Helm Chart をテスト環境として使用して、ScalarDB Analytics with PostgreSQL を開始する方法について説明します。さらに、このガイドの内容は、テスト用に Mac または Linux 環境がすでにセットアップされていることを前提としています。**minikube** について言及していますが、説明されている手順はどの Kubernetes クラスターでも機能するはずです。 - -## あなたが作成するもの - -次のコンポーネントを Kubernetes クラスターにデプロイします。 - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes クラスター] | -| | -| [ポッド] [ポッド] [ポッド] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL (「顧客」スキーマ) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP クライアント | ---> | サービス | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL (「順序」スキーマ) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP クライアント | ---(テスト OLTP ワークロードでサンプルデータをロードする)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## ステップ1. Kubernetes クラスターを開始する - -まず、Kubernetes クラスターを準備する必要があります。**minikube** 環境を使用している場合は、[Scalar Helm Charts をはじめよう](getting-started-scalar-helm-charts.mdx)を参照してください。すでに Kubernetes クラスターを開始している場合は、この手順をスキップできます。 - -## ステップ2. MySQL および PostgreSQL ポッドを開始する - -ScalarDB Analytics with PostgreSQL を含むScalarDBは、バックエンドデータベースとして数種類のデータベースシステムを利用できます。このガイドでは、MySQL と PostgreSQL を使用します。 - -次のようにして、Kubernetes クラスターに MySQL と PostgreSQL をデプロイできます。 - -1. Bitnami Helm リポジトリを追加します。 - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Helm リポジトリを更新します。 - - ```console - helm repo update bitnami - ``` - -1. MySQLをデプロイします。 - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. PostgreSQLをデプロイします。 - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. MySQL および PostgreSQL ポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## ステップ3. 作業ディレクトリを作成する - -いくつかの構成ファイルをローカルに作成するので、それらのファイル用の作業ディレクトリを作成します。 - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## ステップ4. ScalarDB、ScalarDB Analytics with PostgreSQL、およびチャートのバージョンを設定します - -以下の3つの環境変数を設定します。別のバージョンの ScalarDB および ScalarDB Analytics with PostgreSQL を使用する場合は、必ず使用するバージョンに設定してください。 - -:::note - -ScalarDB Analytics with PostgreSQL のマイナーバージョン (例: 3.10.x) を ScalarDB と同じにする必要がありますが、パッチのバージョンを一致させる必要はありません。たとえば、ScalarDB 3.10.1と ScalarDB Analytics with PostgreSQL 3.10.3を併用できます。 - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## ステップ5. OLTP トランザクションを実行して、サンプルデータを MySQL および PostgreSQL にロードします - -ScalarDB Analytics with PostgreSQL を導入する前に、OLTPトランザクションを実行してサンプルデータを作成します。 - -1. Kubernetes クラスターで OLTP クライアントポッドを開始します。 - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. OLTP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod oltp-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod oltp-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. OLTP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it oltp-client -- bash - ``` - - この手順の後、OLTP クライアントポッドで各コマンドを実行します。 - -1. git および curl コマンドを OLTP クライアントポッドにインストールします。 - - ```console - apt update && apt install -y curl git - ``` - -1. ScalarDB サンプルリポジトリのクローンを作成します。 - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. ディレクトリ `scalardb-samples/multi-storage-transaction-sample/` に移動します。 - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - 次の出力が表示されるはずです。 - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Kubernetes クラスター内の MySQL および PostgreSQL にアクセスするための構成ファイル (`database.properties`) を作成します。 - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases) から Schema Loader をダウンロードします。 - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Schema Loader を実行してサンプルテーブルを作成します。 - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. サンプルワークロードの初期データをロードします。 - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. OLTP トランザクションのサンプルワークロードを実行します。これらのコマンドを実行すると、サンプルデータとしていくつかの `order` エントリが作成されます。 - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. OLTPクライアントを終了します。 - - ```console - exit - ``` - -## ステップ6. ScalarDB Analytics with PostgreSQL のデプロイ - -バックエンドデータベースにScalarDB経由でサンプルデータを作成した後、ScalarDB Analytics with PostgreSQL をデプロイします。 - -1. ScalarDB Analytics with PostgreSQL のカスタム値ファイル (`scalardb-analytics-postgresql-custom-values.yaml`) を作成します。 - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. PostgreSQL のスーパーユーザーパスワードを設定するためのシークレットリソースを作成します。 - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. ScalarDB Analytics with PostgreSQL を導入します。 - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## ステップ7. OLAP クライアントポッドを実行する - -ScalarDB Analytics with PostgreSQL を介して一部のクエリを実行するには、OLAP クライアントポッドを実行します。 - -1. Kubernetes クラスターで OLAP クライアントポッドを開始します。 - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. OLAP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod olap-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod olap-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## ステップ8. ScalarDB Analytics with PostgreSQL を介してサンプルクエリを実行する - -OLAP クライアントポッドを実行した後、ScalarDB Analytics with PostgreSQL を介していくつかのクエリを実行できます。 - -1. OLAP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it olap-client -- bash - ``` - - この手順の後、OLAP クライアントポッドで各コマンドを実行します。 - -1. psqlコマンドを実行して ScalarDB Analytics with PostgreSQL にアクセスします。 - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - パスワードは `scalardb-analytics` です。 - -1. `customer.customers` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM customer.customers; - ``` - - 次の出力が表示されるはずです。 - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. `order.orders` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".orders; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. `order.statements` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".statements; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. `order.items` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. `JOIN` クエリを実行します。例えば以下のように各ユーザーのクレジット残高情報を確認できます。 - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. psql コマンドを終了します。 - - ```console - \q - ``` - -1. OLAP クライアントポッドを終了します。 - - ```console - exit - ``` - -## ステップ9. すべてのリソースを削除する - -Kubernetes クラスターで ScalarDB Analytics with PostgreSQL テストを完了したら、すべてのリソースを削除します。 - -1. MySQL、PostgreSQL、および ScalarDB Analytics with PostgreSQL をアンインストールします。 - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. クライアントポッドを削除します。 - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. シークレットリソースを削除します。 - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. 作業ディレクトリとサンプルファイルを削除します。 - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index ca4cd7ad..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/current/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL の導入方法 - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、Scalar Helm Chart を使用して ScalarDB Analytics with PostgreSQL をデプロイする方法について説明します。ScalarDB Analytics with PostgreSQL のカスタム値ファイルの詳細については、[ScalarDB Analytics with PostgreSQL のカスタム値ファイルの構成](configure-custom-values-scalardb-analytics-postgresql.mdx)を参照してください。 - -## シークレットリソースを準備する - -`ScalarDB Analytics with PostgreSQL` をデプロイする前に、キー `superuser-password` を使用して、PostgreSQL のスーパーユーザーパスワードを含むシークレットリソース `scalardb-analytics-postgresql-superuser-password` を作成する必要があります。Scalar Helm Chart は、このシークレットリソースをマウントし、`POSTGRES_PASSWORD` 環境変数を `superuser-password` キーの値に設定します。 - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## ScalarDB Analytics with PostgreSQLをデプロイする - -ScalarDB Analytics with PostgreSQL をデプロイするには、次のコマンドを実行します。山かっこ内の内容を説明どおりに置き換えます。 - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL 展開をアップグレードする - -ScalarDB Analytics with PostgreSQL デプロイメントをアップグレードするには、次のコマンドを実行します。山括弧内の内容は説明どおりに置き換えてください。 - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL デプロイメントを削除する - -ScalarDB Analytics with PostgreSQL デプロイメントを削除するには、次のコマンドを実行して、山括弧内の内容を説明どおりに置き換えます。 - -```console -helm uninstall -n -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 0c6b8bf9..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,193 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL のカスタム値ファイルを構成する - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、PostgreSQL チャートを使用した ScalarDB Analytics のカスタム値ファイルを作成する方法について説明します。パラメーターの詳細については、ScalarDB Analytics with PostgreSQL チャートの [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) を参照してください。 - -## 必要な構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定するときに必要な構成について説明します。 - -### データベース構成 - -ScalarDB Analytics with PostgreSQL 経由でデータベースにアクセスするには、`database.properties` ファイルの構成に使用するのと同じ構文に従って、`scalardbAnalyticsPostgreSQL.databaseProperties` パラメータを設定する必要があります。設定の詳細については、[ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### データベース名前空間の構成 - -ScalarDB Analytics with PostgreSQL 経由で読み取りたいテーブルを含むすべてのデータベース名前空間に `schemaImporter.namespaces` を設定する必要があります。 - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## オプションの構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定する場合のオプションの構成について説明します。 - -### リソース構成 (実稼働環境で推奨) - -Kubernetes でリクエストと制限を使用してポッドリソースを制御するには、`scalardbAnalyticsPostgreSQL.resources` を使用できます。 - -Kubernetes のリクエストと制限と同じ構文を使用して、リクエストと制限を構成できます。Kubernetes のリクエストと制限の詳細については、[Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### シークレット構成 (運用環境で推奨) - -環境変数を使用して `scalardbAnalyticsPostgreSQL.databaseProperties` で資格情報などのいくつかのプロパティを設定するには、`scalardbAnalyticsPostgreSQL.secretName` を使用していくつかの資格情報を含むシークレットリソースを指定します。 - -たとえば、環境変数を使用してバックエンドデータベースの資格情報 (`scalar.db.username` および `scalar.db.password`) を設定できるため、ポッドの安全性が高まります。 - -シークレットリソースの使用方法の詳細については、[シークレットリソースを使用して資格情報を環境変数としてプロパティファイルに渡す方法(./use-secret-for-credentials.mdx)を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### アフィニティ構成 (運用環境で推奨) - -Kubernetes でアフィニティとアンチアフィニティを使用してポッドのデプロイメントを制御するには、`scalardbAnalyticsPostgreSQL.affinity` を使用できます。 - -Kubernetes のアフィニティとアンチアフィニティと同じ構文を使用して、アフィニティとアンチアフィニティを構成できます。Kubernetes でのアフィニティの構成の詳細については、[Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext 設定 (デフォルト値を推奨) - -PostgreSQL ポッドを使用して ScalarDB Analytics の SecurityContext と PodSecurityContext を設定するには、`scalardbAnalyticsPostgreSQL.securityContext`、`scalardbAnalyticsPostgreSQL.podSecurityContext`、および `schemaImporter.securityContext` を使用できます。 - -Kubernetes の SecurityContext および PodSecurityContext と同じ構文を使用して、SecurityContext および PodSecurityContext を構成できます。Kubernetes の SecurityContext および PodSecurityContext 構成の詳細については、[Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### 画像構成 (デフォルト値を推奨) - -イメージリポジトリを変更する場合は、`scalardbAnalyticsPostgreSQL.image.repository` と `schemaImporter.image.repository` を使用して、プルする ScalarDB Analytics with PostgreSQL および Schema Importer イメージのコンテナリポジトリ情報を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### レプリカ構成 (環境に応じてオプション) - -`scalardbAnalyticsPostgreSQL.replicaCount` を使用して、PostgreSQL レプリカ (ポッド) を使用した ScalarDB Analytics の数を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL データベース名の構成 (環境に応じてオプション) - -PostgreSQL で作成するデータベース名を指定できます。Schema Importer は、ScalarDB Analytics with PostgreSQL のビューなど、いくつかのオブジェクトをこのデータベースに作成します。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL スーパーユーザーのパスワード設定 (環境に応じてオプション) - -PostgreSQL のスーパーユーザーのパスワードを含むシークレット名を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -ScalarDB Analytics with PostgreSQL をデプロイする前に、この名前 (デフォルトでは `scalardb-analytics-postgresql-superuser-password`) でシークレットリソースを作成する必要があります。詳細については、[シークレットリソースを準備する](how-to-deploy-scalardb-analytics-postgresql.mdx#シークレットリソースを準備する)を参照してください。 - -::: - -### 汚染と許容の構成 (環境に応じてオプション) - -Kubernetes でテイントと許容を使用してポッドのデプロイメントを制御したい場合は、`scalardbAnalyticsPostgreSQL.tolerations` を使用できます。 - -Kubernetes の許容と同じ構文を使用して、テイントと許容を構成できます。Kubernetes での許容設定の詳細については、Kubernetes の公式ドキュメント [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 57f8d795..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,533 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# Helm Charts をはじめよう (ScalarDB Analytics with PostgreSQL) - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このガイドでは、Kubernetes クラスターの Helm Chart をテスト環境として使用して、ScalarDB Analytics with PostgreSQL を開始する方法について説明します。さらに、このガイドの内容は、テスト用に Mac または Linux 環境がすでにセットアップされていることを前提としています。**minikube** について言及していますが、説明されている手順はどの Kubernetes クラスターでも機能するはずです。 - -## あなたが作成するもの - -次のコンポーネントを Kubernetes クラスターにデプロイします。 - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes クラスター] | -| | -| [ポッド] [ポッド] [ポッド] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL (「顧客」スキーマ) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP クライアント | ---> | サービス | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL (「順序」スキーマ) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP クライアント | ---(テスト OLTP ワークロードでサンプルデータをロードする)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## ステップ1. Kubernetes クラスターを開始する - -まず、Kubernetes クラスターを準備する必要があります。**minikube** 環境を使用している場合は、[Scalar Helm Charts をはじめよう](getting-started-scalar-helm-charts.mdx)を参照してください。すでに Kubernetes クラスターを開始している場合は、この手順をスキップできます。 - -## ステップ2. MySQL および PostgreSQL ポッドを開始する - -ScalarDB Analytics with PostgreSQL を含むScalarDBは、バックエンドデータベースとして数種類のデータベースシステムを利用できます。このガイドでは、MySQL と PostgreSQL を使用します。 - -次のようにして、Kubernetes クラスターに MySQL と PostgreSQL をデプロイできます。 - -1. Bitnami Helm リポジトリを追加します。 - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Helm リポジトリを更新します。 - - ```console - helm repo update bitnami - ``` - -1. MySQLをデプロイします。 - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. PostgreSQLをデプロイします。 - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. MySQL および PostgreSQL ポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## ステップ3. 作業ディレクトリを作成する - -いくつかの構成ファイルをローカルに作成するので、それらのファイル用の作業ディレクトリを作成します。 - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## ステップ4. ScalarDB、ScalarDB Analytics with PostgreSQL、およびチャートのバージョンを設定します - -以下の3つの環境変数を設定します。別のバージョンの ScalarDB および ScalarDB Analytics with PostgreSQL を使用する場合は、必ず使用するバージョンに設定してください。 - -:::note - -ScalarDB Analytics with PostgreSQL のマイナーバージョン (例: 3.10.x) を ScalarDB と同じにする必要がありますが、パッチのバージョンを一致させる必要はありません。たとえば、ScalarDB 3.10.1と ScalarDB Analytics with PostgreSQL 3.10.3を併用できます。 - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## ステップ5. OLTP トランザクションを実行して、サンプルデータを MySQL および PostgreSQL にロードします - -ScalarDB Analytics with PostgreSQL を導入する前に、OLTPトランザクションを実行してサンプルデータを作成します。 - -1. Kubernetes クラスターで OLTP クライアントポッドを開始します。 - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. OLTP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod oltp-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod oltp-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. OLTP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it oltp-client -- bash - ``` - - この手順の後、OLTP クライアントポッドで各コマンドを実行します。 - -1. git および curl コマンドを OLTP クライアントポッドにインストールします。 - - ```console - apt update && apt install -y curl git - ``` - -1. ScalarDB サンプルリポジトリのクローンを作成します。 - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. ディレクトリ `scalardb-samples/multi-storage-transaction-sample/` に移動します。 - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - 次の出力が表示されるはずです。 - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Kubernetes クラスター内の MySQL および PostgreSQL にアクセスするための構成ファイル (`database.properties`) を作成します。 - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases) から Schema Loader をダウンロードします。 - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Schema Loader を実行してサンプルテーブルを作成します。 - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. サンプルワークロードの初期データをロードします。 - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. OLTP トランザクションのサンプルワークロードを実行します。これらのコマンドを実行すると、サンプルデータとしていくつかの `order` エントリが作成されます。 - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. OLTPクライアントを終了します。 - - ```console - exit - ``` - -## ステップ6. ScalarDB Analytics with PostgreSQL のデプロイ - -バックエンドデータベースにScalarDB経由でサンプルデータを作成した後、ScalarDB Analytics with PostgreSQL をデプロイします。 - -1. ScalarDB Analytics with PostgreSQL のカスタム値ファイル (`scalardb-analytics-postgresql-custom-values.yaml`) を作成します。 - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. PostgreSQL のスーパーユーザーパスワードを設定するためのシークレットリソースを作成します。 - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. ScalarDB Analytics with PostgreSQL を導入します。 - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## ステップ7. OLAP クライアントポッドを実行する - -ScalarDB Analytics with PostgreSQL を介して一部のクエリを実行するには、OLAP クライアントポッドを実行します。 - -1. Kubernetes クラスターで OLAP クライアントポッドを開始します。 - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. OLAP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod olap-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod olap-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## ステップ8. ScalarDB Analytics with PostgreSQL を介してサンプルクエリを実行する - -OLAP クライアントポッドを実行した後、ScalarDB Analytics with PostgreSQL を介していくつかのクエリを実行できます。 - -1. OLAP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it olap-client -- bash - ``` - - この手順の後、OLAP クライアントポッドで各コマンドを実行します。 - -1. psqlコマンドを実行して ScalarDB Analytics with PostgreSQL にアクセスします。 - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - パスワードは `scalardb-analytics` です。 - -1. `customer.customers` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM customer.customers; - ``` - - 次の出力が表示されるはずです。 - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. `order.orders` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".orders; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. `order.statements` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".statements; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. `order.items` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. `JOIN` クエリを実行します。例えば以下のように各ユーザーのクレジット残高情報を確認できます。 - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. psql コマンドを終了します。 - - ```console - \q - ``` - -1. OLAP クライアントポッドを終了します。 - - ```console - exit - ``` - -## ステップ9. すべてのリソースを削除する - -Kubernetes クラスターで ScalarDB Analytics with PostgreSQL テストを完了したら、すべてのリソースを削除します。 - -1. MySQL、PostgreSQL、および ScalarDB Analytics with PostgreSQL をアンインストールします。 - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. クライアントポッドを削除します。 - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. シークレットリソースを削除します。 - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. 作業ディレクトリとサンプルファイルを削除します。 - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index ca4cd7ad..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL の導入方法 - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、Scalar Helm Chart を使用して ScalarDB Analytics with PostgreSQL をデプロイする方法について説明します。ScalarDB Analytics with PostgreSQL のカスタム値ファイルの詳細については、[ScalarDB Analytics with PostgreSQL のカスタム値ファイルの構成](configure-custom-values-scalardb-analytics-postgresql.mdx)を参照してください。 - -## シークレットリソースを準備する - -`ScalarDB Analytics with PostgreSQL` をデプロイする前に、キー `superuser-password` を使用して、PostgreSQL のスーパーユーザーパスワードを含むシークレットリソース `scalardb-analytics-postgresql-superuser-password` を作成する必要があります。Scalar Helm Chart は、このシークレットリソースをマウントし、`POSTGRES_PASSWORD` 環境変数を `superuser-password` キーの値に設定します。 - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## ScalarDB Analytics with PostgreSQLをデプロイする - -ScalarDB Analytics with PostgreSQL をデプロイするには、次のコマンドを実行します。山かっこ内の内容を説明どおりに置き換えます。 - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL 展開をアップグレードする - -ScalarDB Analytics with PostgreSQL デプロイメントをアップグレードするには、次のコマンドを実行します。山括弧内の内容は説明どおりに置き換えてください。 - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL デプロイメントを削除する - -ScalarDB Analytics with PostgreSQL デプロイメントを削除するには、次のコマンドを実行して、山括弧内の内容を説明どおりに置き換えます。 - -```console -helm uninstall -n -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 0c6b8bf9..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,193 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL のカスタム値ファイルを構成する - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、PostgreSQL チャートを使用した ScalarDB Analytics のカスタム値ファイルを作成する方法について説明します。パラメーターの詳細については、ScalarDB Analytics with PostgreSQL チャートの [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) を参照してください。 - -## 必要な構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定するときに必要な構成について説明します。 - -### データベース構成 - -ScalarDB Analytics with PostgreSQL 経由でデータベースにアクセスするには、`database.properties` ファイルの構成に使用するのと同じ構文に従って、`scalardbAnalyticsPostgreSQL.databaseProperties` パラメータを設定する必要があります。設定の詳細については、[ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### データベース名前空間の構成 - -ScalarDB Analytics with PostgreSQL 経由で読み取りたいテーブルを含むすべてのデータベース名前空間に `schemaImporter.namespaces` を設定する必要があります。 - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## オプションの構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定する場合のオプションの構成について説明します。 - -### リソース構成 (実稼働環境で推奨) - -Kubernetes でリクエストと制限を使用してポッドリソースを制御するには、`scalardbAnalyticsPostgreSQL.resources` を使用できます。 - -Kubernetes のリクエストと制限と同じ構文を使用して、リクエストと制限を構成できます。Kubernetes のリクエストと制限の詳細については、[Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### シークレット構成 (運用環境で推奨) - -環境変数を使用して `scalardbAnalyticsPostgreSQL.databaseProperties` で資格情報などのいくつかのプロパティを設定するには、`scalardbAnalyticsPostgreSQL.secretName` を使用していくつかの資格情報を含むシークレットリソースを指定します。 - -たとえば、環境変数を使用してバックエンドデータベースの資格情報 (`scalar.db.username` および `scalar.db.password`) を設定できるため、ポッドの安全性が高まります。 - -シークレットリソースの使用方法の詳細については、[シークレットリソースを使用して資格情報を環境変数としてプロパティファイルに渡す方法(./use-secret-for-credentials.mdx)を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### アフィニティ構成 (運用環境で推奨) - -Kubernetes でアフィニティとアンチアフィニティを使用してポッドのデプロイメントを制御するには、`scalardbAnalyticsPostgreSQL.affinity` を使用できます。 - -Kubernetes のアフィニティとアンチアフィニティと同じ構文を使用して、アフィニティとアンチアフィニティを構成できます。Kubernetes でのアフィニティの構成の詳細については、[Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext 設定 (デフォルト値を推奨) - -PostgreSQL ポッドを使用して ScalarDB Analytics の SecurityContext と PodSecurityContext を設定するには、`scalardbAnalyticsPostgreSQL.securityContext`、`scalardbAnalyticsPostgreSQL.podSecurityContext`、および `schemaImporter.securityContext` を使用できます。 - -Kubernetes の SecurityContext および PodSecurityContext と同じ構文を使用して、SecurityContext および PodSecurityContext を構成できます。Kubernetes の SecurityContext および PodSecurityContext 構成の詳細については、[Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### 画像構成 (デフォルト値を推奨) - -イメージリポジトリを変更する場合は、`scalardbAnalyticsPostgreSQL.image.repository` と `schemaImporter.image.repository` を使用して、プルする ScalarDB Analytics with PostgreSQL および Schema Importer イメージのコンテナリポジトリ情報を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### レプリカ構成 (環境に応じてオプション) - -`scalardbAnalyticsPostgreSQL.replicaCount` を使用して、PostgreSQL レプリカ (ポッド) を使用した ScalarDB Analytics の数を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL データベース名の構成 (環境に応じてオプション) - -PostgreSQL で作成するデータベース名を指定できます。Schema Importer は、ScalarDB Analytics with PostgreSQL のビューなど、いくつかのオブジェクトをこのデータベースに作成します。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL スーパーユーザーのパスワード設定 (環境に応じてオプション) - -PostgreSQL のスーパーユーザーのパスワードを含むシークレット名を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -ScalarDB Analytics with PostgreSQL をデプロイする前に、この名前 (デフォルトでは `scalardb-analytics-postgresql-superuser-password`) でシークレットリソースを作成する必要があります。詳細については、[シークレットリソースを準備する](how-to-deploy-scalardb-analytics-postgresql.mdx#シークレットリソースを準備する)を参照してください。 - -::: - -### 汚染と許容の構成 (環境に応じてオプション) - -Kubernetes でテイントと許容を使用してポッドのデプロイメントを制御したい場合は、`scalardbAnalyticsPostgreSQL.tolerations` を使用できます。 - -Kubernetes の許容と同じ構文を使用して、テイントと許容を構成できます。Kubernetes での許容設定の詳細については、Kubernetes の公式ドキュメント [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 57f8d795..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,533 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# Helm Charts をはじめよう (ScalarDB Analytics with PostgreSQL) - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このガイドでは、Kubernetes クラスターの Helm Chart をテスト環境として使用して、ScalarDB Analytics with PostgreSQL を開始する方法について説明します。さらに、このガイドの内容は、テスト用に Mac または Linux 環境がすでにセットアップされていることを前提としています。**minikube** について言及していますが、説明されている手順はどの Kubernetes クラスターでも機能するはずです。 - -## あなたが作成するもの - -次のコンポーネントを Kubernetes クラスターにデプロイします。 - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes クラスター] | -| | -| [ポッド] [ポッド] [ポッド] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL (「顧客」スキーマ) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP クライアント | ---> | サービス | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL (「順序」スキーマ) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP クライアント | ---(テスト OLTP ワークロードでサンプルデータをロードする)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## ステップ1. Kubernetes クラスターを開始する - -まず、Kubernetes クラスターを準備する必要があります。**minikube** 環境を使用している場合は、[Scalar Helm Charts をはじめよう](getting-started-scalar-helm-charts.mdx)を参照してください。すでに Kubernetes クラスターを開始している場合は、この手順をスキップできます。 - -## ステップ2. MySQL および PostgreSQL ポッドを開始する - -ScalarDB Analytics with PostgreSQL を含むScalarDBは、バックエンドデータベースとして数種類のデータベースシステムを利用できます。このガイドでは、MySQL と PostgreSQL を使用します。 - -次のようにして、Kubernetes クラスターに MySQL と PostgreSQL をデプロイできます。 - -1. Bitnami Helm リポジトリを追加します。 - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Helm リポジトリを更新します。 - - ```console - helm repo update bitnami - ``` - -1. MySQLをデプロイします。 - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. PostgreSQLをデプロイします。 - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. MySQL および PostgreSQL ポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## ステップ3. 作業ディレクトリを作成する - -いくつかの構成ファイルをローカルに作成するので、それらのファイル用の作業ディレクトリを作成します。 - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## ステップ4. ScalarDB、ScalarDB Analytics with PostgreSQL、およびチャートのバージョンを設定します - -以下の3つの環境変数を設定します。別のバージョンの ScalarDB および ScalarDB Analytics with PostgreSQL を使用する場合は、必ず使用するバージョンに設定してください。 - -:::note - -ScalarDB Analytics with PostgreSQL のマイナーバージョン (例: 3.10.x) を ScalarDB と同じにする必要がありますが、パッチのバージョンを一致させる必要はありません。たとえば、ScalarDB 3.10.1と ScalarDB Analytics with PostgreSQL 3.10.3を併用できます。 - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## ステップ5. OLTP トランザクションを実行して、サンプルデータを MySQL および PostgreSQL にロードします - -ScalarDB Analytics with PostgreSQL を導入する前に、OLTPトランザクションを実行してサンプルデータを作成します。 - -1. Kubernetes クラスターで OLTP クライアントポッドを開始します。 - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. OLTP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod oltp-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod oltp-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. OLTP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it oltp-client -- bash - ``` - - この手順の後、OLTP クライアントポッドで各コマンドを実行します。 - -1. git および curl コマンドを OLTP クライアントポッドにインストールします。 - - ```console - apt update && apt install -y curl git - ``` - -1. ScalarDB サンプルリポジトリのクローンを作成します。 - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. ディレクトリ `scalardb-samples/multi-storage-transaction-sample/` に移動します。 - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - 次の出力が表示されるはずです。 - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Kubernetes クラスター内の MySQL および PostgreSQL にアクセスするための構成ファイル (`database.properties`) を作成します。 - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases) から Schema Loader をダウンロードします。 - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Schema Loader を実行してサンプルテーブルを作成します。 - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. サンプルワークロードの初期データをロードします。 - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. OLTP トランザクションのサンプルワークロードを実行します。これらのコマンドを実行すると、サンプルデータとしていくつかの `order` エントリが作成されます。 - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. OLTPクライアントを終了します。 - - ```console - exit - ``` - -## ステップ6. ScalarDB Analytics with PostgreSQL のデプロイ - -バックエンドデータベースにScalarDB経由でサンプルデータを作成した後、ScalarDB Analytics with PostgreSQL をデプロイします。 - -1. ScalarDB Analytics with PostgreSQL のカスタム値ファイル (`scalardb-analytics-postgresql-custom-values.yaml`) を作成します。 - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. PostgreSQL のスーパーユーザーパスワードを設定するためのシークレットリソースを作成します。 - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. ScalarDB Analytics with PostgreSQL を導入します。 - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## ステップ7. OLAP クライアントポッドを実行する - -ScalarDB Analytics with PostgreSQL を介して一部のクエリを実行するには、OLAP クライアントポッドを実行します。 - -1. Kubernetes クラスターで OLAP クライアントポッドを開始します。 - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. OLAP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod olap-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod olap-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## ステップ8. ScalarDB Analytics with PostgreSQL を介してサンプルクエリを実行する - -OLAP クライアントポッドを実行した後、ScalarDB Analytics with PostgreSQL を介していくつかのクエリを実行できます。 - -1. OLAP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it olap-client -- bash - ``` - - この手順の後、OLAP クライアントポッドで各コマンドを実行します。 - -1. psqlコマンドを実行して ScalarDB Analytics with PostgreSQL にアクセスします。 - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - パスワードは `scalardb-analytics` です。 - -1. `customer.customers` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM customer.customers; - ``` - - 次の出力が表示されるはずです。 - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. `order.orders` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".orders; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. `order.statements` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".statements; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. `order.items` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. `JOIN` クエリを実行します。例えば以下のように各ユーザーのクレジット残高情報を確認できます。 - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. psql コマンドを終了します。 - - ```console - \q - ``` - -1. OLAP クライアントポッドを終了します。 - - ```console - exit - ``` - -## ステップ9. すべてのリソースを削除する - -Kubernetes クラスターで ScalarDB Analytics with PostgreSQL テストを完了したら、すべてのリソースを削除します。 - -1. MySQL、PostgreSQL、および ScalarDB Analytics with PostgreSQL をアンインストールします。 - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. クライアントポッドを削除します。 - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. シークレットリソースを削除します。 - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. 作業ディレクトリとサンプルファイルを削除します。 - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index ca4cd7ad..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL の導入方法 - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、Scalar Helm Chart を使用して ScalarDB Analytics with PostgreSQL をデプロイする方法について説明します。ScalarDB Analytics with PostgreSQL のカスタム値ファイルの詳細については、[ScalarDB Analytics with PostgreSQL のカスタム値ファイルの構成](configure-custom-values-scalardb-analytics-postgresql.mdx)を参照してください。 - -## シークレットリソースを準備する - -`ScalarDB Analytics with PostgreSQL` をデプロイする前に、キー `superuser-password` を使用して、PostgreSQL のスーパーユーザーパスワードを含むシークレットリソース `scalardb-analytics-postgresql-superuser-password` を作成する必要があります。Scalar Helm Chart は、このシークレットリソースをマウントし、`POSTGRES_PASSWORD` 環境変数を `superuser-password` キーの値に設定します。 - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## ScalarDB Analytics with PostgreSQLをデプロイする - -ScalarDB Analytics with PostgreSQL をデプロイするには、次のコマンドを実行します。山かっこ内の内容を説明どおりに置き換えます。 - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL 展開をアップグレードする - -ScalarDB Analytics with PostgreSQL デプロイメントをアップグレードするには、次のコマンドを実行します。山括弧内の内容は説明どおりに置き換えてください。 - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL デプロイメントを削除する - -ScalarDB Analytics with PostgreSQL デプロイメントを削除するには、次のコマンドを実行して、山括弧内の内容を説明どおりに置き換えます。 - -```console -helm uninstall -n -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 0c6b8bf9..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,193 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL のカスタム値ファイルを構成する - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、PostgreSQL チャートを使用した ScalarDB Analytics のカスタム値ファイルを作成する方法について説明します。パラメーターの詳細については、ScalarDB Analytics with PostgreSQL チャートの [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) を参照してください。 - -## 必要な構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定するときに必要な構成について説明します。 - -### データベース構成 - -ScalarDB Analytics with PostgreSQL 経由でデータベースにアクセスするには、`database.properties` ファイルの構成に使用するのと同じ構文に従って、`scalardbAnalyticsPostgreSQL.databaseProperties` パラメータを設定する必要があります。設定の詳細については、[ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### データベース名前空間の構成 - -ScalarDB Analytics with PostgreSQL 経由で読み取りたいテーブルを含むすべてのデータベース名前空間に `schemaImporter.namespaces` を設定する必要があります。 - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## オプションの構成 - -このセクションでは、ScalarDB Analytics with PostgreSQL のカスタム値ファイルを設定する場合のオプションの構成について説明します。 - -### リソース構成 (実稼働環境で推奨) - -Kubernetes でリクエストと制限を使用してポッドリソースを制御するには、`scalardbAnalyticsPostgreSQL.resources` を使用できます。 - -Kubernetes のリクエストと制限と同じ構文を使用して、リクエストと制限を構成できます。Kubernetes のリクエストと制限の詳細については、[Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### シークレット構成 (運用環境で推奨) - -環境変数を使用して `scalardbAnalyticsPostgreSQL.databaseProperties` で資格情報などのいくつかのプロパティを設定するには、`scalardbAnalyticsPostgreSQL.secretName` を使用していくつかの資格情報を含むシークレットリソースを指定します。 - -たとえば、環境変数を使用してバックエンドデータベースの資格情報 (`scalar.db.username` および `scalar.db.password`) を設定できるため、ポッドの安全性が高まります。 - -シークレットリソースの使用方法の詳細については、[シークレットリソースを使用して資格情報を環境変数としてプロパティファイルに渡す方法(./use-secret-for-credentials.mdx)を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### アフィニティ構成 (運用環境で推奨) - -Kubernetes でアフィニティとアンチアフィニティを使用してポッドのデプロイメントを制御するには、`scalardbAnalyticsPostgreSQL.affinity` を使用できます。 - -Kubernetes のアフィニティとアンチアフィニティと同じ構文を使用して、アフィニティとアンチアフィニティを構成できます。Kubernetes でのアフィニティの構成の詳細については、[Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext 設定 (デフォルト値を推奨) - -PostgreSQL ポッドを使用して ScalarDB Analytics の SecurityContext と PodSecurityContext を設定するには、`scalardbAnalyticsPostgreSQL.securityContext`、`scalardbAnalyticsPostgreSQL.podSecurityContext`、および `schemaImporter.securityContext` を使用できます。 - -Kubernetes の SecurityContext および PodSecurityContext と同じ構文を使用して、SecurityContext および PodSecurityContext を構成できます。Kubernetes の SecurityContext および PodSecurityContext 構成の詳細については、[Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### 画像構成 (デフォルト値を推奨) - -イメージリポジトリを変更する場合は、`scalardbAnalyticsPostgreSQL.image.repository` と `schemaImporter.image.repository` を使用して、プルする ScalarDB Analytics with PostgreSQL および Schema Importer イメージのコンテナリポジトリ情報を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### レプリカ構成 (環境に応じてオプション) - -`scalardbAnalyticsPostgreSQL.replicaCount` を使用して、PostgreSQL レプリカ (ポッド) を使用した ScalarDB Analytics の数を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL データベース名の構成 (環境に応じてオプション) - -PostgreSQL で作成するデータベース名を指定できます。Schema Importer は、ScalarDB Analytics with PostgreSQL のビューなど、いくつかのオブジェクトをこのデータベースに作成します。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL スーパーユーザーのパスワード設定 (環境に応じてオプション) - -PostgreSQL のスーパーユーザーのパスワードを含むシークレット名を指定できます。 - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -ScalarDB Analytics with PostgreSQL をデプロイする前に、この名前 (デフォルトでは `scalardb-analytics-postgresql-superuser-password`) でシークレットリソースを作成する必要があります。詳細については、[シークレットリソースを準備する](how-to-deploy-scalardb-analytics-postgresql.mdx#シークレットリソースを準備する)を参照してください。 - -::: - -### 汚染と許容の構成 (環境に応じてオプション) - -Kubernetes でテイントと許容を使用してポッドのデプロイメントを制御したい場合は、`scalardbAnalyticsPostgreSQL.tolerations` を使用できます。 - -Kubernetes の許容と同じ構文を使用して、テイントと許容を構成できます。Kubernetes での許容設定の詳細については、Kubernetes の公式ドキュメント [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) を参照してください。 - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 57f8d795..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,533 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# Helm Charts をはじめよう (ScalarDB Analytics with PostgreSQL) - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このガイドでは、Kubernetes クラスターの Helm Chart をテスト環境として使用して、ScalarDB Analytics with PostgreSQL を開始する方法について説明します。さらに、このガイドの内容は、テスト用に Mac または Linux 環境がすでにセットアップされていることを前提としています。**minikube** について言及していますが、説明されている手順はどの Kubernetes クラスターでも機能するはずです。 - -## あなたが作成するもの - -次のコンポーネントを Kubernetes クラスターにデプロイします。 - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes クラスター] | -| | -| [ポッド] [ポッド] [ポッド] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL (「顧客」スキーマ) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP クライアント | ---> | サービス | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL (「順序」スキーマ) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP クライアント | ---(テスト OLTP ワークロードでサンプルデータをロードする)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## ステップ1. Kubernetes クラスターを開始する - -まず、Kubernetes クラスターを準備する必要があります。**minikube** 環境を使用している場合は、[Scalar Helm Charts をはじめよう](getting-started-scalar-helm-charts.mdx)を参照してください。すでに Kubernetes クラスターを開始している場合は、この手順をスキップできます。 - -## ステップ2. MySQL および PostgreSQL ポッドを開始する - -ScalarDB Analytics with PostgreSQL を含むScalarDBは、バックエンドデータベースとして数種類のデータベースシステムを利用できます。このガイドでは、MySQL と PostgreSQL を使用します。 - -次のようにして、Kubernetes クラスターに MySQL と PostgreSQL をデプロイできます。 - -1. Bitnami Helm リポジトリを追加します。 - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Helm リポジトリを更新します。 - - ```console - helm repo update bitnami - ``` - -1. MySQLをデプロイします。 - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. PostgreSQLをデプロイします。 - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. MySQL および PostgreSQL ポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## ステップ3. 作業ディレクトリを作成する - -いくつかの構成ファイルをローカルに作成するので、それらのファイル用の作業ディレクトリを作成します。 - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## ステップ4. ScalarDB、ScalarDB Analytics with PostgreSQL、およびチャートのバージョンを設定します - -以下の3つの環境変数を設定します。別のバージョンの ScalarDB および ScalarDB Analytics with PostgreSQL を使用する場合は、必ず使用するバージョンに設定してください。 - -:::note - -ScalarDB Analytics with PostgreSQL のマイナーバージョン (例: 3.10.x) を ScalarDB と同じにする必要がありますが、パッチのバージョンを一致させる必要はありません。たとえば、ScalarDB 3.10.1と ScalarDB Analytics with PostgreSQL 3.10.3を併用できます。 - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## ステップ5. OLTP トランザクションを実行して、サンプルデータを MySQL および PostgreSQL にロードします - -ScalarDB Analytics with PostgreSQL を導入する前に、OLTPトランザクションを実行してサンプルデータを作成します。 - -1. Kubernetes クラスターで OLTP クライアントポッドを開始します。 - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. OLTP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod oltp-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod oltp-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. OLTP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it oltp-client -- bash - ``` - - この手順の後、OLTP クライアントポッドで各コマンドを実行します。 - -1. git および curl コマンドを OLTP クライアントポッドにインストールします。 - - ```console - apt update && apt install -y curl git - ``` - -1. ScalarDB サンプルリポジトリのクローンを作成します。 - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. ディレクトリ `scalardb-samples/multi-storage-transaction-sample/` に移動します。 - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - 次の出力が表示されるはずです。 - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Kubernetes クラスター内の MySQL および PostgreSQL にアクセスするための構成ファイル (`database.properties`) を作成します。 - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases) から Schema Loader をダウンロードします。 - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Schema Loader を実行してサンプルテーブルを作成します。 - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. サンプルワークロードの初期データをロードします。 - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. OLTP トランザクションのサンプルワークロードを実行します。これらのコマンドを実行すると、サンプルデータとしていくつかの `order` エントリが作成されます。 - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. OLTPクライアントを終了します。 - - ```console - exit - ``` - -## ステップ6. ScalarDB Analytics with PostgreSQL のデプロイ - -バックエンドデータベースにScalarDB経由でサンプルデータを作成した後、ScalarDB Analytics with PostgreSQL をデプロイします。 - -1. ScalarDB Analytics with PostgreSQL のカスタム値ファイル (`scalardb-analytics-postgresql-custom-values.yaml`) を作成します。 - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. PostgreSQL のスーパーユーザーパスワードを設定するためのシークレットリソースを作成します。 - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. ScalarDB Analytics with PostgreSQL を導入します。 - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## ステップ7. OLAP クライアントポッドを実行する - -ScalarDB Analytics with PostgreSQL を介して一部のクエリを実行するには、OLAP クライアントポッドを実行します。 - -1. Kubernetes クラスターで OLAP クライアントポッドを開始します。 - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. OLAP クライアントポッドが実行されているかどうかを確認します。 - - ```console - kubectl get pod olap-client - ``` - - 次の出力が表示されるはずです。 - - ```console - kubectl get pod olap-client - ``` - - 次のような結果が表示されます: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## ステップ8. ScalarDB Analytics with PostgreSQL を介してサンプルクエリを実行する - -OLAP クライアントポッドを実行した後、ScalarDB Analytics with PostgreSQL を介していくつかのクエリを実行できます。 - -1. OLAP クライアントポッドで bash を実行します。 - - ```console - kubectl exec -it olap-client -- bash - ``` - - この手順の後、OLAP クライアントポッドで各コマンドを実行します。 - -1. psqlコマンドを実行して ScalarDB Analytics with PostgreSQL にアクセスします。 - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - パスワードは `scalardb-analytics` です。 - -1. `customer.customers` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM customer.customers; - ``` - - 次の出力が表示されるはずです。 - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. `order.orders` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".orders; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. `order.statements` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".statements; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. `order.items` テーブルのサンプルデータを読み取ります。 - - ```sql - SELECT * FROM "order".items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. `JOIN` クエリを実行します。例えば以下のように各ユーザーのクレジット残高情報を確認できます。 - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - 次の出力が表示されるはずです。 - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. psql コマンドを終了します。 - - ```console - \q - ``` - -1. OLAP クライアントポッドを終了します。 - - ```console - exit - ``` - -## ステップ9. すべてのリソースを削除する - -Kubernetes クラスターで ScalarDB Analytics with PostgreSQL テストを完了したら、すべてのリソースを削除します。 - -1. MySQL、PostgreSQL、および ScalarDB Analytics with PostgreSQL をアンインストールします。 - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. クライアントポッドを削除します。 - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. シークレットリソースを削除します。 - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. 作業ディレクトリとサンプルファイルを削除します。 - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index ca4cd7ad..00000000 --- a/i18n/versioned_docs/ja-jp/docusaurus-plugin-content-docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsJapanese ---- - -# ScalarDB Analytics with PostgreSQL の導入方法 - -import TranslationBanner from '/src/components/_translation-ja-jp.mdx'; - - - -このドキュメントでは、Scalar Helm Chart を使用して ScalarDB Analytics with PostgreSQL をデプロイする方法について説明します。ScalarDB Analytics with PostgreSQL のカスタム値ファイルの詳細については、[ScalarDB Analytics with PostgreSQL のカスタム値ファイルの構成](configure-custom-values-scalardb-analytics-postgresql.mdx)を参照してください。 - -## シークレットリソースを準備する - -`ScalarDB Analytics with PostgreSQL` をデプロイする前に、キー `superuser-password` を使用して、PostgreSQL のスーパーユーザーパスワードを含むシークレットリソース `scalardb-analytics-postgresql-superuser-password` を作成する必要があります。Scalar Helm Chart は、このシークレットリソースをマウントし、`POSTGRES_PASSWORD` 環境変数を `superuser-password` キーの値に設定します。 - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## ScalarDB Analytics with PostgreSQLをデプロイする - -ScalarDB Analytics with PostgreSQL をデプロイするには、次のコマンドを実行します。山かっこ内の内容を説明どおりに置き換えます。 - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL 展開をアップグレードする - -ScalarDB Analytics with PostgreSQL デプロイメントをアップグレードするには、次のコマンドを実行します。山括弧内の内容は説明どおりに置き換えてください。 - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## ScalarDB Analytics with PostgreSQL デプロイメントを削除する - -ScalarDB Analytics with PostgreSQL デプロイメントを削除するには、次のコマンドを実行して、山括弧内の内容を説明どおりに置き換えます。 - -```console -helm uninstall -n -``` diff --git a/versioned_docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 5d1eb638..00000000 --- a/versioned_docs/version-3.10/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,189 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Configure a custom values file for ScalarDB Analytics with PostgreSQL - -This document explains how to create your custom values file for the ScalarDB Analytics with PostgreSQL chart. For details on the parameters, see the [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) of the ScalarDB Analytics with PostgreSQL chart. - -## Required configurations - -This section explains the required configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Database configurations - -To access databases via ScalarDB Analytics with PostgreSQL, you must set the `scalardbAnalyticsPostgreSQL.databaseProperties` parameter by following the same syntax that you use to configure the `database.properties` file. For details about configurations, see [ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/). - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### Database namespaces configurations - -You must set `schemaImporter.namespaces` to all the database namespaces that include tables you want to read via ScalarDB Analytics with PostgreSQL. - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## Optional configurations - -This section explains the optional configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Resource configurations (recommended in production environments) - -To control pod resources by using requests and limits in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.resources`. - -You can configure requests and limits by using the same syntax as requests and limits in Kubernetes. For more details on requests and limits in Kubernetes, see [Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### Secret configurations (recommended in production environments) - -To use environment variables to set some properties, like credentials, in `scalardbAnalyticsPostgreSQL.databaseProperties`, you can use `scalardbAnalyticsPostgreSQL.secretName` to specify the secret resource that includes some credentials. - -For example, you can set credentials for a backend database (`scalar.db.username` and `scalar.db.password`) by using environment variables, which makes your pods more secure. - -For more details on how to use a secret resource, see [How to use Secret resources to pass the credentials as the environment variables into the properties file](use-secret-for-credentials.mdx). - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### Affinity configurations (recommended in production environments) - -To control pod deployment by using affinity and anti-affinity in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.affinity`. - -You can configure affinity and anti-affinity by using the same syntax for affinity and anti-affinity in Kubernetes. For more details on configuring affinity in Kubernetes, see [Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/). - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext configurations (default value is recommended) - -To set SecurityContext and PodSecurityContext for ScalarDB Analytics with PostgreSQL pods, you can use `scalardbAnalyticsPostgreSQL.securityContext`, `scalardbAnalyticsPostgreSQL.podSecurityContext`, and `schemaImporter.securityContext`. - -You can configure SecurityContext and PodSecurityContext by using the same syntax as SecurityContext and PodSecurityContext in Kubernetes. For more details on the SecurityContext and PodSecurityContext configurations in Kubernetes, see [Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### Image configurations (default value is recommended) - -If you want to change the image repository, you can use `scalardbAnalyticsPostgreSQL.image.repository` and `schemaImporter.image.repository` to specify the container repository information of the ScalarDB Analytics with PostgreSQL and Schema Importer images that you want to pull. - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### Replica configurations (optional based on your environment) - -You can specify the number of ScalarDB Analytics with PostgreSQL replicas (pods) by using `scalardbAnalyticsPostgreSQL.replicaCount`. - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL database name configuration (optional based on your environment) - -You can specify the database name that you create in PostgreSQL. Schema Importer creates some objects, such as a view of ScalarDB Analytics with PostgreSQL, in this database. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL superuser password configuration (optional based on your environment) - -You can specify the secret name that includes the superuser password for PostgreSQL. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -You must create a secret resource with this name (`scalardb-analytics-postgresql-superuser-password` by default) before you deploy ScalarDB Analytics with PostgreSQL. For details, see [Prepare a secret resource](how-to-deploy-scalardb-analytics-postgresql.mdx#prepare-a-secret-resource). - -::: - -### Taint and toleration configurations (optional based on your environment) - -If you want to control pod deployment by using taints and tolerations in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.tolerations`. - -You can configure taints and tolerations by using the same syntax as the tolerations in Kubernetes. For details on configuring tolerations in Kubernetes, see the official Kubernetes documentation [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/). - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/versioned_docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 1807de98..00000000 --- a/versioned_docs/version-3.10/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,511 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Getting Started with Helm Charts (ScalarDB Analytics with PostgreSQL) - -This guide explains how to get started with ScalarDB Analytics with PostgreSQL by using a Helm Chart in a Kubernetes cluster as a test environment. In addition, the contents of this guide assume that you already have a Mac or Linux environment set up for testing. Although **minikube** is mentioned, the steps described should work in any Kubernetes cluster. - -## What you will create - -You will deploy the following components in a Kubernetes cluster: - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes cluster] | -| | -| [Pod] [Pod] [Pod] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL ("customer" schema) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP client | ---> | Service | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL ("order" schema) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP client | ---(Load sample data with a test OLTP workload)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## Step 1. Start a Kubernetes cluster - -First, you need to prepare a Kubernetes cluster. If you're using a **minikube** environment, please refer to the [Getting Started with Scalar Helm Charts](getting-started-scalar-helm-charts.mdx). If you have already started a Kubernetes cluster, you can skip this step. - -## Step 2. Start MySQL and PostgreSQL pods - -ScalarDB including ScalarDB Analytics with PostgreSQL can use several types of database systems as a backend database. In this guide, you will use MySQL and PostgreSQL. - -You can deploy MySQL and PostgreSQL on the Kubernetes cluster as follows: - -1. Add the Bitnami helm repository. - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Update the helm repository. - - ```console - helm repo update bitnami - ``` - -1. Deploy MySQL. - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. Deploy PostgreSQL. - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. Check if the MySQL and PostgreSQL pods are running. - - ```console - kubectl get pod - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## Step 3. Create a working directory - -Since you'll be creating some configuration files locally, create a working directory for those files. - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## Step 4. Set the versions of ScalarDB, ScalarDB Analytics with PostgreSQL, and the chart - -Set the following three environment variables. If you want to use another version of ScalarDB and ScalarDB Analytics with PostgreSQL, be sure to set them to the versions that you want to use. - -:::note - -You must use the same minor versions (for example, 3.10.x) of ScalarDB Analytics with PostgreSQL as ScalarDB, but you don't need to make the patch versions match. For example, you can use ScalarDB 3.10.1 and ScalarDB Analytics with PostgreSQL 3.10.3 together. - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## Step 5. Run OLTP transactions to load sample data to MySQL and PostgreSQL - -Before deploying ScalarDB Analytics with PostgreSQL, run the OLTP transactions to create sample data. - -1. Start an OLTP client pod in the Kubernetes cluster. - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. Check if the OLTP client pod is running. - - ```console - kubectl get pod oltp-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. Run bash in the OLTP client pod. - - ```console - kubectl exec -it oltp-client -- bash - ``` - - After this step, run each command in the OLTP client pod. - -1. Install the git and curl commands in the OLTP client pod. - - ```console - apt update && apt install -y curl git - ``` - -1. Clone the ScalarDB samples repository. - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. Go to the directory `scalardb-samples/multi-storage-transaction-sample/`. - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - You should see the following output: - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Create a configuration file (`database.properties`) to access MySQL and PostgreSQL in the Kubernetes cluster. - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. Download Schema Loader from [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases). - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Run Schema Loader to create sample tables. - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. Load initial data for the sample workload. - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. Run the sample workload of OLTP transactions. Running these commands will create several `order` entries as sample data. - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. Exit from OLTP client. - - ```console - exit - ``` - -## Step 6. Deploy ScalarDB Analytics with PostgreSQL - -After creating sample data via ScalarDB in the backend databases, deploy ScalarDB Analytics with PostgreSQL. - -1. Create a custom values file for ScalarDB Analytics with PostgreSQL (`scalardb-analytics-postgresql-custom-values.yaml`). - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. Create a secret resource to set a superuser password for PostgreSQL. - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. Deploy ScalarDB Analytics with PostgreSQL. - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## Step 7. Run an OLAP client pod - -To run some queries via ScalarDB Analytics with PostgreSQL, run an OLAP client pod. - -1. Start an OLAP client pod in the Kubernetes cluster. - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. Check if the OLAP client pod is running. - - ```console - kubectl get pod olap-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## Step 8. Run sample queries via ScalarDB Analytics with PostgreSQL - -After running the OLAP client pod, you can run some queries via ScalarDB Analytics with PostgreSQL. - -1. Run bash in the OLAP client pod. - - ```console - kubectl exec -it olap-client -- bash - ``` - - After this step, run each command in the OLAP client pod. - -1. Run the psql command to access ScalarDB Analytics with PostgreSQL. - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - The password is `scalardb-analytics`. - -1. Read sample data in the `customer.customers` table. - - ```sql - SELECT * FROM customer.customers; - ``` - - You should see the following output: - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. Read sample data in the `order.orders` table. - - ```sql - SELECT * FROM "order".orders; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. Read sample data in the `order.statements` table. - - ```sql - SELECT * FROM "order".statements; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. Read sample data in the `order.items` table. - - ```sql - SELECT * FROM "order".items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. Run the `JOIN` query. For example, you can see the credit remaining information of each user as follows. - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. Exit from the psql command. - - ```console - \q - ``` - -1. Exit from the OLAP client pod. - - ```console - exit - ``` - -## Step 9. Delete all resources - -After completing the ScalarDB Analytics with PostgreSQL tests on the Kubernetes cluster, remove all resources. - -1. Uninstall MySQL, PostgreSQL, and ScalarDB Analytics with PostgreSQL. - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. Remove the client pods. - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. Remove the secret resource. - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. Remove the working directory and sample files. - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/versioned_docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index fb190064..00000000 --- a/versioned_docs/version-3.10/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# How to deploy ScalarDB Analytics with PostgreSQL - -This document explains how to deploy ScalarDB Analytics with PostgreSQL by using Scalar Helm Charts. For details on the custom values file for ScalarDB Analytics with PostgreSQL, see [Configure a custom values file for ScalarDB Analytics with PostgreSQL](configure-custom-values-scalardb-analytics-postgresql.mdx). - -## Prepare a secret resource - -You must create a secret resource `scalardb-analytics-postgresql-superuser-password` with the key `superuser-password` that includes a superuser password for PostgreSQL before you deploy ScalarDB Analytics with PostgreSQL. Scalar Helm Chart mounts this secret resource and sets the `POSTGRES_PASSWORD` environment variable to the value of the `superuser-password` key. - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## Deploy ScalarDB Analytics with PostgreSQL - -To deploy ScalarDB Analytics with PostgreSQL, run the following command, replacing the contents in the angle brackets as described: - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Upgrade a ScalarDB Analytics with PostgreSQL deployment - -To upgrade a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Delete a ScalarDB Analytics with PostgreSQL deployment - -To delete a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm uninstall -n -``` diff --git a/versioned_docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 5d1eb638..00000000 --- a/versioned_docs/version-3.11/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,189 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Configure a custom values file for ScalarDB Analytics with PostgreSQL - -This document explains how to create your custom values file for the ScalarDB Analytics with PostgreSQL chart. For details on the parameters, see the [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) of the ScalarDB Analytics with PostgreSQL chart. - -## Required configurations - -This section explains the required configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Database configurations - -To access databases via ScalarDB Analytics with PostgreSQL, you must set the `scalardbAnalyticsPostgreSQL.databaseProperties` parameter by following the same syntax that you use to configure the `database.properties` file. For details about configurations, see [ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/). - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### Database namespaces configurations - -You must set `schemaImporter.namespaces` to all the database namespaces that include tables you want to read via ScalarDB Analytics with PostgreSQL. - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## Optional configurations - -This section explains the optional configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Resource configurations (recommended in production environments) - -To control pod resources by using requests and limits in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.resources`. - -You can configure requests and limits by using the same syntax as requests and limits in Kubernetes. For more details on requests and limits in Kubernetes, see [Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### Secret configurations (recommended in production environments) - -To use environment variables to set some properties, like credentials, in `scalardbAnalyticsPostgreSQL.databaseProperties`, you can use `scalardbAnalyticsPostgreSQL.secretName` to specify the secret resource that includes some credentials. - -For example, you can set credentials for a backend database (`scalar.db.username` and `scalar.db.password`) by using environment variables, which makes your pods more secure. - -For more details on how to use a secret resource, see [How to use Secret resources to pass the credentials as the environment variables into the properties file](use-secret-for-credentials.mdx). - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### Affinity configurations (recommended in production environments) - -To control pod deployment by using affinity and anti-affinity in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.affinity`. - -You can configure affinity and anti-affinity by using the same syntax for affinity and anti-affinity in Kubernetes. For more details on configuring affinity in Kubernetes, see [Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/). - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext configurations (default value is recommended) - -To set SecurityContext and PodSecurityContext for ScalarDB Analytics with PostgreSQL pods, you can use `scalardbAnalyticsPostgreSQL.securityContext`, `scalardbAnalyticsPostgreSQL.podSecurityContext`, and `schemaImporter.securityContext`. - -You can configure SecurityContext and PodSecurityContext by using the same syntax as SecurityContext and PodSecurityContext in Kubernetes. For more details on the SecurityContext and PodSecurityContext configurations in Kubernetes, see [Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### Image configurations (default value is recommended) - -If you want to change the image repository, you can use `scalardbAnalyticsPostgreSQL.image.repository` and `schemaImporter.image.repository` to specify the container repository information of the ScalarDB Analytics with PostgreSQL and Schema Importer images that you want to pull. - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### Replica configurations (optional based on your environment) - -You can specify the number of ScalarDB Analytics with PostgreSQL replicas (pods) by using `scalardbAnalyticsPostgreSQL.replicaCount`. - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL database name configuration (optional based on your environment) - -You can specify the database name that you create in PostgreSQL. Schema Importer creates some objects, such as a view of ScalarDB Analytics with PostgreSQL, in this database. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL superuser password configuration (optional based on your environment) - -You can specify the secret name that includes the superuser password for PostgreSQL. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -You must create a secret resource with this name (`scalardb-analytics-postgresql-superuser-password` by default) before you deploy ScalarDB Analytics with PostgreSQL. For details, see [Prepare a secret resource](how-to-deploy-scalardb-analytics-postgresql.mdx#prepare-a-secret-resource). - -::: - -### Taint and toleration configurations (optional based on your environment) - -If you want to control pod deployment by using taints and tolerations in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.tolerations`. - -You can configure taints and tolerations by using the same syntax as the tolerations in Kubernetes. For details on configuring tolerations in Kubernetes, see the official Kubernetes documentation [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/). - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/versioned_docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 1807de98..00000000 --- a/versioned_docs/version-3.11/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,511 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Getting Started with Helm Charts (ScalarDB Analytics with PostgreSQL) - -This guide explains how to get started with ScalarDB Analytics with PostgreSQL by using a Helm Chart in a Kubernetes cluster as a test environment. In addition, the contents of this guide assume that you already have a Mac or Linux environment set up for testing. Although **minikube** is mentioned, the steps described should work in any Kubernetes cluster. - -## What you will create - -You will deploy the following components in a Kubernetes cluster: - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes cluster] | -| | -| [Pod] [Pod] [Pod] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL ("customer" schema) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP client | ---> | Service | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL ("order" schema) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP client | ---(Load sample data with a test OLTP workload)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## Step 1. Start a Kubernetes cluster - -First, you need to prepare a Kubernetes cluster. If you're using a **minikube** environment, please refer to the [Getting Started with Scalar Helm Charts](getting-started-scalar-helm-charts.mdx). If you have already started a Kubernetes cluster, you can skip this step. - -## Step 2. Start MySQL and PostgreSQL pods - -ScalarDB including ScalarDB Analytics with PostgreSQL can use several types of database systems as a backend database. In this guide, you will use MySQL and PostgreSQL. - -You can deploy MySQL and PostgreSQL on the Kubernetes cluster as follows: - -1. Add the Bitnami helm repository. - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Update the helm repository. - - ```console - helm repo update bitnami - ``` - -1. Deploy MySQL. - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. Deploy PostgreSQL. - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. Check if the MySQL and PostgreSQL pods are running. - - ```console - kubectl get pod - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## Step 3. Create a working directory - -Since you'll be creating some configuration files locally, create a working directory for those files. - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## Step 4. Set the versions of ScalarDB, ScalarDB Analytics with PostgreSQL, and the chart - -Set the following three environment variables. If you want to use another version of ScalarDB and ScalarDB Analytics with PostgreSQL, be sure to set them to the versions that you want to use. - -:::note - -You must use the same minor versions (for example, 3.10.x) of ScalarDB Analytics with PostgreSQL as ScalarDB, but you don't need to make the patch versions match. For example, you can use ScalarDB 3.10.1 and ScalarDB Analytics with PostgreSQL 3.10.3 together. - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## Step 5. Run OLTP transactions to load sample data to MySQL and PostgreSQL - -Before deploying ScalarDB Analytics with PostgreSQL, run the OLTP transactions to create sample data. - -1. Start an OLTP client pod in the Kubernetes cluster. - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. Check if the OLTP client pod is running. - - ```console - kubectl get pod oltp-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. Run bash in the OLTP client pod. - - ```console - kubectl exec -it oltp-client -- bash - ``` - - After this step, run each command in the OLTP client pod. - -1. Install the git and curl commands in the OLTP client pod. - - ```console - apt update && apt install -y curl git - ``` - -1. Clone the ScalarDB samples repository. - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. Go to the directory `scalardb-samples/multi-storage-transaction-sample/`. - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - You should see the following output: - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Create a configuration file (`database.properties`) to access MySQL and PostgreSQL in the Kubernetes cluster. - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. Download Schema Loader from [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases). - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Run Schema Loader to create sample tables. - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. Load initial data for the sample workload. - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. Run the sample workload of OLTP transactions. Running these commands will create several `order` entries as sample data. - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. Exit from OLTP client. - - ```console - exit - ``` - -## Step 6. Deploy ScalarDB Analytics with PostgreSQL - -After creating sample data via ScalarDB in the backend databases, deploy ScalarDB Analytics with PostgreSQL. - -1. Create a custom values file for ScalarDB Analytics with PostgreSQL (`scalardb-analytics-postgresql-custom-values.yaml`). - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. Create a secret resource to set a superuser password for PostgreSQL. - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. Deploy ScalarDB Analytics with PostgreSQL. - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## Step 7. Run an OLAP client pod - -To run some queries via ScalarDB Analytics with PostgreSQL, run an OLAP client pod. - -1. Start an OLAP client pod in the Kubernetes cluster. - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. Check if the OLAP client pod is running. - - ```console - kubectl get pod olap-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## Step 8. Run sample queries via ScalarDB Analytics with PostgreSQL - -After running the OLAP client pod, you can run some queries via ScalarDB Analytics with PostgreSQL. - -1. Run bash in the OLAP client pod. - - ```console - kubectl exec -it olap-client -- bash - ``` - - After this step, run each command in the OLAP client pod. - -1. Run the psql command to access ScalarDB Analytics with PostgreSQL. - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - The password is `scalardb-analytics`. - -1. Read sample data in the `customer.customers` table. - - ```sql - SELECT * FROM customer.customers; - ``` - - You should see the following output: - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. Read sample data in the `order.orders` table. - - ```sql - SELECT * FROM "order".orders; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. Read sample data in the `order.statements` table. - - ```sql - SELECT * FROM "order".statements; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. Read sample data in the `order.items` table. - - ```sql - SELECT * FROM "order".items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. Run the `JOIN` query. For example, you can see the credit remaining information of each user as follows. - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. Exit from the psql command. - - ```console - \q - ``` - -1. Exit from the OLAP client pod. - - ```console - exit - ``` - -## Step 9. Delete all resources - -After completing the ScalarDB Analytics with PostgreSQL tests on the Kubernetes cluster, remove all resources. - -1. Uninstall MySQL, PostgreSQL, and ScalarDB Analytics with PostgreSQL. - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. Remove the client pods. - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. Remove the secret resource. - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. Remove the working directory and sample files. - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/versioned_docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index fb190064..00000000 --- a/versioned_docs/version-3.11/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# How to deploy ScalarDB Analytics with PostgreSQL - -This document explains how to deploy ScalarDB Analytics with PostgreSQL by using Scalar Helm Charts. For details on the custom values file for ScalarDB Analytics with PostgreSQL, see [Configure a custom values file for ScalarDB Analytics with PostgreSQL](configure-custom-values-scalardb-analytics-postgresql.mdx). - -## Prepare a secret resource - -You must create a secret resource `scalardb-analytics-postgresql-superuser-password` with the key `superuser-password` that includes a superuser password for PostgreSQL before you deploy ScalarDB Analytics with PostgreSQL. Scalar Helm Chart mounts this secret resource and sets the `POSTGRES_PASSWORD` environment variable to the value of the `superuser-password` key. - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## Deploy ScalarDB Analytics with PostgreSQL - -To deploy ScalarDB Analytics with PostgreSQL, run the following command, replacing the contents in the angle brackets as described: - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Upgrade a ScalarDB Analytics with PostgreSQL deployment - -To upgrade a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Delete a ScalarDB Analytics with PostgreSQL deployment - -To delete a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm uninstall -n -``` diff --git a/versioned_docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 5d1eb638..00000000 --- a/versioned_docs/version-3.9/helm-charts/configure-custom-values-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,189 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Configure a custom values file for ScalarDB Analytics with PostgreSQL - -This document explains how to create your custom values file for the ScalarDB Analytics with PostgreSQL chart. For details on the parameters, see the [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-postgresql/README.md) of the ScalarDB Analytics with PostgreSQL chart. - -## Required configurations - -This section explains the required configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Database configurations - -To access databases via ScalarDB Analytics with PostgreSQL, you must set the `scalardbAnalyticsPostgreSQL.databaseProperties` parameter by following the same syntax that you use to configure the `database.properties` file. For details about configurations, see [ScalarDB Configurations](https://scalardb.scalar-labs.com/docs/latest/configurations/). - -```yaml -scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.contact_points=localhost - scalar.db.username=${env:SCALAR_DB_USERNAME:-} - scalar.db.password=${env:SCALAR_DB_PASSWORD:-} - scalar.db.storage=cassandra -``` - -### Database namespaces configurations - -You must set `schemaImporter.namespaces` to all the database namespaces that include tables you want to read via ScalarDB Analytics with PostgreSQL. - -```yaml -schemaImporter: - namespaces: - - namespace1 - - namespace2 - - namespace3 -``` - -## Optional configurations - -This section explains the optional configurations when setting up a custom values file for ScalarDB Analytics with PostgreSQL. - -### Resource configurations (recommended in production environments) - -To control pod resources by using requests and limits in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.resources`. - -You can configure requests and limits by using the same syntax as requests and limits in Kubernetes. For more details on requests and limits in Kubernetes, see [Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). - -```yaml -scalardbAnalyticsPostgreSQL: - resources: - requests: - cpu: 1000m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi -``` - -### Secret configurations (recommended in production environments) - -To use environment variables to set some properties, like credentials, in `scalardbAnalyticsPostgreSQL.databaseProperties`, you can use `scalardbAnalyticsPostgreSQL.secretName` to specify the secret resource that includes some credentials. - -For example, you can set credentials for a backend database (`scalar.db.username` and `scalar.db.password`) by using environment variables, which makes your pods more secure. - -For more details on how to use a secret resource, see [How to use Secret resources to pass the credentials as the environment variables into the properties file](use-secret-for-credentials.mdx). - -```yaml -scalardbAnalyticsPostgreSQL: - secretName: "scalardb-analytics-postgresql-credentials-secret" -``` - -### Affinity configurations (recommended in production environments) - -To control pod deployment by using affinity and anti-affinity in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.affinity`. - -You can configure affinity and anti-affinity by using the same syntax for affinity and anti-affinity in Kubernetes. For more details on configuring affinity in Kubernetes, see [Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/). - -```yaml -scalardbAnalyticsPostgreSQL: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - scalardb-analytics-postgresql - - key: app.kubernetes.io/app - operator: In - values: - - scalardb-analytics-postgresql - topologyKey: kubernetes.io/hostname -``` - -### SecurityContext configurations (default value is recommended) - -To set SecurityContext and PodSecurityContext for ScalarDB Analytics with PostgreSQL pods, you can use `scalardbAnalyticsPostgreSQL.securityContext`, `scalardbAnalyticsPostgreSQL.podSecurityContext`, and `schemaImporter.securityContext`. - -You can configure SecurityContext and PodSecurityContext by using the same syntax as SecurityContext and PodSecurityContext in Kubernetes. For more details on the SecurityContext and PodSecurityContext configurations in Kubernetes, see [Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). - -```yaml -scalardbAnalyticsPostgreSQL: - podSecurityContext: - fsGroup: 201 - seccompProfile: - type: RuntimeDefault - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - runAsUser: 999 - allowPrivilegeEscalation: false - -schemaImporter: - securityContext: - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false -``` - -### Image configurations (default value is recommended) - -If you want to change the image repository, you can use `scalardbAnalyticsPostgreSQL.image.repository` and `schemaImporter.image.repository` to specify the container repository information of the ScalarDB Analytics with PostgreSQL and Schema Importer images that you want to pull. - -```yaml -scalardbAnalyticsPostgreSQL: - image: - repository: - -schemaImporter: - image: - repository: -``` - -### Replica configurations (optional based on your environment) - -You can specify the number of ScalarDB Analytics with PostgreSQL replicas (pods) by using `scalardbAnalyticsPostgreSQL.replicaCount`. - -```yaml -scalardbAnalyticsPostgreSQL: - replicaCount: 3 -``` - -### PostgreSQL database name configuration (optional based on your environment) - -You can specify the database name that you create in PostgreSQL. Schema Importer creates some objects, such as a view of ScalarDB Analytics with PostgreSQL, in this database. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - databaseName: scalardb -``` - -### PostgreSQL superuser password configuration (optional based on your environment) - -You can specify the secret name that includes the superuser password for PostgreSQL. - -```yaml -scalardbAnalyticsPostgreSQL: - postgresql: - secretName: scalardb-analytics-postgresql-superuser-password -``` - -:::note - -You must create a secret resource with this name (`scalardb-analytics-postgresql-superuser-password` by default) before you deploy ScalarDB Analytics with PostgreSQL. For details, see [Prepare a secret resource](how-to-deploy-scalardb-analytics-postgresql.mdx#prepare-a-secret-resource). - -::: - -### Taint and toleration configurations (optional based on your environment) - -If you want to control pod deployment by using taints and tolerations in Kubernetes, you can use `scalardbAnalyticsPostgreSQL.tolerations`. - -You can configure taints and tolerations by using the same syntax as the tolerations in Kubernetes. For details on configuring tolerations in Kubernetes, see the official Kubernetes documentation [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/). - -```yaml -scalardbAnalyticsPostgreSQL: - tolerations: - - effect: NoSchedule - key: scalar-labs.com/dedicated-node - operator: Equal - value: scalardb-analytics-postgresql -``` diff --git a/versioned_docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx deleted file mode 100644 index 1807de98..00000000 --- a/versioned_docs/version-3.9/helm-charts/getting-started-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,511 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# Getting Started with Helm Charts (ScalarDB Analytics with PostgreSQL) - -This guide explains how to get started with ScalarDB Analytics with PostgreSQL by using a Helm Chart in a Kubernetes cluster as a test environment. In addition, the contents of this guide assume that you already have a Mac or Linux environment set up for testing. Although **minikube** is mentioned, the steps described should work in any Kubernetes cluster. - -## What you will create - -You will deploy the following components in a Kubernetes cluster: - -``` -+-------------------------------------------------------------------------------------------------------------------------------------------+ -| [Kubernetes cluster] | -| | -| [Pod] [Pod] [Pod] | -| | -| +------------------------------------+ | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | -| | +------------------------------------+ | +---> | MySQL ("customer" schema) | <---+ | -| | | | +-----------------------------+ | | -| +-------------+ +---------+ | +------------------------------------+ | | | | -| | OLAP client | ---> | Service | ---+---> | ScalarDB Analytics with PostgreSQL | ---+---+ +---+ | -| +-------------+ +---------+ | +------------------------------------+ | | | | | -| | | | +-----------------------------+ | | | -| | +------------------------------------+ | +---> | PostgreSQL ("order" schema) | <---+ | | -| +---> | ScalarDB Analytics with PostgreSQL | ---+ +-----------------------------+ | | -| +------------------------------------+ | | -| | | -| +-------------+ | | -| | OLTP client | ---(Load sample data with a test OLTP workload)-----------------------------------------------------------------------+ | -| +-------------+ | -| | -+-------------------------------------------------------------------------------------------------------------------------------------------+ -``` - -## Step 1. Start a Kubernetes cluster - -First, you need to prepare a Kubernetes cluster. If you're using a **minikube** environment, please refer to the [Getting Started with Scalar Helm Charts](getting-started-scalar-helm-charts.mdx). If you have already started a Kubernetes cluster, you can skip this step. - -## Step 2. Start MySQL and PostgreSQL pods - -ScalarDB including ScalarDB Analytics with PostgreSQL can use several types of database systems as a backend database. In this guide, you will use MySQL and PostgreSQL. - -You can deploy MySQL and PostgreSQL on the Kubernetes cluster as follows: - -1. Add the Bitnami helm repository. - - ```console - helm repo add bitnami https://charts.bitnami.com/bitnami - ``` - -1. Update the helm repository. - - ```console - helm repo update bitnami - ``` - -1. Deploy MySQL. - - ```console - helm install mysql-scalardb bitnami/mysql \ - --set auth.rootPassword=mysql \ - --set primary.persistence.enabled=false - ``` - -1. Deploy PostgreSQL. - - ```console - helm install postgresql-scalardb bitnami/postgresql \ - --set auth.postgresPassword=postgres \ - --set primary.persistence.enabled=false - ``` - -1. Check if the MySQL and PostgreSQL pods are running. - - ```console - kubectl get pod - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - mysql-scalardb-0 1/1 Running 0 3m17s - postgresql-scalardb-0 1/1 Running 0 3m12s - ``` - -## Step 3. Create a working directory - -Since you'll be creating some configuration files locally, create a working directory for those files. - - ```console - mkdir -p ~/scalardb-analytics-postgresql-test/ - ``` - -## Step 4. Set the versions of ScalarDB, ScalarDB Analytics with PostgreSQL, and the chart - -Set the following three environment variables. If you want to use another version of ScalarDB and ScalarDB Analytics with PostgreSQL, be sure to set them to the versions that you want to use. - -:::note - -You must use the same minor versions (for example, 3.10.x) of ScalarDB Analytics with PostgreSQL as ScalarDB, but you don't need to make the patch versions match. For example, you can use ScalarDB 3.10.1 and ScalarDB Analytics with PostgreSQL 3.10.3 together. - -::: - -```console -SCALARDB_VERSION=3.10.1 -``` - -```console -SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION=3.10.3 -``` - -```console -CHART_VERSION=$(helm search repo scalar-labs/scalardb-analytics-postgresql -l | grep -e ${SCALARDB_ANALYTICS_WITH_POSTGRESQL_VERSION} | awk '{print $2}' | sort --version-sort -r | head -n 1) -``` - -## Step 5. Run OLTP transactions to load sample data to MySQL and PostgreSQL - -Before deploying ScalarDB Analytics with PostgreSQL, run the OLTP transactions to create sample data. - -1. Start an OLTP client pod in the Kubernetes cluster. - - ```console - kubectl run oltp-client --image eclipse-temurin:8-jdk-jammy --env SCALARDB_VERSION=${SCALARDB_VERSION} -- sleep inf - ``` - -1. Check if the OLTP client pod is running. - - ```console - kubectl get pod oltp-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - oltp-client 1/1 Running 0 17s - ``` - -1. Run bash in the OLTP client pod. - - ```console - kubectl exec -it oltp-client -- bash - ``` - - After this step, run each command in the OLTP client pod. - -1. Install the git and curl commands in the OLTP client pod. - - ```console - apt update && apt install -y curl git - ``` - -1. Clone the ScalarDB samples repository. - - ```console - git clone https://github.com/scalar-labs/scalardb-samples.git - ``` - -1. Go to the directory `scalardb-samples/multi-storage-transaction-sample/`. - - ```console - cd scalardb-samples/multi-storage-transaction-sample/ - ``` - - ```console - pwd - ``` - - You should see the following output: - - ```console - # pwd - /scalardb-samples/multi-storage-transaction-sample - ``` - -1. Create a configuration file (`database.properties`) to access MySQL and PostgreSQL in the Kubernetes cluster. - - ```console - cat << 'EOF' > database.properties - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - EOF - ``` - -1. Download Schema Loader from [ScalarDB Releases](https://github.com/scalar-labs/scalardb/releases). - - ```console - curl -OL https://github.com/scalar-labs/scalardb/releases/download/v${SCALARDB_VERSION}/scalardb-schema-loader-${SCALARDB_VERSION}.jar - ``` - -1. Run Schema Loader to create sample tables. - - ```console - java -jar scalardb-schema-loader-${SCALARDB_VERSION}.jar --config database.properties --schema-file schema.json --coordinator - ``` - -1. Load initial data for the sample workload. - - ```console - ./gradlew run --args="LoadInitialData" - ``` - -1. Run the sample workload of OLTP transactions. Running these commands will create several `order` entries as sample data. - - ```console - ./gradlew run --args="PlaceOrder 1 1:3,2:2" - ``` - - ```console - ./gradlew run --args="PlaceOrder 1 5:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 3:1,4:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 2 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 1:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 2:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 3:1" - ``` - - ```console - ./gradlew run --args="PlaceOrder 3 5:1" - ``` - - -1. Exit from OLTP client. - - ```console - exit - ``` - -## Step 6. Deploy ScalarDB Analytics with PostgreSQL - -After creating sample data via ScalarDB in the backend databases, deploy ScalarDB Analytics with PostgreSQL. - -1. Create a custom values file for ScalarDB Analytics with PostgreSQL (`scalardb-analytics-postgresql-custom-values.yaml`). - - ```console - cat << 'EOF' > ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml - scalardbAnalyticsPostgreSQL: - databaseProperties: | - scalar.db.storage=multi-storage - scalar.db.multi_storage.storages=storage0,storage1 - - # Storage 0 - scalar.db.multi_storage.storages.storage0.storage=jdbc - scalar.db.multi_storage.storages.storage0.contact_points=jdbc:mysql://mysql-scalardb.default.svc.cluster.local:3306/ - scalar.db.multi_storage.storages.storage0.username=root - scalar.db.multi_storage.storages.storage0.password=mysql - - # Storage 1 - scalar.db.multi_storage.storages.storage1.storage=jdbc - scalar.db.multi_storage.storages.storage1.contact_points=jdbc:postgresql://postgresql-scalardb.default.svc.cluster.local:5432/postgres - scalar.db.multi_storage.storages.storage1.username=postgres - scalar.db.multi_storage.storages.storage1.password=postgres - - scalar.db.multi_storage.namespace_mapping=customer:storage0,order:storage1 - scalar.db.multi_storage.default_storage=storage1 - schemaImporter: - namespaces: - - customer - - order - EOF - ``` - -1. Create a secret resource to set a superuser password for PostgreSQL. - - ```console - kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=scalardb-analytics - ``` - -1. Deploy ScalarDB Analytics with PostgreSQL. - - ```console - helm install scalardb-analytics-postgresql scalar-labs/scalardb-analytics-postgresql -n default -f ~/scalardb-analytics-postgresql-test/scalardb-analytics-postgresql-custom-values.yaml --version ${CHART_VERSION} - ``` - -## Step 7. Run an OLAP client pod - -To run some queries via ScalarDB Analytics with PostgreSQL, run an OLAP client pod. - -1. Start an OLAP client pod in the Kubernetes cluster. - - ```console - kubectl run olap-client --image postgres:latest -- sleep inf - ``` - -1. Check if the OLAP client pod is running. - - ```console - kubectl get pod olap-client - ``` - - You should see the following output: - - ```console - NAME READY STATUS RESTARTS AGE - olap-client 1/1 Running 0 10s - ``` - -## Step 8. Run sample queries via ScalarDB Analytics with PostgreSQL - -After running the OLAP client pod, you can run some queries via ScalarDB Analytics with PostgreSQL. - -1. Run bash in the OLAP client pod. - - ```console - kubectl exec -it olap-client -- bash - ``` - - After this step, run each command in the OLAP client pod. - -1. Run the psql command to access ScalarDB Analytics with PostgreSQL. - - ```console - psql -h scalardb-analytics-postgresql -p 5432 -U postgres -d scalardb - ``` - - The password is `scalardb-analytics`. - -1. Read sample data in the `customer.customers` table. - - ```sql - SELECT * FROM customer.customers; - ``` - - You should see the following output: - - ```sql - customer_id | name | credit_limit | credit_total - -------------+---------------+--------------+-------------- - 1 | Yamada Taro | 10000 | 10000 - 2 | Yamada Hanako | 10000 | 9500 - 3 | Suzuki Ichiro | 10000 | 8500 - (3 rows) - ``` - -1. Read sample data in the `order.orders` table. - - ```sql - SELECT * FROM "order".orders; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".orders; - customer_id | timestamp | order_id - -------------+---------------+-------------------------------------- - 1 | 1700124015601 | 5ae2a41b-990d-4a16-9700-39355e29adf8 - 1 | 1700124021273 | f3f23d93-3862-48be-8a57-8368b7c8689e - 2 | 1700124028182 | 696a895a-8998-4c3b-b112-4d5763bfcfd8 - 2 | 1700124036158 | 9215d63a-a9a2-4471-a990-45897f091ca5 - 3 | 1700124043744 | 9be70cd4-4f93-4753-9d89-68e250b2ac51 - 3 | 1700124051162 | 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 - 3 | 1700124058096 | 658b6682-2819-41f2-91ee-2802a1f02857 - 3 | 1700124071240 | 4e2f94f4-53ec-4570-af98-7c648d8ed80f - (8 rows) - ``` - -1. Read sample data in the `order.statements` table. - - ```sql - SELECT * FROM "order".statements; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".statements; - order_id | item_id | count - --------------------------------------+---------+------- - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 2 | 2 - 5ae2a41b-990d-4a16-9700-39355e29adf8 | 1 | 3 - f3f23d93-3862-48be-8a57-8368b7c8689e | 5 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 4 | 1 - 696a895a-8998-4c3b-b112-4d5763bfcfd8 | 3 | 1 - 9215d63a-a9a2-4471-a990-45897f091ca5 | 2 | 1 - 9be70cd4-4f93-4753-9d89-68e250b2ac51 | 1 | 1 - 4e8ce2d2-488c-40d6-aa52-d9ecabfc68a8 | 2 | 1 - 658b6682-2819-41f2-91ee-2802a1f02857 | 3 | 1 - 4e2f94f4-53ec-4570-af98-7c648d8ed80f | 5 | 1 - (10 rows) - ``` - -1. Read sample data in the `order.items` table. - - ```sql - SELECT * FROM "order".items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM "order".items; - item_id | name | price - ---------+--------+------- - 5 | Melon | 3000 - 2 | Orange | 2000 - 4 | Mango | 5000 - 1 | Apple | 1000 - 3 | Grape | 2500 - (5 rows) - ``` - -1. Run the `JOIN` query. For example, you can see the credit remaining information of each user as follows. - - ```sql - SELECT * FROM ( - SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - FROM "order".orders o - JOIN customer.customers c ON o.customer_id = c.customer_id - JOIN "order".statements s ON o.order_id = s.order_id - JOIN "order".items i ON s.item_id = i.item_id - ) AS remaining_info GROUP BY name, remaining, items; - ``` - - You should see the following output: - - ```sql - scalardb=# SELECT * FROM ( - scalardb(# SELECT c.name, c.credit_limit - c.credit_total AS remaining, array_agg(i.name) OVER (PARTITION BY c.name) AS items - scalardb(# FROM "order".orders o - scalardb(# JOIN customer.customers c ON o.customer_id = c.customer_id - scalardb(# JOIN "order".statements s ON o.order_id = s.order_id - scalardb(# JOIN "order".items i ON s.item_id = i.item_id - scalardb(# ) AS remaining_info GROUP BY name, remaining, items; - name | remaining | items - ---------------+-----------+---------------------------- - Suzuki Ichiro | 1500 | {Grape,Orange,Apple,Melon} - Yamada Hanako | 500 | {Orange,Grape,Mango} - Yamada Taro | 0 | {Orange,Melon,Apple} - (3 rows) - ``` - -1. Exit from the psql command. - - ```console - \q - ``` - -1. Exit from the OLAP client pod. - - ```console - exit - ``` - -## Step 9. Delete all resources - -After completing the ScalarDB Analytics with PostgreSQL tests on the Kubernetes cluster, remove all resources. - -1. Uninstall MySQL, PostgreSQL, and ScalarDB Analytics with PostgreSQL. - - ```console - helm uninstall mysql-scalardb postgresql-scalardb scalardb-analytics-postgresql - ``` - -1. Remove the client pods. - - ```console - kubectl delete pod oltp-client olap-client --grace-period 0 - ``` - -1. Remove the secret resource. - - ```console - kubectl delete secrets scalardb-analytics-postgresql-superuser-password - ``` - -1. Remove the working directory and sample files. - - ```console - cd ~ - ``` - - ```console - rm -rf ~/scalardb-analytics-postgresql-test/ - ``` diff --git a/versioned_docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx b/versioned_docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx deleted file mode 100644 index fb190064..00000000 --- a/versioned_docs/version-3.9/helm-charts/how-to-deploy-scalardb-analytics-postgresql.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -tags: - - Community -displayed_sidebar: docsEnglish ---- - -# How to deploy ScalarDB Analytics with PostgreSQL - -This document explains how to deploy ScalarDB Analytics with PostgreSQL by using Scalar Helm Charts. For details on the custom values file for ScalarDB Analytics with PostgreSQL, see [Configure a custom values file for ScalarDB Analytics with PostgreSQL](configure-custom-values-scalardb-analytics-postgresql.mdx). - -## Prepare a secret resource - -You must create a secret resource `scalardb-analytics-postgresql-superuser-password` with the key `superuser-password` that includes a superuser password for PostgreSQL before you deploy ScalarDB Analytics with PostgreSQL. Scalar Helm Chart mounts this secret resource and sets the `POSTGRES_PASSWORD` environment variable to the value of the `superuser-password` key. - -```console -kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password= -n -``` - -## Deploy ScalarDB Analytics with PostgreSQL - -To deploy ScalarDB Analytics with PostgreSQL, run the following command, replacing the contents in the angle brackets as described: - -```console -helm install scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Upgrade a ScalarDB Analytics with PostgreSQL deployment - -To upgrade a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm upgrade scalar-labs/scalardb-analytics-postgresql -n -f / --version -``` - -## Delete a ScalarDB Analytics with PostgreSQL deployment - -To delete a ScalarDB Analytics with PostgreSQL deployment, run the following command, replacing the contents in the angle brackets as described: - -```console -helm uninstall -n -```