Skip to content

Commit a52cc3c

Browse files
authored
update docs (#141)
* update docs * init obd developer environment
1 parent bacf661 commit a52cc3c

File tree

7 files changed

+155
-80
lines changed

7 files changed

+155
-80
lines changed

README-CN.md

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# OceanBase Deployer
22

3+
<!--
4+
#
5+
# OceanBase Deploy.
6+
# Copyright (C) 2021 OceanBase
7+
#
8+
# This file is part of OceanBase Deploy.
9+
#
10+
# OceanBase Deploy is free software: you can redistribute it and/or modify
11+
# it under the terms of the GNU General Public License as published by
12+
# the Free Software Foundation, either version 3 of the License, or
13+
# (at your option) any later version.
14+
#
15+
# OceanBase Deploy is distributed in the hope that it will be useful,
16+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
# GNU General Public License for more details.
19+
#
20+
# You should have received a copy of the GNU General Public License
21+
# along with OceanBase Deploy. If not, see <https://www.gnu.org/licenses/>.
22+
#
23+
-->
24+
25+
<!-- TODO: some badges here -->
26+
327
OceanBase Deployer(简称 OBD)是 OceanBase 开源软件的安装部署工具。OBD 同时也是包管理器,可以用来管理 OceanBase 所有的开源软件。本文介绍如何安装 OBD、使用 OBD 和 OBD 的命令。
428

529
## 安装 OBD
@@ -25,66 +49,44 @@ source /etc/profile.d/obd.sh
2549
- openssl-devel
2650
- xz-devel
2751
- mysql-devel
28-
- pip
29-
- pyinstaller
30-
31-
> **说明**
32-
>
33-
> 您可以参考如下命令在拥有 Python2.7 或 Python3.8 的环境中安装 pip:
34-
>
35-
> ```shell
36-
> curl -o get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py # 针对 Python2.7 环境
37-
> curl -o get-pip.py https://bootstrap.pypa.io/get-pip.py # 针对 Python3.8 环境
38-
> sudo python get-pip.py
39-
> ```
40-
>
41-
> 然后使用如下 pip 命令安装 pyinstaller:
42-
>
43-
> ```shell
44-
> sudo pip install pyinstaller==3.6
45-
> ```
46-
47-
Python2.7 使用以下命令安装:
48-
49-
```shell
50-
sh rpm/build.sh build
51-
source /etc/profile.d/obd.sh
52-
```
5352

5453
Python3.8 使用以下命令安装:
5554

56-
首先在 Python 2.7 环境下执行以下命令:
55+
首先请先使用Python 2.7 环境下执行以下命令:
5756

5857
```shell
58+
# 这一步是为了编译observer升级所需的解释器。如果不使用升级功能可以不执行该步骤
5959
sh rpm/build.sh executer
6060
```
6161

62-
然后在 Python3.8 环境执行以下命令:
62+
然后再在Python3.8 环境执行以下命令:
6363

6464
```shell
65-
rpm/build.sh build_obd
65+
sh rpm/build.sh build_obd
6666
source /etc/profile.d/obd.sh
6767
```
6868

6969
## 快速启动 OceanBase 数据库
7070

71-
安装 OBD 后,您可以使用 root 用户执行这组命令快速启动本地单节点 OceanBase 数据库。
72-
在此之前您需要确认以下信息:
71+
安装 OBD 后,您可执行 `obd demo` 命令快速启动本地单节点 OceanBase 数据库。在此之前您需要确认以下信息:
72+
73+
* `2881``2882` 端口没有被占用。
7374

74-
- 当前用户为 root。
75-
- `2882``2883` 端口没有被占用。
76-
- 您的机器内存应该不低于 8 G。
77-
- 您的机器 CPU 数目应该不低于 2。
75+
* 机器可用内存不低于 `6 G`
7876

79-
> **说明:** 如果以上条件不满足,请参考[使用 OBD 启动 OceanBase 数据库集群](./docs/zh-CN/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md)
77+
* 机器 CPU 数目不低于 `2`
8078

81-
> **注意:** 此处为了方便使用 root,OBD 和 OceanBase 数据库没有对运行用户做出任何限制,我们不建议生产中直接使用 root。
79+
* 机器可用磁盘空间不小于 `54 G`
80+
81+
> **说明**
82+
>
83+
> 如果以上条件不满足,您可参考文档 [使用 OBD 启动 OceanBase 数据库集群](../3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md)
8284
8385
```shell
84-
obd cluster deploy c1 -c ./example/mini-local-example.yaml
85-
obd cluster start c1
86-
# 使用 mysql 客户端链接到到 OceanBase 数据库。
87-
mysql -h127.1 -uroot -P2883
86+
# 部署并启动 OceanBase 数据库
87+
obd demo
88+
# 使用 OBClient 客户端连接到 OceanBase 数据库。
89+
obclient -h127.0.0.1 -uroot -P2881
8890
```
8991

9092
## 使用 OBD 启动 OceanBase 数据库集群

README.md

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# OceanBase Deployer
22

3+
<!--
4+
#
5+
# OceanBase Deploy.
6+
# Copyright (C) 2021 OceanBase
7+
#
8+
# This file is part of OceanBase Deploy.
9+
#
10+
# OceanBase Deploy is free software: you can redistribute it and/or modify
11+
# it under the terms of the GNU General Public License as published by
12+
# the Free Software Foundation, either version 3 of the License, or
13+
# (at your option) any later version.
14+
#
15+
# OceanBase Deploy is distributed in the hope that it will be useful,
16+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
# GNU General Public License for more details.
19+
#
20+
# You should have received a copy of the GNU General Public License
21+
# along with OceanBase Deploy. If not, see <https://www.gnu.org/licenses/>.
22+
#
23+
-->
24+
25+
<!-- TODO: some badges here -->
26+
327
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.
428

529
## Install OBD
@@ -25,42 +49,12 @@ Before you install OBD by using the source code, make sure that you have install
2549
- openssl-devel
2650
- xz-devel
2751
- mysql-devel
28-
- pip
29-
- pyinstaller
30-
31-
> Notes:
32-
>
33-
> You can install pip for Python2.7 or Python3.8 refer below cmd:
34-
>
35-
> ```shell
36-
> curl -o get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py # for Python2.7
37-
> curl -o get-pip.py https://bootstrap.pypa.io/get-pip.py # for Python3.8
38-
> sudo python get-pip.py
39-
> ```
40-
>
41-
> then install pyinstaller as below:
42-
>
43-
> ```shell
44-
> sudo pip install pyinstaller==3.6
45-
> ```
46-
47-
To install OBD on Python2.7, run these commands:
48-
49-
```shell
50-
sh rpm/build.sh build
51-
source /etc/profile.d/obd.sh
52-
```
5352

54-
To install OBD on Python3.8, run these commands on Python2.7 first:
53+
To install OBD on Python3.8, run these commands:
5554

5655
```shell
57-
sh rpm/build.sh executer
58-
```
59-
60-
Then run these commands on Python3.8:
61-
62-
```shell
63-
sh rpm/build.sh build_obd
56+
pip install -r requirements3.txt
57+
sh build.sh build_obd
6458
source /etc/profile.d/obd.sh
6559
```
6660

@@ -136,7 +130,3 @@ A:You can use the `obd update` command to update OBD. When you are done with t
136130
## Protocol
137131

138132
OBD complies with [GPL-3.0](/LICENSE).
139-
140-
## TPC-C
141-
142-
- [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)

docs/en-US/3.user-guide/3.obd-command/3.test-command-group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ obd test sysbench <deploy name> [flags]
8686
| --events | No | int | 0 | The maximum number of requests. If this option is specified, the --time option is not needed. |
8787
| --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. |
8888
| ---skip-trx | No | string | | Specifies whether to enable or disable a transaction in a read-only test. |
89-
| -O/--optimization | No | int | 1 | Auto tuning level. Off when 0. |
89+
| -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. |
9090

9191
## `obd test tpch`
9292

docs/zh-CN/3.user-guide/1.quickly-start-the-oceanbase-database.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
* 机器 CPU 数目不低于 `2`
1010

11+
* 机器可用磁盘空间不小于 `54 G`
12+
1113
> **说明**
1214
>
1315
> 如果以上条件不满足,您可参考文档 [使用 OBD 启动 OceanBase 数据库集群](../3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md)

docs/zh-CN/3.user-guide/3.obd-command/3.test-command-group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ obd test sysbench <deploy name> [flags]
9393
| --events || int | 0 | 最大请求数量,定义数量后可以不需要 `--time` 选项。 |
9494
| --rand-type || string || 访问数据时使用的随机生成函数。取值可以为 special、uniform、gaussian 或 pareto。默认值为 `special`, 早期值为 `uniform`|
9595
| ---skip-trx || string || 在只读测试中打开或关闭事务。 |
96-
| -O/--optimization || int | 1 | 自动调优等级。为 `0` 时关闭。 |
96+
| -O/--optimization || int | 1 | 自动调优等级。为 `0` 时关闭。`1` 时会修改不需要重启生效的调优参数。为 `2` 时会修改所有的调优参数,如果需要,会重启集群使调优生效。 |
9797

9898
## obd test tpch
9999

init.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
echo "============prepare work env start============"
3+
4+
if [[ $# == 1 && $1 == "-f" ]]; then
5+
FORCE_DEPLOY="1"
6+
else
7+
FORCE_DEPLOY="0"
8+
fi
9+
10+
WORK_DIR=$(readlink -f "$(dirname ${BASH_SOURCE[0]})")
11+
12+
if [ ${OBD_HOME} ]; then
13+
OBD_HOME=${OBD_HOME}
14+
else
15+
OBD_HOME="${HOME}/.obd"
16+
fi
17+
18+
if [ ${FORCE_DEPLOY} == "1" ]; then
19+
rm -rf ${OBD_HOME}/config_parser
20+
rm -rf ${OBD_HOME}/optimize
21+
rm -rf ${OBD_HOME}/plugins
22+
sudo rm -rf /etc/profile.d/obd.sh
23+
fi
24+
25+
if [ ! -e /etc/profile.d/obd.sh ]; then
26+
sudo ln -s ${WORK_DIR}/profile/obd.sh /etc/profile.d/obd.sh
27+
fi
28+
29+
mkdir -p ${OBD_HOME} && cd ${OBD_HOME}
30+
mkdir -p mirror/remote && cd mirror/remote
31+
32+
if [ ! -e "OceanBase.repo" ]; then
33+
wget -q https://mirrors.aliyun.com/oceanbase/OceanBase.repo
34+
fi
35+
36+
mkdir -p ${OBD_HOME}/{plugins,optimize,config_parser}
37+
38+
mkdir -p ${OBD_HOME}/plugins/obproxy-ce/3.1.0
39+
40+
for DIR in ${WORK_DIR}/plugins/obproxy-ce/3.1.0/ ${WORK_DIR}/plugins/obproxy/3.1.0/; do
41+
FILE_LIST=$(ls $DIR)
42+
for FILE in $FILE_LIST; do
43+
if [ ! -e "${OBD_HOME}/plugins/obproxy-ce/3.1.0/${FILE}" ]; then
44+
ln -s ${DIR}/${FILE} ${OBD_HOME}/plugins/obproxy-ce/3.1.0/${FILE}
45+
fi
46+
done
47+
done
48+
49+
for DIR in plugins optimize config_parser; do
50+
FILE_LIST=$(ls ${WORK_DIR}/${DIR})
51+
for FILE in $FILE_LIST; do
52+
if [ ! -e "${OBD_HOME}/${DIR}/${FILE}" ]; then
53+
ln -s ${WORK_DIR}/${DIR}/${FILE} ${OBD_HOME}/${DIR}/${FILE}
54+
fi
55+
done
56+
done
57+
58+
if [ ! -e ${OBD_HOME}/optimize/obproxy-ce ]; then
59+
ln -s ${OBD_HOME}/optimize/obproxy ${OBD_HOME}/optimize/obproxy-ce
60+
fi
61+
62+
for DIR in plugins config_parser; do
63+
if [ ! -e ${OBD_HOME}/${DIR}/oceanbase-ce ]; then
64+
ln -s ${OBD_HOME}/${DIR}/oceanbase ${OBD_HOME}/${DIR}/oceanbase-ce
65+
fi
66+
done
67+
68+
echo "============update .bashrc============"
69+
70+
ALIAS_OBD_EXIST=$(cat ~/.bashrc | grep "alias obd=" | head -n 1)
71+
72+
if [[ "${ALIAS_OBD_EXIST}" != "" ]]; then
73+
echo "need update obd alias"
74+
fi
75+
76+
echo "alias obd='python ${WORK_DIR}/_cmd.py'" >>~/.bashrc
77+
echo -e "if [ -d ${WORK_DIR} ]\nthen\n source ${WORK_DIR}/profile/obd.sh\nfi" >>~/.bashrc
78+
79+
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'"
80+
81+
echo "============prepare work env ok!============"

rpm/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ function build()
133133
rm -fr /usr/obd /usr/bin/obd
134134
cp ./dist/obd /usr/bin/obd
135135
cp -fr ./profile/* /etc/profile.d/
136-
mv $BUILD_DIR /usr/obd
137136
rm -fr dist
138137
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/
139138
cd $BUILD_DIR/config_parser && ln -s oceanbase oceanbase-ce
139+
mv $BUILD_DIR /usr/obd
140140
chmod +x /usr/bin/obd
141141
chmod -R 755 /usr/obd/*
142142
chown -R root:root /usr/obd/*

0 commit comments

Comments
 (0)