aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexv-smirnov <alexv-smirnov@yandex-team.ru>2022-03-11 02:31:44 +0300
committeralexv-smirnov <alexv-smirnov@yandex-team.ru>2022-03-11 02:31:44 +0300
commit75b8b8c3a89ee180586079945cabbc4345cca8c2 (patch)
treeaf6558b38ca734db8a9c21a6f6d7b97d70076df0
parentfbabf95d14c577d2daf128362225509878afdff7 (diff)
downloadydb-75b8b8c3a89ee180586079945cabbc4345cca8c2.tar.gz
ydb docs getting started local binary install.sh
ref:7b81c93dab5d6c605fbbdccd5ae8042d640b8f50
-rw-r--r--ydb/deploy/local_binary/install.sh105
-rw-r--r--ydb/deploy/local_binary/linux/config/disk.yaml (renamed from ydb/deploy/local_binary/linux/cfg_disk.yaml)2
-rw-r--r--ydb/deploy/local_binary/linux/config/exclude_err.txt (renamed from ydb/deploy/local_binary/linux/exclude_err.txt)0
-rw-r--r--ydb/deploy/local_binary/linux/config/ram.yaml (renamed from ydb/deploy/local_binary/linux/cfg_ram.yaml)2
-rwxr-xr-xydb/deploy/local_binary/linux/start.sh21
-rwxr-xr-xydb/deploy/local_binary/linux/stop.sh2
-rw-r--r--ydb/docs/ru/core/getting_started/self_hosted/_includes/ydb_local.md5
7 files changed, 123 insertions, 14 deletions
diff --git a/ydb/deploy/local_binary/install.sh b/ydb/deploy/local_binary/install.sh
new file mode 100644
index 00000000000..af1b4959702
--- /dev/null
+++ b/ydb/deploy/local_binary/install.sh
@@ -0,0 +1,105 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+VERBOSE=${VERBOSE:-}
+if [[ ${VERBOSE} != "" ]]; then
+ set -x
+fi
+
+SYSTEM=${YDB_INSTALL_TEST_SYSTEM:-$(uname -s)} # $(uname -o) is not supported on macOS for example.
+MACHINE=${YDB_INSTALL_TEST_MACHINE:-$(uname -m)}
+
+GOOS=""
+GOARCH=""
+YDB_BIN="ydb"
+SHELL_NAME=$(basename "${SHELL}")
+
+CONTACT_SUPPORT_MESSAGE="If you think that this should not be, contact support and attach this message.
+System info: $(uname -a)"
+
+case ${SYSTEM} in
+ Linux | GNU/Linux)
+ GOOS="linux"
+ ;;
+# Darwin)
+# GOOS="darwin"
+# ;;
+# CYGWIN* | MINGW* | MSYS* | Windows_NT | WindowsNT )
+# GOOS="windows"
+# YDB_BIN="ydb.exe"
+# ;;
+ *)
+ printf "'%s' system is not supported.\\n" "${SYSTEM}"
+ exit 1
+ ;;
+esac
+
+case ${MACHINE} in
+ x86_64 | amd64 | i686-64)
+ GOARCH="amd64"
+ ;;
+# arm64)
+# GOARCH="arm64"
+# ;;
+ *)
+ printf "'%s' machines are not supported .\\n%s" "${MACHINE}"
+ exit 1
+ ;;
+esac
+
+DEFAULT_INSTALL_PATH=$PWD
+YDB_INSTALL_PATH="${DEFAULT_INSTALL_PATH}"
+
+while getopts "hi:r:na" opt ; do
+ case "$opt" in
+ i)
+ YDB_INSTALL_PATH="${OPTARG}"
+ ;;
+ h)
+ echo "Usage: install [options...]"
+ echo "Options:"
+ echo " -i [INSTALL_DIR] Installs to specified dir, pwd/ydbd by default"
+ echo " -h Prints help."
+ exit 0
+ ;;
+ esac
+done
+
+YDB_STORAGE_URL="${YDB_STORAGE_URL:-"https://binaries.ydb.tech"}"
+YDB_VERSION="main"
+# YDB_VERSION="${YDB_VERSION:-$(curl_with_retry -s "${YDB_STORAGE_URL}/release/stable" | tr -d [:space:])}"
+
+echo "Preparing temporary directory"
+
+# Download to temp dir, check that executable is healthy, only then move to install path.
+# That prevents partial download in case of download error or cancel.
+TMPDIR="${TMPDIR:-/tmp}"
+TMP_INSTALL_PATH=$(mktemp -d "${TMPDIR}/ydbd-install.XXXXXXXXX")
+function cleanup {
+ rm -rf "${TMP_INSTALL_PATH}"
+}
+trap cleanup EXIT
+
+mkdir -p "${TMP_INSTALL_PATH}/ydbd"
+
+echo "Downloading and extracting binary archive to temporary directory"
+
+# Download and show progress.
+curl "${YDB_STORAGE_URL}/ydbd-${YDB_VERSION}-${GOOS}-${GOARCH}.tar.gz" | tar -xz --strip-components=1 -C "${TMP_INSTALL_PATH}/ydbd"
+
+echo "Downloading and extracting scripts and configs to temporary directory"
+curl "${YDB_STORAGE_URL}/local_scripts/${GOOS}.tar.gz" | tar -xz -C "${TMP_INSTALL_PATH}"
+
+echo "Preparing target directory ${YDB_INSTALL_PATH}"
+mkdir -p "${YDB_INSTALL_PATH}"
+mkdir -p "${YDB_INSTALL_PATH}/logs"
+
+YDB="${YDB_INSTALL_PATH}"
+
+echo "Moving files from temporary to target directory"
+
+mv -f "${TMP_INSTALL_PATH}"/* "${YDB}"
+
+echo "Installation complete. You may run 'start.sh ram' or 'start.sh disk' in the ${YDB_INSTALL_PATH} diretory to start server, stop.sh to stop."
+
diff --git a/ydb/deploy/local_binary/linux/cfg_disk.yaml b/ydb/deploy/local_binary/linux/config/disk.yaml
index a7012b25c1c..a0d9f9720c1 100644
--- a/ydb/deploy/local_binary/linux/cfg_disk.yaml
+++ b/ydb/deploy/local_binary/linux/config/disk.yaml
@@ -81,3 +81,5 @@ channel_profile_config:
pdisk_category: 0
storage_pool_kind: ssd
profile_id: 0
+table_service_config:
+ sql_version: 1 \ No newline at end of file
diff --git a/ydb/deploy/local_binary/linux/exclude_err.txt b/ydb/deploy/local_binary/linux/config/exclude_err.txt
index 1cafcc6670b..1cafcc6670b 100644
--- a/ydb/deploy/local_binary/linux/exclude_err.txt
+++ b/ydb/deploy/local_binary/linux/config/exclude_err.txt
diff --git a/ydb/deploy/local_binary/linux/cfg_ram.yaml b/ydb/deploy/local_binary/linux/config/ram.yaml
index e58913297e9..465ce3bccae 100644
--- a/ydb/deploy/local_binary/linux/cfg_ram.yaml
+++ b/ydb/deploy/local_binary/linux/config/ram.yaml
@@ -81,3 +81,5 @@ channel_profile_config:
pdisk_category: 1
storage_pool_kind: ssd
profile_id: 0
+table_service_config:
+ sql_version: 1 \ No newline at end of file
diff --git a/ydb/deploy/local_binary/linux/start.sh b/ydb/deploy/local_binary/linux/start.sh
index 7e46ddefa5f..d803d70ae85 100755
--- a/ydb/deploy/local_binary/linux/start.sh
+++ b/ydb/deploy/local_binary/linux/start.sh
@@ -1,3 +1,4 @@
+# set -v
if [[ $1 != "disk" && $1 != "ram" ]]; then
echo Please specify 'disk' or 'ram' as the parameter
exit
@@ -11,31 +12,31 @@ if [[ $1 = "disk" ]]; then
exit
fi
fi
- cfg=cfg_disk.yaml
+ cfg=disk.yaml
else
- cfg=cfg_ram.yaml
+ cfg=ram.yaml
fi
-export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`pwd`/ydbd-main-linux-amd64/lib"
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`pwd`/ydbd/lib"
echo Starting storage process...
-./ydbd-main-linux-amd64/bin/ydbd server --yaml-config ./$cfg --node 1 --grpc-port 2136 --ic-port 19001 --mon-port 8765 --log-file-name node_storage.log > node_storage_run.log 2>node_storage_err.log &
+`pwd`/ydbd/bin/ydbd server --yaml-config config/$cfg --node 1 --grpc-port 2136 --ic-port 19001 --mon-port 8765 --log-file-name logs/storage_start.log > logs/storage_start_output.log 2>logs/storage_start_err.log &
sleep 3
-grep node_storage_err.log -v -f exclude_err.txt
+grep logs/storage_start_err.log -v -f config/exclude_err.txt
if [[ $? -eq 0 ]]; then
echo Errors found when starting storage process, cancelling start script
exit
fi
echo Initializing storage ...
-./ydbd-main-linux-amd64/bin/ydbd -s grpc://localhost:2136 admin blobstorage config init --yaml-file ./$cfg > init_storage.log 2>&1
+`pwd`/ydbd/bin/ydbd -s grpc://localhost:2136 admin blobstorage config init --yaml-file config/$cfg > logs/init_storage.log 2>&1
echo Registering database ...
-./ydbd-main-linux-amd64/bin/ydbd -s grpc://localhost:2136 admin database /Root/test create ssd:1 > database_create.log 2>&1
+`pwd`/ydbd/bin/ydbd -s grpc://localhost:2136 admin database /Root/test create ssd:1 > logs/db_reg.log 2>&1
if [[ $? -ge 1 ]]; then
- echo Errors found when registering database, cancelling start script
+ echo Errors found when registering database, cancelling start script, check logs/db_reg.log
exit
fi
echo Starting database process...
-./ydbd-main-linux-amd64/bin/ydbd server --yaml-config ./$cfg --tenant /Root/test --node-broker localhost:2136 --grpc-port 31001 --ic-port 31003 --mon-port 31002 --log-file-name node_db.log > node_db_run.log 2>node_db_err.log &
+`pwd`/ydbd/bin/ydbd server --yaml-config config/$cfg --tenant /Root/test --node-broker localhost:2136 --grpc-port 31001 --ic-port 31003 --mon-port 31002 --log-file-name logs/db_start.log > logs/db_start_output.log 2>logs/db_start_err.log &
sleep 3
-grep node_db_err.log -v -f exclude_err.txt
+grep logs/db_start_err.log -v -f config/exclude_err.txt
if [[ $? -eq 0 ]]; then
echo Errors found when starting database process, cancelling start script
exit
diff --git a/ydb/deploy/local_binary/linux/stop.sh b/ydb/deploy/local_binary/linux/stop.sh
index 6241b77f26d..084a7817d8c 100755
--- a/ydb/deploy/local_binary/linux/stop.sh
+++ b/ydb/deploy/local_binary/linux/stop.sh
@@ -1 +1 @@
-ps -aux | grep "./ydbd-main-linux-amd64/bin/ydbd server" | grep -v "grep" | awk '{print $2}' | while read line;do kill $line;done \ No newline at end of file
+ps -aux | grep "`pwd`/ydbd/bin/ydbd server" | grep -v "grep" | awk '{print $2}' | while read line;do kill $line;done \ No newline at end of file
diff --git a/ydb/docs/ru/core/getting_started/self_hosted/_includes/ydb_local.md b/ydb/docs/ru/core/getting_started/self_hosted/_includes/ydb_local.md
index 0f7287d91cc..6c20a75a2f2 100644
--- a/ydb/docs/ru/core/getting_started/self_hosted/_includes/ydb_local.md
+++ b/ydb/docs/ru/core/getting_started/self_hosted/_includes/ydb_local.md
@@ -12,11 +12,10 @@
## Установка {#install}
-Создайте рабочую директорию, и запустите в ней команды скачивания архива с исполняемым файлом `ydbd` и необходимыми для работы {{ ydb-short-name }} библиотеками, а также набора скриптов и вспомогательных файлов для запуска и остановки сервера:
+Создайте рабочую директорию. Запустите в ней скрипт скачивания архива с исполняемым файлом `ydbd` и необходимыми для работы {{ ydb-short-name }} библиотеками, а также набора скриптов и вспомогательных файлов для запуска и остановки сервера:
```bash
-curl https://binaries.ydb.tech/ydbd-main-linux-amd64.tar.gz | tar -xz
-curl https://binaries.ydb.tech/local_scripts/linux.tar.gz | tar -xz
+curl https://binaries.ydb.tech/local_scripts/install.sh | bash
```
{% include [wget_auth_overlay.md](wget_auth_overlay.md) %}