跳到主要内容
版本:v3&v6

开启/关闭 数据收集

控制数据收集服务开启/关闭

配置参数

配置项类型示例描述
reportDataForBIEnablebooleantrue控制组件开启/关闭
onesDataCollectorReportPowerSwitchbooleantrue上报开关,控制是否将数据发送到云端

操作步骤

ONES 配置 开启日志上报服务

修改配置

进入运行中的 ones 容器

ones-ai-k8s.sh

修改配置

vim config/private.yaml

如果打开的文件中有名为 reportDataForBIEnable 的 key,则只需将它的值改为 true。如果不存在名为 reportDataForBIEnable 的 key 则需要在最后一行写入 reportDataForBIEnable: true


如果打开的文件中有名为 onesDataCollectorReportPowerSwitch 的 key,则只需将它的值改为 true。如果不存在名为 onesDataCollectorReportPowerSwitch 的 key 则需要在最后一行写入 onesDataCollectorReportPowerSwitch: true

修改后保存并退出

应用配置

make setup-ones

当观察到如下输出则说明执行成功

bash-5.0# make setup-ones
python3 ./script/python/ones/cmd/setupapp.py --app=ones --version=v1 --ones-path=
2023-07-20 10:17:53,491 [INFO] ones_path=, k8s_root_dir=/data/ones/ones-ai-k8s
2023-07-20 10:17:53,555 [INFO] render config
2023-07-20 10:17:53,555 [INFO] merge configs
2023-07-20 10:17:57,604 [WARNING] /data/ones/ones-ai-k8s/private-overlay-templates/ones/v1 not found, skip
2023-07-20 10:17:57,604 [INFO] ones_path=, k8s_root_dir=/data/ones/ones-ai-k8s
2023-07-20 10:17:57,669 [INFO] compatible overlay
2023-07-20 10:17:58,770 [INFO] collect dir info
2023-07-20 10:17:58,793 [INFO] setup global resrouces
2023-07-20 10:17:59,032 [INFO] gen registry credentials
2023-07-20 10:17:59,036 [INFO] setup namespace, registry-secret
2023-07-20 10:17:59,356 [INFO] setup local-storage static-pvc, static-pv (cache config to tmp/config.yaml)
storageclass.storage.k8s.io/ones-local-storage unchanged
storageclass.storage.k8s.io/ones-local-storage-mock unchanged
deployment.apps/localstorage-ones-cn-server-node03 unchanged
storageclass.storage.k8s.io/ones-local-storage unchanged
storageclass.storage.k8s.io/ones-local-storage-mock unchanged
2023-07-20 10:18:03,625 [INFO] backward compatible
2023-07-20 10:18:03,760 [INFO] diff ones before setup
2023-07-20 10:18:08,614 [INFO] setup ones
2023-07-20 10:18:11,549 [INFO] record latest data
render to tmp/latest-record-setup-app-comfigmap.yaml
render to tmp/date-record-setup-app-comfigmap.yaml
2023-07-20 10:18:16,365 [INFO] remove /data/ones/ones-ai-k8s/tmp
2023-07-20 10:18:16,370 [INFO] setup ones finish
2023-07-20 10:18:16,370 [INFO] elapsed time: 22.815 seconds

验证

查看数据搜集 pod 是否启动

kubectl -n ones get pods | grep ones-data-collector

当观察到如下输出则说明数据搜集 pod 启动成功

bash-5.0# kubectl -n ones get pods | grep ones-data-collector
ones-data-collector-deployment-5d546f99c8-jdjw4 1/1 Running 0 74m

ONES 配置 关闭日志上报服务

修改配置

进入运行中的 ones 容器

ones-ai-k8s.sh

修改配置

vim config/private.yaml

如果打开的文件中有名为 reportDataForBIEnable 的 key,则只需将它的值改为 true。如果不存在名为 reportDataForBIEnable 的 key 则需要在最后一行写入 reportDataForBIEnable: false


如果打开的文件中有名为 onesDataCollectorReportPowerSwitch 的 key,则只需将它的值改为 true。如果不存在名为 onesDataCollectorReportPowerSwitch 的 key 则需要在最后一行写入 onesDataCollectorReportPowerSwitch: false

修改后保存并退出

应用配置

make setup-ones

当观察到如下输出则说明执行成功

bash-5.0# make setup-ones
python3 ./script/python/ones/cmd/setupapp.py --app=ones --version=v1 --ones-path=
2023-07-20 04:03:50,465 [INFO] ones_path=, k8s_root_dir=/data/ones/ones-ai-k8s
2023-07-20 04:03:50,531 [INFO] render config
2023-07-20 04:03:50,531 [INFO] merge configs
2023-07-20 04:03:54,931 [WARNING] /data/ones/ones-ai-k8s/private-overlay-templates/ones/v1 not found, skip
2023-07-20 04:03:54,931 [INFO] ones_path=, k8s_root_dir=/data/ones/ones-ai-k8s
2023-07-20 04:03:54,998 [INFO] compatible overlay
2023-07-20 04:03:56,156 [INFO] collect dir info
2023-07-20 04:03:56,188 [INFO] setup global resrouces
2023-07-20 04:03:56,443 [INFO] gen registry credentials
2023-07-20 04:03:56,448 [INFO] setup namespace, registry-secret
2023-07-20 04:03:56,771 [INFO] setup local-storage static-pvc, static-pv (cache config to tmp/config.yaml)
storageclass.storage.k8s.io/ones-local-storage unchanged
storageclass.storage.k8s.io/ones-local-storage-mock unchanged
deployment.apps/localstorage-ones-cn-server-node03 unchanged
storageclass.storage.k8s.io/ones-local-storage unchanged
storageclass.storage.k8s.io/ones-local-storage-mock unchanged
2023-07-20 04:04:01,197 [INFO] backward compatible
2023-07-20 04:04:01,330 [INFO] diff ones before setup
2023-07-20 04:04:06,168 [INFO] setup ones
2023-07-20 04:04:09,090 [INFO] record latest data
render to tmp/latest-record-setup-app-comfigmap.yaml
render to tmp/date-record-setup-app-comfigmap.yaml
2023-07-20 04:04:14,176 [INFO] remove /data/ones/ones-ai-k8s/tmp
2023-07-20 04:04:14,182 [INFO] setup ones finish
2023-07-20 04:04:14,182 [INFO] elapsed time: 23.651 seconds

验证

等待十几秒后查看日志上报服务是否关闭

kubectl -n ones get pods | grep ones-data-collector

如果没有任何输出,则说明日志上报服务已经关闭