### Create YDB Directory and Set as Working Directory (Linux) Source: https://ydb.tech/docs/en/quickstart Creates a new directory for YDB and navigates into it, preparing the environment for installation. This is the first step for local YDB setup on Linux. ```shell mkdir ~/ydbd && cd ~/ydbd ``` -------------------------------- ### Download and Execute YDB Installation Script (Linux) Source: https://ydb.tech/docs/en/quickstart Fetches the YDB installation script from the official URL and executes it. This script downloads and unpacks the YDB executable and necessary files without requiring root privileges. ```shell curl https://install.ydb.tech | bash ``` -------------------------------- ### Install Kind and Prepare for YDB Deployment Source: https://ydb.tech/docs/en/quickstart Provides instructions for installing the Kubernetes CLI (kubectl) and the Kind (Kubernetes in Docker) tool, which are prerequisites for deploying YDB in a Kind cluster. ```shell # Install kubectl (link provided in original text) # Install Kind # Refer to Kind Quick Start guide for detailed installation steps. ``` -------------------------------- ### Start YDB Cluster with Disk Storage (Linux) Source: https://ydb.tech/docs/en/quickstart Starts the YDB local cluster, storing data on disk. An 80GB 'ydb.data' file will be created if it doesn't exist. Ensure sufficient disk space is available. ```shell ./start.sh disk ``` -------------------------------- ### YDB CLI Connection Options (Linux) Source: https://ydb.tech/docs/en/quickstart Displays the connection options for the YDB CLI after a successful cluster start. These options include the endpoint and database path. ```APIDOC Connection Options for YDB CLI: -e grpc://localhost:2136 -d /Root/test ``` -------------------------------- ### Install YDB Operator with Helm Source: https://ydb.tech/docs/en/quickstart Installs or upgrades the YDB operator in the Kubernetes cluster using Helm. Metrics are disabled for this installation. ```bash helm upgrade --install ydb-operator deploy/ydb-operator --set metrics.enabled=false ``` -------------------------------- ### Install YDB Operator and Apply Manifests (Minikube) Source: https://ydb.tech/docs/en/quickstart Installs the YDB Kubernetes Operator using Helm and applies YAML manifests to create a YDB cluster within Minikube. It includes steps to wait for cluster readiness. ```shell git clone https://github.com/ydb-platform/ydb-kubernetes-operator && cd ydb-kubernetes-operator ``` ```helm helm upgrade --install ydb-operator deploy/ydb-operator --set metrics.enabled=false ``` ```kubectl kubectl apply -f samples/minikube/storage.yaml # Wait for kubectl get storages.ydb.tech to become Ready kubectl apply -f samples/minikube/database.yaml # Wait for kubectl get databases.ydb.tech to become Ready ``` -------------------------------- ### Create YDB Key-Value Table Source: https://ydb.tech/docs/en/quickstart This SQL statement creates a simple key-value table named 'example' in YDB. It defines two columns: 'key' of type UInt64 and 'value' of type String. The 'key' column is designated as the primary key, ensuring unique identification for each row. ```sql CREATE TABLE example ( key UInt64, value String, PRIMARY KEY (key) ); ``` -------------------------------- ### Start YDB Cluster in RAM Mode (Linux) Source: https://ydb.tech/docs/en/quickstart Starts the YDB local cluster using RAM for data storage. Data will be lost upon cluster shutdown. This mode is suitable for testing or development where persistence is not required. ```shell ./start.sh ram ``` -------------------------------- ### Start YDB Cluster with Real Disk Drive (Linux) Source: https://ydb.tech/docs/en/quickstart Starts the YDB local cluster using a specified real disk drive for storage. The drive will be wiped on first use. Recommended for NVMe/SSD drives (>=800GB) for performance testing. ```shell ./start.sh drive "/dev/$DRIVE_NAME" ``` -------------------------------- ### Prepare Docker Environment and Run YDB Container Source: https://ydb.tech/docs/en/quickstart Sets up directories for YDB certificates and data, then launches the YDB local Docker container. It maps ports and volumes for persistent storage and access. ```shell mkdir ~/ydbd && cd ~/ydbd mkdir ydb_data mkdir ydb_certs ``` ```docker docker run -d --rm --name ydb-local -h localhost \ --platform linux/amd64 \ -p 2135:2135 -p 2136:2136 -p 8765:8765 -p 9092:9092 \ -v $(pwd)/ydb_certs:/ydb_certs -v $(pwd)/ydb_data:/ydb_data \ -e GRPC_TLS_PORT=2135 -e GRPC_PORT=2136 -e MON_PORT=8765 \ -e YDB_KAFKA_PROXY_PORT=9092 \ ydbplatform/local-ydb:latest ``` -------------------------------- ### Create Kind Cluster Source: https://ydb.tech/docs/en/quickstart Creates a Kubernetes cluster using Kind with a specified configuration file. The `--wait` flag ensures the cluster is ready before proceeding. ```bash kind create cluster --config=samples/kind/kind-config.yaml --wait 5m ``` -------------------------------- ### Clone YDB Kubernetes Operator Repository Source: https://ydb.tech/docs/en/quickstart Clones the YDB Kubernetes Operator repository from GitHub and navigates into the cloned directory. This is the initial step for setting up the operator. ```bash git clone https://github.com/ydb-platform/ydb-kubernetes-operator && cd ydb-kubernetes-operator ``` -------------------------------- ### Apply Database Manifest Source: https://ydb.tech/docs/en/quickstart Applies a Kubernetes manifest file to create a YDB database. This step defines the YDB instance within the cluster. ```bash kubectl apply -f samples/kind/database.yaml ``` -------------------------------- ### Apply Storage Manifest Source: https://ydb.tech/docs/en/quickstart Applies a Kubernetes manifest file to create YDB storage resources. This is a prerequisite for creating a YDB database. ```bash kubectl apply -f samples/kind/storage.yaml ``` -------------------------------- ### Run First YQL Query Source: https://ydb.tech/docs/en/quickstart Executes a simple 'Hello, world!' query using YQL in the YDB web interface. The 'u' suffix denotes a Utf8 string literal. ```sql SELECT "Hello, world!"u; ``` -------------------------------- ### Upsert Data with Select and YQL Functions Source: https://ydb.tech/docs/en/quickstart Illustrates how to populate a table using UPSERT combined with a SELECT statement that leverages YQL features like named expressions, ListFromRange, RandomUuid, and FLATTEN LIST BY for dynamic data generation. ```YQL $subquery = SELECT ListFromRange(1000, 10000) AS keys; UPSERT INTO example SELECT key, CAST(RandomUuid(key) AS String) AS value FROM $subquery FLATTEN LIST BY keys AS key ``` -------------------------------- ### Insert Data with Literals Source: https://ydb.tech/docs/en/quickstart Demonstrates the basic SQL INSERT statement for adding rows with literal values. It highlights the difference between INSERT and UPSERT for handling primary key conflicts. ```SQL INSERT INTO example (key, value) VALUES (123, "hello"), (321, "world"); ``` -------------------------------- ### Count Rows in Table Source: https://ydb.tech/docs/en/quickstart Shows a common SQL query to count the total number of rows in a table using the COUNT(*) aggregate function. ```SQL SELECT COUNT(*) FROM example; ``` -------------------------------- ### Port Forward to YDB Database Source: https://ydb.tech/docs/en/quickstart Forwards a local port to the YDB database instance running inside the Kubernetes cluster. This allows external access to the YDB service. ```bash kubectl port-forward database-kind-sample-0 8765 ``` -------------------------------- ### Access YDB Cluster Port (Minikube) Source: https://ydb.tech/docs/en/quickstart Forwards a local port to the YDB database service running within the Minikube cluster, enabling external access to the monitoring port. ```kubectl kubectl port-forward database-minikube-sample-0 8765 ``` -------------------------------- ### Delete Kind Cluster Source: https://ydb.tech/docs/en/quickstart Command to delete a Kind (Kubernetes in Docker) cluster. This action removes the entire Kind cluster environment. ```shell kind delete cluster ``` -------------------------------- ### Delete YDB Database (Minikube) Source: https://ydb.tech/docs/en/quickstart Kubernetes command to delete a YDB database resource named 'database-minikube-sample' from a Minikube cluster. This action removes the database instance. ```kubernetes kubectl delete database.ydb.tech database-minikube-sample ``` -------------------------------- ### Delete YDB Database (Kind) Source: https://ydb.tech/docs/en/quickstart Kubernetes command to delete a YDB database resource named 'database-kind-sample' from a Kind cluster. This action removes the database instance. ```kubernetes kubectl delete database.ydb.tech database-kind-sample ``` -------------------------------- ### Stop YDB Local Cluster (Docker) Source: https://ydb.tech/docs/en/quickstart Command to stop a local YDB cluster running via Docker. It kills the 'ydb-local' Docker container. Optionally, it provides a command to remove the working directory, which will delete all data. ```shell docker kill ydb-local ``` -------------------------------- ### Delete YDB Cluster Storage (Kind) Source: https://ydb.tech/docs/en/quickstart Kubernetes command to delete the YDB cluster storage resource named 'storage-kind-sample' from a Kind cluster. This action will result in the loss of all data. ```kubernetes kubectl delete storage.ydb.tech storage-kind-sample ``` -------------------------------- ### Delete YDB Cluster Storage (Minikube) Source: https://ydb.tech/docs/en/quickstart Kubernetes command to delete the YDB cluster storage resource named 'storage-minikube-sample' from a Minikube cluster. This action will result in the loss of all data. ```kubernetes kubectl delete storage.ydb.tech storage-minikube-sample ``` -------------------------------- ### Stop YDB Local Cluster (Linux) Source: https://ydb.tech/docs/en/quickstart Command to stop a local YDB cluster running on Linux. It executes a shell script located in the ydbd directory. Optionally, it provides a command to remove the working directory, which will delete all data. ```shell ~/ydbd/stop.sh ``` -------------------------------- ### Remove YDB Operator (Minikube/Kind) Source: https://ydb.tech/docs/en/quickstart Helm command to remove the YDB operator from a Kubernetes cluster. This command deletes the release created by Helm, effectively uninstalling the operator. ```helm helm delete ydb-operator ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.