未验证 提交 a52cc3c9 编写于 作者: R Rongfeng Fu 提交者: GitHub

update docs (#141)

* update docs

* init obd developer environment
上级 bacf661a
# OceanBase Deployer
<!--
#
# OceanBase Deploy.
# Copyright (C) 2021 OceanBase
#
# This file is part of OceanBase Deploy.
#
# OceanBase Deploy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OceanBase Deploy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OceanBase Deploy. If not, see <https://www.gnu.org/licenses/>.
#
-->
<!-- TODO: some badges here -->
OceanBase Deployer(简称 OBD)是 OceanBase 开源软件的安装部署工具。OBD 同时也是包管理器,可以用来管理 OceanBase 所有的开源软件。本文介绍如何安装 OBD、使用 OBD 和 OBD 的命令。
## 安装 OBD
......@@ -25,66 +49,44 @@ source /etc/profile.d/obd.sh
- openssl-devel
- xz-devel
- mysql-devel
- pip
- pyinstaller
> **说明**
>
> 您可以参考如下命令在拥有 Python2.7 或 Python3.8 的环境中安装 pip:
>
> ```shell
> curl -o get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py # 针对 Python2.7 环境
> curl -o get-pip.py https://bootstrap.pypa.io/get-pip.py # 针对 Python3.8 环境
> sudo python get-pip.py
> ```
>
> 然后使用如下 pip 命令安装 pyinstaller:
>
> ```shell
> sudo pip install pyinstaller==3.6
> ```
Python2.7 使用以下命令安装:
```shell
sh rpm/build.sh build
source /etc/profile.d/obd.sh
```
Python3.8 使用以下命令安装:
首先Python 2.7 环境下执行以下命令:
首先请先使用Python 2.7 环境下执行以下命令:
```shell
# 这一步是为了编译observer升级所需的解释器。如果不使用升级功能可以不执行该步骤
sh rpm/build.sh executer
```
然后Python3.8 环境执行以下命令:
然后再在Python3.8 环境执行以下命令:
```shell
rpm/build.sh build_obd
sh rpm/build.sh build_obd
source /etc/profile.d/obd.sh
```
## 快速启动 OceanBase 数据库
安装 OBD 后,您可以使用 root 用户执行这组命令快速启动本地单节点 OceanBase 数据库。
在此之前您需要确认以下信息:
安装 OBD 后,您可执行 `obd demo` 命令快速启动本地单节点 OceanBase 数据库。在此之前您需要确认以下信息:
* `2881``2882` 端口没有被占用。
- 当前用户为 root。
- `2882``2883` 端口没有被占用。
- 您的机器内存应该不低于 8 G。
- 您的机器 CPU 数目应该不低于 2。
* 机器可用内存不低于 `6 G`
> **说明:** 如果以上条件不满足,请参考[使用 OBD 启动 OceanBase 数据库集群](./docs/zh-CN/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md)
* 机器 CPU 数目不低于 `2`
> **注意:** 此处为了方便使用 root,OBD 和 OceanBase 数据库没有对运行用户做出任何限制,我们不建议生产中直接使用 root。
* 机器可用磁盘空间不小于 `54 G`
> **说明**
>
> 如果以上条件不满足,您可参考文档 [使用 OBD 启动 OceanBase 数据库集群](../3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md)。
```shell
obd cluster deploy c1 -c ./example/mini-local-example.yaml
obd cluster start c1
# 使用 mysql 客户端链接到到 OceanBase 数据库。
mysql -h127.1 -uroot -P2883
# 部署并启动 OceanBase 数据库
obd demo
# 使用 OBClient 客户端连接到 OceanBase 数据库。
obclient -h127.0.0.1 -uroot -P2881
```
## 使用 OBD 启动 OceanBase 数据库集群
......
# OceanBase Deployer
<!--
#
# OceanBase Deploy.
# Copyright (C) 2021 OceanBase
#
# This file is part of OceanBase Deploy.
#
# OceanBase Deploy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OceanBase Deploy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OceanBase Deploy. If not, see <https://www.gnu.org/licenses/>.
#
-->
<!-- TODO: some badges here -->
OceanBase Deployer (OBD) is an installation and deployment tool for open-source OceanBase software. It is also a package manager for managing all open-source OceanBase software. This topic describes how to install OBD, how to use OBD, and OBD commands.
## Install OBD
......@@ -25,42 +49,12 @@ Before you install OBD by using the source code, make sure that you have install
- openssl-devel
- xz-devel
- mysql-devel
- pip
- pyinstaller
> Notes:
>
> You can install pip for Python2.7 or Python3.8 refer below cmd:
>
> ```shell
> curl -o get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py # for Python2.7
> curl -o get-pip.py https://bootstrap.pypa.io/get-pip.py # for Python3.8
> sudo python get-pip.py
> ```
>
> then install pyinstaller as below:
>
> ```shell
> sudo pip install pyinstaller==3.6
> ```
To install OBD on Python2.7, run these commands:
```shell
sh rpm/build.sh build
source /etc/profile.d/obd.sh
```
To install OBD on Python3.8, run these commands on Python2.7 first:
To install OBD on Python3.8, run these commands:
```shell
sh rpm/build.sh executer
```
Then run these commands on Python3.8:
```shell
sh rpm/build.sh build_obd
pip install -r requirements3.txt
sh build.sh build_obd
source /etc/profile.d/obd.sh
```
......@@ -136,7 +130,3 @@ A:You can use the `obd update` command to update OBD. When you are done with t
## Protocol
OBD complies with [GPL-3.0](/LICENSE).
## TPC-C
- [Run TPC-C benchmark test on OceanBase](https://github.com/oceanbase/oceanbase-doc/blob/V3.1.4/en-US/1.Get-Started/5.Experience-OceanBase-Advanced-Features/1.Experience-Scalable-OLTP/1.Run-the-TPC-C-benchmark-test-in-OceanBase-Database.md)
......@@ -86,7 +86,7 @@ obd test sysbench <deploy name> [flags]
| --events | No | int | 0 | The maximum number of requests. If this option is specified, the --time option is not needed. |
| --rand-type | No | string | | The random number generation function used for data access. Valid values: special, uniform, gaussian, and pareto. Default value: special, early value: uniform. |
| ---skip-trx | No | string | | Specifies whether to enable or disable a transaction in a read-only test. |
| -O/--optimization | No | int | 1 | Auto tuning level. Off when 0. |
| -O/--optimization | No | int | 1 | The degree of auto-tuning. Valid values: `0`, `1`, and `2`. `0` indicates that auto-tuning is disabled. `1` indicates that the auto-tuning parameters that take effect without a cluster restart are modified. `2` indicates that all auto-tuning parameters are modified. If necessary, the cluster is restarted to make all parameters take effect. |
## `obd test tpch`
......
......@@ -8,6 +8,8 @@
* 机器 CPU 数目不低于 `2`
* 机器可用磁盘空间不小于 `54 G`
> **说明**
>
> 如果以上条件不满足,您可参考文档 [使用 OBD 启动 OceanBase 数据库集群](../3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md)。
......
......@@ -93,7 +93,7 @@ obd test sysbench <deploy name> [flags]
| --events | 否 | int | 0 | 最大请求数量,定义数量后可以不需要 `--time` 选项。 |
| --rand-type | 否 | string | 空 | 访问数据时使用的随机生成函数。取值可以为 special、uniform、gaussian 或 pareto。默认值为 `special`, 早期值为 `uniform`。 |
| ---skip-trx | 否 | string | 空 | 在只读测试中打开或关闭事务。 |
| -O/--optimization | 否 | int | 1 | 自动调优等级。为 `0` 时关闭。 |
| -O/--optimization | 否 | int | 1 | 自动调优等级。为 `0` 时关闭。为 `1` 时会修改不需要重启生效的调优参数。为 `2` 时会修改所有的调优参数,如果需要,会重启集群使调优生效。 |
## obd test tpch
......
#!/bin/bash
echo "============prepare work env start============"
if [[ $# == 1 && $1 == "-f" ]]; then
FORCE_DEPLOY="1"
else
FORCE_DEPLOY="0"
fi
WORK_DIR=$(readlink -f "$(dirname ${BASH_SOURCE[0]})")
if [ ${OBD_HOME} ]; then
OBD_HOME=${OBD_HOME}
else
OBD_HOME="${HOME}/.obd"
fi
if [ ${FORCE_DEPLOY} == "1" ]; then
rm -rf ${OBD_HOME}/config_parser
rm -rf ${OBD_HOME}/optimize
rm -rf ${OBD_HOME}/plugins
sudo rm -rf /etc/profile.d/obd.sh
fi
if [ ! -e /etc/profile.d/obd.sh ]; then
sudo ln -s ${WORK_DIR}/profile/obd.sh /etc/profile.d/obd.sh
fi
mkdir -p ${OBD_HOME} && cd ${OBD_HOME}
mkdir -p mirror/remote && cd mirror/remote
if [ ! -e "OceanBase.repo" ]; then
wget -q https://mirrors.aliyun.com/oceanbase/OceanBase.repo
fi
mkdir -p ${OBD_HOME}/{plugins,optimize,config_parser}
mkdir -p ${OBD_HOME}/plugins/obproxy-ce/3.1.0
for DIR in ${WORK_DIR}/plugins/obproxy-ce/3.1.0/ ${WORK_DIR}/plugins/obproxy/3.1.0/; do
FILE_LIST=$(ls $DIR)
for FILE in $FILE_LIST; do
if [ ! -e "${OBD_HOME}/plugins/obproxy-ce/3.1.0/${FILE}" ]; then
ln -s ${DIR}/${FILE} ${OBD_HOME}/plugins/obproxy-ce/3.1.0/${FILE}
fi
done
done
for DIR in plugins optimize config_parser; do
FILE_LIST=$(ls ${WORK_DIR}/${DIR})
for FILE in $FILE_LIST; do
if [ ! -e "${OBD_HOME}/${DIR}/${FILE}" ]; then
ln -s ${WORK_DIR}/${DIR}/${FILE} ${OBD_HOME}/${DIR}/${FILE}
fi
done
done
if [ ! -e ${OBD_HOME}/optimize/obproxy-ce ]; then
ln -s ${OBD_HOME}/optimize/obproxy ${OBD_HOME}/optimize/obproxy-ce
fi
for DIR in plugins config_parser; do
if [ ! -e ${OBD_HOME}/${DIR}/oceanbase-ce ]; then
ln -s ${OBD_HOME}/${DIR}/oceanbase ${OBD_HOME}/${DIR}/oceanbase-ce
fi
done
echo "============update .bashrc============"
ALIAS_OBD_EXIST=$(cat ~/.bashrc | grep "alias obd=" | head -n 1)
if [[ "${ALIAS_OBD_EXIST}" != "" ]]; then
echo "need update obd alias"
fi
echo "alias obd='python ${WORK_DIR}/_cmd.py'" >>~/.bashrc
echo -e "if [ -d ${WORK_DIR} ]\nthen\n source ${WORK_DIR}/profile/obd.sh\nfi" >>~/.bashrc
echo "Please enter ob-deploy dir and install python requirements by 'pip install -r requirements.txt' when your python version is '2.x' and replace requirements.txt with requirements3.txt when your python version is '3.x'"
echo "============prepare work env ok!============"
......@@ -133,10 +133,10 @@ function build()
rm -fr /usr/obd /usr/bin/obd
cp ./dist/obd /usr/bin/obd
cp -fr ./profile/* /etc/profile.d/
mv $BUILD_DIR /usr/obd
rm -fr dist
cd $BUILD_DIR/plugins && ln -s oceanbase oceanbase-ce && cp -rf obproxy/3.1.0 obproxy-ce/ && cp -rf $DIR/plugins/obproxy-ce/* obproxy-ce/
cd $BUILD_DIR/config_parser && ln -s oceanbase oceanbase-ce
mv $BUILD_DIR /usr/obd
chmod +x /usr/bin/obd
chmod -R 755 /usr/obd/*
chown -R root:root /usr/obd/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册