From 228c3bd44c17ae425cf7087d650f1b1b6e27e93a Mon Sep 17 00:00:00 2001 From: vimiix Date: Thu, 2 Jun 2022 11:04:00 +0800 Subject: [PATCH] feat(ptk):add quick start and command page --- product/en/docs-ptk/v0.1/toc.md | 10 +- product/zh/docs-ptk/v0.1/command.md | 781 ++++++++++++++++++++++++ product/zh/docs-ptk/v0.1/config.md | 31 +- product/zh/docs-ptk/v0.1/install.md | 4 +- product/zh/docs-ptk/v0.1/quick-start.md | 121 ++++ product/zh/docs-ptk/v0.1/toc.md | 6 +- product/zh/docs-ptk/v0.1/usage.md | 12 +- scripts/build_pdf.sh | 2 +- 8 files changed, 944 insertions(+), 23 deletions(-) create mode 100644 product/zh/docs-ptk/v0.1/command.md create mode 100644 product/zh/docs-ptk/v0.1/quick-start.md diff --git a/product/en/docs-ptk/v0.1/toc.md b/product/en/docs-ptk/v0.1/toc.md index 84c1d0a4..14b7f61c 100644 --- a/product/en/docs-ptk/v0.1/toc.md +++ b/product/en/docs-ptk/v0.1/toc.md @@ -4,6 +4,12 @@ ## PTK Documentation -+ [Usage](/overview.md) -+ [Configuration](/config.md) ++ [About PTK](/overview.md) ++ [Quick Start](/quick-start.md) ++ [Installation](/install.md) ++ [Usage](/usage.md) ++ [Config](/config.md) ++ [PTK Command](/command.md) ++ [Trouble Shooting](/debug.md) ++ [FAQ](/faq.md) + [Release Note](/release.md) diff --git a/product/zh/docs-ptk/v0.1/command.md b/product/zh/docs-ptk/v0.1/command.md new file mode 100644 index 00000000..b27c1537 --- /dev/null +++ b/product/zh/docs-ptk/v0.1/command.md @@ -0,0 +1,781 @@ +--- +title: PTK命令参考 +summary: PTK命令参考 +author: Yao Qian +date: 2022-05-30 +--- + +## PTK 所有子命令 + +### Content + +* [ptk checkos](#ptk-checkos) - Check cluster servers os dependencies +* [ptk completion](#ptk-completion) - Generate the autocompletion script for the specified shell +* [ptk encrypt](#ptk-encrypt) - Provides a convenient way to encrypt your text/password +* [ptk env](#ptk-env) - Print ptk environment information +* [ptk gen-xml](#ptk-gen-xml) - Generate an XML file +* [ptk install](#ptk-install) - Install the MogDB database cluter based on topology configuration +* [ptk ls](#ptk-ls) - List MogDB clusters +* [ptk restart](#ptk-restart) - Restart db instance or cluster +* [ptk self](#ptk-self) - Modify the ptk installation +* [ptk start](#ptk-start) - Start db instance or cluster +* [ptk status](#ptk-status) - Show status of db instance or cluster +* [ptk stop](#ptk-stop) - Stop db instance or cluster +* [ptk template](#ptk-template) - Print template of configuration +* [ptk uninstall](#ptk-uninstall) - Uninstall a MogDB database cluster + +## ptk checkos + +Check cluster servers os dependencies + +### Synopsis + +Check cluster servers os dependencies. +To check all items, enter "-i A". +To check multiple status, enter the items in the following format: "-i A1,A2,A3". +Item number description: + 'A1':[ OS version status ] + 'A2':[ Kernel version status ] + 'A3':[ Unicode status ] + 'A4':[ Time zone status ] + 'A5':[ Swap memory status ] + 'A6':[ System control parameters status ] + 'A7':[ File system configuration status ] + 'A8':[ Disk configuration status ] + 'A9':[ Pre-read block size status ] + 'A10':[ IO scheduler status ] + 'A11':[ Network card configuration status ] + 'A12':[ Time consistency status ] + 'A13':[ Firewall service status ] + 'A14':[ THP service status ] + 'A15':[ System dependency package inspection ] + +``` +ptk checkos [flags] +``` + +### Options + +``` + --detail Print detail message of every check item + -h, --help help for checkos + -i, --item string Specify item number, multiple items are separated by commas (default "A") + -o, --output string Specify a output path if needed +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk encrypt + +Provides a convenient way to encrypt your text/password + +``` +ptk encrypt TEXT1 [TEXT2 TEXT3...] [flags] +``` + +### Options + +``` + -h, --help help for encrypt +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk template create + +Create config template by interaction + +``` +ptk template create [flags] +``` + +### Options + +``` + -h, --help help for create + -o, --output string Specify an output filename to store template (default "config.yaml") +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk template](#ptk-template) - Print template of configuration + +## ptk template + +Print template of configuration + +``` +ptk template [flags] +``` + +### Options + +``` + -h, --help help for template +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) +* [ptk template create](#ptk-template-create) - Create config template by interaction + +## ptk install + +Install the MogDB database cluter based on topology configuration + +``` +ptk install [flags] +``` + +### Options + +``` + -y, --assumeyes Automatically answer yes for all questions + --db-version string Specify the database package version if use online package (default "2.1.1") + -e, --env strings Environment variable will be append to os user profile + -h, --help help for install + --launch-db-timeout duration Timeout for launch db (default 5m0s) + -p, --pkg string Specify the database package path or url + --post-run string The bash script will be run on every node after deploy + --pre-run string The bash script will be run on every node before deploy + --skip-check-distro Skip check distro, install directly + --skip-create-user Skip creating system user + --skip-launch-db Skip launching db after initdb + --skip-rollback Skip rollback when deploy failure +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) - + +## ptk uninstall + +Uninstall a MogDB database cluster + +``` +ptk uninstall [flags] +``` + +### Examples + +``` +# uninstall by topo.yaml +ptk uninstall -f topo.yaml + +# uninstall by cluster name +ptk uninstall --name CLUSTER_NAME + +If both topo.yaml and name are specified, ptk will prefer to use topo.yaml. + +``` + +### Options + +``` + -h, --help help for uninstall + --name string Specify the cluster name to be uninstalled +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) - + +## ptk ls + +List MogDB clusters + +``` +ptk ls [flags] +``` + +### Options + +``` + -h, --help help for ls + -n, --only-name Only list cluster names +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) - + +## ptk start + +Start db instance or cluster + +``` +ptk start [flags] +``` + +### Options + +``` + -h, --help help for start + -H, --host string IP of host to be operated + --name string Cluster name + --security-mode string Whether start database with security mode + options: on/off + --time-out duration Maximum waiting time on starting (default 2m0s) +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk stop + +Stop db instance or cluster + +``` +ptk stop [flags] +``` + +### Options + +``` + -h, --help help for stop + -H, --host string IP of host to be operated + --mode string Shutdown mode + f: fast, i: immediate + --name string Cluster name + --time-out duration Maximum waiting time on stopping (default 2m0s) +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk restart + +Restart db instance or cluster + +``` +ptk restart [flags] +``` + +### Options + +``` + --azname string Name of available zone + -h, --help help for restart + -H, --host string IP of host to be operated + --mode string Shutdown mode + f: fast, i: immediate + --name string Cluster name + --security-mode string Whether start database with security mode + options: on/off + --time-out duration Maximum waiting time on starting (default 2m0s) +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk status + +Show status of db instance or cluster + +``` +ptk status [flags] +``` + +### Options + +``` + --detail Show detail status information + -h, --help help for status + -H, --host string IP of host to be operated + --name string Cluster name +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk env + +Print ptk environment information + +``` +ptk env [key1 key2 ... keyN] [flags] +``` + +### Options + +``` + -h, --help help for env +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk gen-xml + +Generate an XML file + +``` +ptk gen-xml [flags] +``` + +### Options + +``` + -h, --help help for gen-xml + -o, --output string Specify a output path if needed +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) + +## ptk self upgrade + +Download and install updates to ptk + +``` +ptk self upgrade [flags] +``` + +### Options + +``` + -h, --help help for upgrade +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk self](#ptk-self) - Modify the ptk installation + +## ptk self + +Modify the ptk installation + +### Options + +``` + -h, --help help for self +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) - +* [ptk self upgrade](#ptk-self-upgrade) - Download and install updates to ptk + +## ptk completion bash + +Generate the autocompletion script for bash + +### Synopsis + +Generate the autocompletion script for the bash shell. + +This script depends on the 'bash-completion' package. +If it is not installed already, you can install it via your OS's package manager. + +To load completions in your current shell session: + +``` +source <(ptk completion bash) +``` + +To load completions for every new session, execute once: + +#### Linux + +``` +ptk completion bash > /etc/bash_completion.d/ptk +``` + +#### macOS + +``` +ptk completion bash > /usr/local/etc/bash_completion.d/ptk +``` + +You will need to start a new shell for this setup to take effect. + +``` +ptk completion bash +``` + +### Options + +``` + -h, --help help for bash + --no-descriptions disable completion descriptions +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk completion](#ptk-completion) - Generate the autocompletion script for the specified shell + +## ptk completion zsh + +Generate the autocompletion script for zsh + +### Synopsis + +Generate the autocompletion script for the zsh shell. + +If shell completion is not already enabled in your environment you will need +to enable it. You can execute the following once: + +``` +echo "autoload -U compinit; compinit" >> ~/.zshrc +``` + +To load completions in your current shell session: + +``` +source <(ptk completion zsh); compdef _ptk ptk +``` + +To load completions for every new session, execute once: + +#### Linux + +``` +ptk completion zsh > "${fpath[1]}/_ptk" +``` + +#### macOS + +``` +ptk completion zsh > /usr/local/share/zsh/site-functions/_ptk +``` + +You will need to start a new shell for this setup to take effect. + +``` +ptk completion zsh [flags] +``` + +### Options + +``` + -h, --help help for zsh + --no-descriptions disable completion descriptions +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk completion](#ptk-completion) - Generate the autocompletion script for the specified shell + +## ptk completion fish + +Generate the autocompletion script for fish + +### Synopsis + +Generate the autocompletion script for the fish shell. + +To load completions in your current shell session: + +``` +ptk completion fish | source +``` + +To load completions for every new session, execute once: + +``` +ptk completion fish > ~/.config/fish/completions/ptk.fish +``` + +You will need to start a new shell for this setup to take effect. + +``` +ptk completion fish [flags] +``` + +### Options + +``` + -h, --help help for fish + --no-descriptions disable completion descriptions +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk completion](#ptk-completion) - Generate the autocompletion script for the specified shell + +## ptk completion powershell + +Generate the autocompletion script for powershell + +### Synopsis + +Generate the autocompletion script for powershell. + +To load completions in your current shell session: + +``` +ptk completion powershell | Out-String | Invoke-Expression +``` + +To load completions for every new session, add the output of the above command +to your powershell profile. + +``` +ptk completion powershell [flags] +``` + +### Options + +``` + -h, --help help for powershell + --no-descriptions disable completion descriptions +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk completion](#ptk-completion) - Generate the autocompletion script for the specified shell + +## ptk completion + +Generate the autocompletion script for the specified shell + +### Synopsis + +Generate the autocompletion script for ptk for the specified shell. +See each sub-command's help for details on how to use the generated script. + +### Options + +``` + -h, --help help for completion +``` + +### Options inherited from parent commands + +``` + -f, --file string Specify a configuration file of cluster + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` + +### SEE ALSO + +* [ptk](#ptk) - +* [ptk completion bash](#ptk-completion-bash) - Generate the autocompletion script for bash +* [ptk completion fish](#ptk-completion-fish) - Generate the autocompletion script for fish +* [ptk completion powershell](#ptk-completion-powershell) - Generate the autocompletion script for powershell +* [ptk completion zsh](#ptk-completion-zsh) - Generate the autocompletion script for zsh + +## ptk + +### Synopsis + +ptk is a command-line management tool that can help you to +deploy or manage MogDB clusters. + +``` +ptk [flags] [args...] +``` + +### Options + +``` + -f, --file string Specify a configuration file of cluster + -h, --help Help for ptk + --log-file string Specify a log output file + --log-format string Specify the log message format. Options: [text, json] (default "text") + --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") + -v, --version Print version of ptk +``` diff --git a/product/zh/docs-ptk/v0.1/config.md b/product/zh/docs-ptk/v0.1/config.md index 8a144c6a..96291843 100644 --- a/product/zh/docs-ptk/v0.1/config.md +++ b/product/zh/docs-ptk/v0.1/config.md @@ -64,10 +64,7 @@ global: user: omm # 运行数据库的操作系统用户名 group: omm # 运行数据库的操作系统用户组 db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # 数据库的初始用户密码,若配置文件中未填写,会在安装时通过交互式要求输入 - app_dir: /data/mogdb/app # 数据库部署文件、启动脚本和配置文件的存放路径 - data_dir: /data/mogdb/data # 数据库数据存储目录 - log_dir: /data/mogdb/log # 数据库运行日志和操作日志存储目录 - tool_dir: /data/mogdb/tool # 数据库工具目录 + base_dir: /opt/mogdb # 数据库安装的基础目录,如果 app_dir,data_dir,log_dir和tool_dir 参数中有未配置的,PTK 会自动在该目录下会创建对应的目录; # 集群内的数据库实例服务器配置信息 db_servers: - host: 10.1.1.100 # 数据库实例服务器 IP (仅支持 IPv4) @@ -127,10 +124,7 @@ global: user: omm # 运行数据库的操作系统用户名 group: omm # 运行数据库的操作系统用户组 db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # 数据库的初始用户密码,若配置文件中未填写,会在安装时通过交互式要求输入 - app_dir: /data/mogdb/app # 数据库部署文件、启动脚本和配置文件的存放路径 - data_dir: /data/mogdb/data # 数据库数据存储目录 - log_dir: /data/mogdb/log # 数据库运行日志和操作日志存储目录 - tool_dir: /data/mogdb/tool # 数据库工具目录 + base_dir: /opt/mogdb # 数据库安装的基础目录,如果 app_dir,data_dir,log_dir和tool_dir 参数中有未配置的,PTK 会自动在该目录下会创建对应的目录; ``` **新增于**: v0.1 @@ -216,10 +210,7 @@ cluster_name: CustomCluster # 集群名称,PTK管理的集群的唯一标识 user: omm # 运行数据库的操作系统用户名 group: omm # 运行数据库的操作系统用户组 db_password: pTk6MTIxOGMxOTk8QT1CPT4+PXlnYW1DdHpXb2hCX3c3UW0wWXVkNlZwMGRCakpxRXd1WWdwQ0xDUWVrb0U= # 数据库的初始用户密码,若配置文件中未填写,会在安装时通过交互式要求输入 -app_dir: /data/mogdb/app # 数据库部署文件、启动脚本和配置文件的存放路径 -data_dir: /data/mogdb/data # 数据库数据存储目录 -log_dir: /data/mogdb/log # 数据库运行日志和操作日志存储目录 -tool_dir: /data/mogdb/tool # 数据库工具目录 +base_dir: /opt/mogdb # 数据库安装的基础目录,如果 app_dir,data_dir,log_dir和tool_dir 参数中有未配置的,PTK 会自动在该目录下会创建对应的目录; ``` ### cluster_name @@ -302,6 +293,22 @@ db_port: 26000 **新增于**: v0.1 +### base_dir + +**类型**: string + +**描述**: 数据库安装的基础目录,如果 app_dir,data_dir,log_dir和tool_dir 参数中有未配置的,PTK 会自动在该目录下会创建对应的目录;
默认值: "/opt/mogdb" + +**示例**: + +- db base dir example + +```yaml +base_dir: /opt/mogdb +``` + +**新增于**: v0.1 + ### app_dir **类型**: string diff --git a/product/zh/docs-ptk/v0.1/install.md b/product/zh/docs-ptk/v0.1/install.md index 4f65a505..1ece7956 100644 --- a/product/zh/docs-ptk/v0.1/install.md +++ b/product/zh/docs-ptk/v0.1/install.md @@ -7,10 +7,12 @@ date: 2022-05-30 ## 安装 PTK +PTK 作为一个部署管理工具,并不需要和数据库实例安装到一起,我们推荐使用一个中控管理机器来安装PTK,然后通过该中控机去部署管理数据库实例到其他服务器。 + ### 在线安装 > 注意: -> 该方式目前不支持 Windows 系统 +> 命令行安装方式暂不支持 Windows 系统 PTK 的在线安装过程非常简单,无论是 MacOS 还是 Linux 系统,执行以下指令即可自动安装成功: diff --git a/product/zh/docs-ptk/v0.1/quick-start.md b/product/zh/docs-ptk/v0.1/quick-start.md new file mode 100644 index 00000000..8912deb7 --- /dev/null +++ b/product/zh/docs-ptk/v0.1/quick-start.md @@ -0,0 +1,121 @@ +--- +title: 快速上手 +summary: 快速上手 +author: Yao Qian +date: 2022-06-02 +--- + +## 快速上手 + +本文介绍如何快速使用PTK安装 MogDB 数据库。 + +> PTK工具本身可以在多种操作系统中运行,支持Linux,macOS,Windows,但是由于 MogDB 目前仅支持 在Linux 系统中运行,因此需确保要运行MogDB数据库的服务器为 Linux 操作系统。MogDB支持的Linux操作系统种类和版本参看[通过 PTK 支持安装 MogDB 的操作系统](./overview#通过-ptk-支持安装-mogdb-的操作系统)。 + +### 1. 下载并安装 PTK + +用户需使用 root 用户或具有 sudo 权限的用户进行一下操作 + +```shell +curl --proto '=https' --tlsv1.2 -sSf https://cdn-mogdb.enmotech.com/ptk/install.sh | sh +``` + +安装完成后会提示如下信息(根据运行PTK的 SHELL 类型不同,信息会有所差异) + +``` +info: downloading ptk package +Detected shell: bash +Shell profile: /root/.bashrc +ptk has been added to PATH in /root/.bashrc +open a new terminal or source /root/.bashrc to active it +Installed path: /root/.ptk/bin/ptk +``` + +可以通过提示的 source 指令或打开一个新的终端窗口来使 PTK PATH 环境变量生效。 + +以 bash 为例: + +```shell +source $HOME/.bashrc +``` + +### 2. 通过PTK安装MogDB + +#### 2.1 准备拓扑配置文件 + +PTK 安装需用户提供一个如下内容的配置文件 config.yaml + +```yaml +# config.yaml +global: + cluster_name: mogdb1 + user: omm + group: omm + base_dir: /opt/mogdb +db_servers: + - host: 127.0.0.1 + db_port: 26000 +``` + +如果全部使用默认值,则PTK 执行以下行为: + +* 在本机安装数据库 +* 运行数据库的操作系统用户为omm ,用户组名称也是omm,该用户没有默认密码; +* 数据库安装在 /opt/mogdb目录下,在该目录下会创建4个目录:app, data, log, tool,分别用于存储数据库软件、数据文件、数据库日志和数据库相关工具; +* 数据库监听端口为26000; + +如果需要在其它服务器上安装MogDB,或者是安装主备架构的MogDB,则需要在config.yaml中[配置更多信息](./config)。详细信息可参考 [使用手册](./usage)。 + +以下为安装一主一备环境的配置示例。 + +```yaml +# config.yaml +global: + cluster_name: mogdb_cluster1 + user: omm + group: omm + base_dir: /opt/mogdb +db_servers: + - host: 192.168.0.1 + db_port: 26000 + role: primary + ssh_option: + port: 22 + user: root + password: [此处填写SSH登录密码] + - host: 192.168.0.2 + db_port: 26000 + role: standby + ssh_option: + port: 22 + user: root + password: [此处填写SSH登录密码] +``` + +#### 2.2对本机进行系统检查 + +```shell +ptk checkos -f config.yaml +``` + +确保输出的检查结果均为 `OK` 或者 `Warning` ,如果有 `Abnormal` 出现,需用户根据日志提示先修正系统参数。 + +#### 2.3 执行安装 + +```shell +ptk install -f config.yaml +``` + +安装过程中会提示用户输入数据库初始用户的密码,请用户自行记录并安全保存。PTK 自动完成所有安装操作后,会启动数据库实例。 + +安装成功后,可以通过 `ptk ls` 来查看安装的实例信息。 + +### 3. 访问数据库 + +``` +$ su - omm +$ gsql -d postgres -p 26000 +``` + +## 探索更多 + +以上示例中的拓扑配置文件以最简化模板提供,方便用户快速体验 MogDB, 若想要更全面的描述集群拓扑,请访问[拓扑文件配置](./config)章节了解更多参数细节。 diff --git a/product/zh/docs-ptk/v0.1/toc.md b/product/zh/docs-ptk/v0.1/toc.md index 3f1f80eb..f211955f 100644 --- a/product/zh/docs-ptk/v0.1/toc.md +++ b/product/zh/docs-ptk/v0.1/toc.md @@ -5,9 +5,11 @@ ## PTK 文档目录 + [关于PTK](/overview.md) ++ [快速上手](/quick-start.md) + [软件安装](/install.md) -+ [快速上手](/usage.md) -+ [配置参数](/config.md) ++ [使用手册](/usage.md) ++ [拓扑文件配置](/config.md) ++ [PTK命令参考](/command.md) + [故障排查](/debug.md) + [FAQ](/faq.md) + [发布记录](/release.md) diff --git a/product/zh/docs-ptk/v0.1/usage.md b/product/zh/docs-ptk/v0.1/usage.md index e61837c3..31fa2e4b 100644 --- a/product/zh/docs-ptk/v0.1/usage.md +++ b/product/zh/docs-ptk/v0.1/usage.md @@ -1,11 +1,11 @@ --- -title: 快速上手 -summary: 快速上手 +title: 使用手册 +summary: 使用手册 author: Yao Qian date: 2022-05-30 --- -## 快速上手 +## 使用手册 当安装成功 PTK 以后,可以在终端运行 `ptk -h` 来查看帮助信息; @@ -136,7 +136,7 @@ PTK 的检查结果分为四个等级: 当有了配置文件,并且系统检查也都通过后,就可以开始数据库安装了。 -使用 PTK 安装数据库集群很简单,如果所有参数均使用默认值,安装仅需输入一下指即可: +使用 PTK 安装数据库集群很简单,安装仅需输入以下指令即可: ```shell $ ptk install -f config.yaml -y @@ -154,7 +154,7 @@ PTK 安装指令提供了 `--db-version` 参数,来允许用户指定要安装 更多选项: -- `-e|--env` : 环境变量将被添加到安装后的数据库系统用户的 **.bashrc** 文件中 +- `-e|--env` : 环境变量将被添加到安装后的数据库系统用户的环境变量中 - `--launch-db-timeout`: 启动数据库超时时间,默认 5 分钟。 - `--pre-run`: 支持添加安装前的一个钩子 shell 脚本路径,在集群安装前,自动在集群内所有机器上执行指定的脚本 - `--post-run`: 支持添加安装后的一个钩子 shell 脚本路径,在集群安装成功后,自动在集群内所有机器上执行指定的脚本 @@ -175,6 +175,8 @@ PTK 安装指令提供了 `--db-version` 参数,来允许用户指定要安装 在卸载前,PTK 会交互时的询问用户,以确认要删除的集群拓扑信息,确认是否要连带删除系统用户,以及确认是否要连带删除数据库数据。请在回答每一个问题时,确认你的回答,避免由于误操作导致不可恢复的数据丢失! +在 PTK 执行数据库卸载操作时,如果用户指定了删除数据目录,PTK 仅会删除数据目录,不会删除数据目录所在的父目录,需用户手动清理父目录。 + ## 数据库集群管理 ### 查看集群列表 diff --git a/scripts/build_pdf.sh b/scripts/build_pdf.sh index 83616ab9..96a7d870 100755 --- a/scripts/build_pdf.sh +++ b/scripts/build_pdf.sh @@ -433,7 +433,7 @@ Optnum=$# # NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this # separately; see below. -TEMP=$(getopt -o h,u --long help,mtk,sca,mvd,nobuild,mogha,mogdb,manager,upload,tex \ +TEMP=$(getopt -o h,u --long help,mtk,sca,mvd,nobuild,mogha,mogdb,manager,ptk,upload,tex \ -n 'buld_pdf' -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi -- Gitee