Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use script to set node env #3142

Merged
merged 6 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/en/deploy/install_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ $ cat /sys/kernel/mm/transparent_hugepage/defrag
always madvise [never]
```

Note: You can also use the script to modify the above configurations, refer [here](#configure-node-environment-optional)

### Time and zone settings

The OpenMLDB data expiration deletion mechanism relies on the system clock. If the system clock is incorrect, the expired data will not be deleted or the data that has not expired will be deleted.
Expand Down Expand Up @@ -231,6 +233,15 @@ default values are used, which are defined in `conf/openmldb-env.sh`.
If multiple TaskManager instances are deployed in different machines,the `offline.data.prefix` should be configured to be globally accessabile by these machines (e.g., hdfs path).
```

### Configure Node Environment (Optional)
```
bash sbin/init_env.sh
```
Note:
- The script needs to be executed by the `root` user.
- The script will modify the `limit`, disable the `swap` and `THP`.


### Deployment
```bash
sbin/deploy-all.sh
Expand Down
10 changes: 10 additions & 0 deletions docs/zh/deploy/install_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ $ cat /sys/kernel/mm/transparent_hugepage/defrag
always madvise [never]
```

注:以上三项也可以通过脚本一键修改,参考[修改机器环境配置](#修改机器环境配置-可选)

### 时间和时区设置

OpenMLDB 数据过期删除机制依赖于系统时钟, 如果系统时钟不正确会导致过期数据没有删掉或者删掉了没有过期的数据。
Expand Down Expand Up @@ -221,6 +223,14 @@ node3:2181:2888:3888 /tmp/openmldb/zk-1
如果在不同机器上部署多个 TaskManager,其 `offline.data.prefix` 配置的路径,这些机器必须可以访问,建议配置hdfs路径。
```

### 修改机器环境配置 (可选)
```
bash sbin/init_env.sh
```
说明:
- 需要用root用户执行此脚本。执行其他脚本不需要root
- 此脚本只修改limit配置,关闭swap和关闭THP

### 部署

```bash
Expand Down
47 changes: 47 additions & 0 deletions release/sbin/init_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#! /usr/bin/env bash
# shellcheck disable=SC1091

# Copyright 2021 4Paradigm
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

user=$(whoami)
if [[ ${user} != "root" ]]; then
echo "please switch to 'root' user to run this script"
exit
fi

home="$(cd "$(dirname "$0")"/.. || exit 1; pwd)"
sbin="$(cd "$(dirname "$0")" || exit 1; pwd)"
. "$home"/conf/openmldb-env.sh
. "$sbin"/init.sh
cd "$home" || exit 1

old_IFS="$IFS"
IFS=$'\n'
for host in $(parse_host conf/hosts tablet | awk -F ' ' '{print $1}' | xargs -n 1 | sort | uniq)
do
limit_conf_file="/etc/security/limits.conf"
run_auto "$host" "echo '* soft core unlimited' >> ${limit_conf_file}"
run_auto "$host" "echo '* hard core unlimited' >> ${limit_conf_file}"
run_auto "$host" "echo '* soft nofile 655360' >> ${limit_conf_file}"
run_auto "$host" "echo '* hard nofile 655360' >> ${limit_conf_file}"

# disable swap
run_auto "$host" "swapoff -a"

# disable THP (Transparent Huge Pages)
run_auto "$host" "echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled"
run_auto "$host" "echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag"
done
IFS="$old_IFS"