...
 
Commits (2)
    https://gitcode.net/oceanbase/obdeploy/-/commit/a52cc3c95dd8f93740827d4171922b8ffd57efff update docs (#141) 2022-11-11T14:49:29+08:00 Rongfeng Fu rongfeng.frf@antgroup.com * update docs * init obd developer environment https://gitcode.net/oceanbase/obdeploy/-/commit/1530c14364f35ffae7916c2a86ee1b70cccafdee update docs (#142) 2022-11-11T15:06:31+08:00 Rongfeng Fu rongfeng.frf@antgroup.com * update docs * init obd developer environment * update en docs
# 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,64 +49,36 @@ 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:
To install OBD on Python3.8, run these commands:
```shell
sh rpm/build.sh build
pip install -r requirements3.txt
sh build.sh build_obd
source /etc/profile.d/obd.sh
```
To install OBD on Python3.8, run these commands on Python2.7 first:
```shell
sh rpm/build.sh executer
```
Then run these commands on Python3.8:
## Start an OceanBase cluster
```shell
sh rpm/build.sh build_obd
source /etc/profile.d/obd.sh
```
After you deploy OceanBase Deployer (OBD), you can run the `obd demo` command to deploy and start OceanBase Database on a single local server. Make sure the following prerequisites are met:
## Start an OceanBase cluster
- Ports `2881` and `2882` are not occupied.
After you install OBD, you can run these commands as the root user to start a local single-node OceanBase cluster.
Before you run the commands, make sure that these conditions are met:
- At least 6 GB of memory is available on the server.
- You have logged on as the root user.
- Ports `2882` and `2883` are available.
- Your server has at least 8 GB of memory.
- Your server has at least 2 CPU cores.
- At least two CPU cores are available on the server.
> **NOTE:** If the preceding conditions are not met, see [Use OBD to start an OceanBase cluster](./docs/en-US/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md).
- At least 54 GB of disk space is available on the server.
> **NOTE:** For the convenience of using root here, OBD and OceanBase database do not have any restrictions on running users. We do not recommend that you use root in production.
> **Note**
>
> If the foregoing prerequisites are not met, see [Use OBD to start an OceanBase cluster](../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
# Connect to the OceanBase Database by using a MySQL client.
mysql -h127.1 -uroot -P2883
# Deploy and start OceanBase Database.
obd demo
# Run the following command to connect to OceanBase Database by using the OBClient:
obclient -h127.0.0.1 -uroot -P2881
```
## Use OBD to start an OceanBase cluster
......@@ -136,7 +132,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)
# Start an OceanBase cluster
After you install OBD, you can run these commands as the root user to start a local single-node OceanBase cluster.
Before you run the commands, make sure that these conditions are met:
After you deploy OceanBase Deployer (OBD), you can run the `obd demo` command to deploy and start OceanBase Database on a single local server. Make sure the following prerequisites are met:
- You have logged on as the root user.
- Ports `2882` and `2883` are available.
- Your server has at least 8 GB of memory.
- Your server has at least 2 CPU cores.
- Ports `2881` and `2882` are not occupied.
> **NOTE:** If the preceding conditions are not met, see [Use OBD to start an OceanBase cluster](../3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md).
- At least 6 GB of memory is available on the server.
> **NOTE:** For the convenience of using root here, OBD and OceanBase database do not have any restrictions on running users. We do not recommend that you use root in production.
- At least two CPU cores are available on the server.
- At least 54 GB of disk space is available on the server.
> **Note**
>
> If the foregoing prerequisites are not met, see [Use OBD to start an OceanBase cluster](../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
# Connect to the OceanBase Database by using a MySQL client.
mysql -h127.1 -uroot -P2883
# Deploy and start OceanBase Database.
obd demo
# Run the following command to connect to OceanBase Database by using the OBClient:
obclient -h127.0.0.1 -uroot -P2881
```
......@@ -66,6 +66,8 @@ obd test sysbench <deploy name> [flags]
`deploy name` specifies the name of the deployment configuration file.
This table describes the corresponding options.
| Option | Required | Data type | Default value | Description |
--- | --- | --- |--- | ---
| -c/--component | No | string | | The name of the component to be tested. Valid values: `oceanbase-ce`, `oceanbase`, `obproxy-ce` and `obproxy`. If you do not specify a value, the existence of `obproxy`, `obproxy-ce`, `oceanbase`, `oceanbase-ce` is checked sequentially. The traversal stops when a component is found, and the component is then tested. |
......@@ -83,10 +85,11 @@ obd test sysbench <deploy name> [flags]
| --threads | No | int | 16 | The number of threads to be started. |
| --time | No | int | 60 | The running duration. When this option is set to 0, the running duration is not limited. |
| --interval | No | int | 10 | The logging interval, in seconds. |
| --mysql-ignore-errors | No | String | 1062 | The error code to be ignored. Separate multiple error codes with commas (,). The value `all` indicates to ignore all errors. |
| --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`
......
......@@ -48,9 +48,9 @@ obd mirror clone ob-deploy-x.x.x-xxx.rpm
obd mirror disable remote
```
## QHow to update OBD?
## Q: How to update OBD?
AThere are two ways to update your OBD, which you can choose from depending on your situation:
A: There are two ways to update your OBD, which you can choose from depending on your situation:
+ If your machine can connect to the public network or have the RPM package for the updated OBD in the mirror you configured, you can directly use the `obd update` command to update the OBD. When you finish with the update, use the `obd --version` command to check the version of OBD and confirm whether the update is successful.
+ If your machine cannot connect to the public network and there is no RPM package for the updated OBD in the mirror you configured. Please add the RPM package that used to update OBD to the local mirror via `obd mirror clone` command first, and then use the `obd update` command to update the OBD.
......
......@@ -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/*
......