From b3ceb6cc27d6da3d48ddf4a563d28b0ea3b66100 Mon Sep 17 00:00:00 2001 From: frf12 Date: Tue, 1 Nov 2022 19:48:02 +0800 Subject: [PATCH] v1.6.0 --- _environ.py | 33 + _optimize.py | 142 + docs/.menu_map.yml | 3 + docs/.menu_map_en.yml | 2 + ...tart-the-oceanbase-cluster-by-using-obd.md | 40 +- .../3.obd-command/1.cluster-command-groups.md | 56 +- ...and-group-for-mirroring-and-warehousing.md | 2 +- .../3.obd-command/3.test-command-group.md | 64 +- .../3.obd-command/4.tools-commands.md | 104 + .../en-US/4.configuration-file-description.md | 10 +- docs/en-US/{5.faq.md => 5.faq/1.faq.md} | 77 +- ...-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md | 75 + docs/en-US/6.error-messages-in-obd.md | 231 ++ .../1.quickly-start-the-oceanbase-database.md | 22 +- ...tart-the-oceanbase-cluster-by-using-obd.md | 28 +- .../3.user-guide/3.obd-command/0.obd-demo.md | 41 + .../3.obd-command/1.cluster-command-groups.md | 97 +- ...and-group-for-mirroring-and-warehousing.md | 2 +- .../3.obd-command/3.test-command-group.md | 125 +- .../3.obd-command/4.tools-commands.md | 104 + .../4.OCP-takeover-OBD-deployment-cluster.md | 295 ++ .../zh-CN/4.configuration-file-description.md | 10 +- docs/zh-CN/{5.faq.md => 5.faq/1.faq.md} | 93 +- ...-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md | 75 + docs/zh-CN/6.error-messages-in-obd.md | 96 +- example/all-components-min.yaml | 114 + example/all-components.yaml | 116 + example/autodeploy/all-components.yaml | 298 ++ example/autodeploy/default-example.yaml | 277 ++ example/autodeploy/distributed-example.yaml | 4 +- ...uted-with-obproxy-and-obagent-example.yaml | 10 +- .../distributed-with-obproxy-example.yaml | 4 +- example/autodeploy/single-example.yaml | 4 +- .../single-with-obproxy-example.yaml | 4 +- example/distributed-example.yaml | 5 +- example/distributed-with-obproxy-example.yaml | 3 +- example/grafana/grafana-only-example.yaml | 58 + example/grafana/prometheus-and-grafana.yaml | 128 + example/local-example.yaml | 7 +- example/mini-distributed-example.yaml | 19 +- ...mini-distributed-with-obproxy-example.yaml | 17 +- example/mini-local-example.yaml | 19 +- example/mini-single-example.yaml | 19 +- example/mini-single-with-obproxy-example.yaml | 17 +- ...uted-with-obproxy-and-obagent-example.yaml | 7 +- example/obagent/obagent-only-example.yaml | 24 +- .../distributed-with-obproxy-example.yaml | 3 +- .../oceanbase-3.x/distributed-example.yaml | 66 + .../distributed-with-obproxy-example.yaml | 88 + example/oceanbase-3.x/local-example.yaml | 29 + .../mini-distributed-example.yaml | 74 + ...mini-distributed-with-obproxy-example.yaml | 98 + example/oceanbase-3.x/mini-local-example.yaml | 41 + .../oceanbase-3.x/mini-single-example.yaml | 48 + .../mini-single-with-obproxy-example.yaml | 72 + example/oceanbase-3.x/single-example.yaml | 36 + .../single-with-obproxy-example.yaml | 60 + ...d-with-obagent-and-prometheus-example.yaml | 159 ++ .../prometheus/prometheus-only-example.yaml | 73 + example/single-example.yaml | 7 +- example/single-with-obproxy-example.yaml | 3 +- optimize/obproxy/3.1.0/sysbench.yaml | 21 + optimize/obproxy/3.1.0/tpcc.yaml | 24 + optimize/obproxy/4.0.0.0/sysbench.yaml | 26 + optimize/obproxy/4.0.0.0/tpcc.yaml | 26 + optimize/obproxy/optimizer.yaml | 4 + optimize/oceanbase-ce/3.1.0/optimizer.yaml | 12 + optimize/oceanbase-ce/3.1.0/sysbench.yaml | 67 + optimize/oceanbase-ce/3.1.0/tpcc.yaml | 182 ++ optimize/oceanbase-ce/3.1.0/tpch.yaml | 61 + optimize/oceanbase-ce/4.0.0.0/optimizer.yaml | 14 + optimize/oceanbase-ce/4.0.0.0/sysbench.yaml | 80 + optimize/oceanbase-ce/4.0.0.0/tpcc.yaml | 85 + optimize/oceanbase-ce/4.0.0.0/tpch.yaml | 93 + optimize/oceanbase/3.1.0/optimizer.yaml | 12 + optimize/oceanbase/3.1.0/sysbench.yaml | 67 + optimize/oceanbase/3.1.0/tpcc.yaml | 186 ++ optimize/oceanbase/3.1.0/tpch.yaml | 61 + optimize/oceanbase/4.0.0.0/optimizer.yaml | 14 + optimize/oceanbase/4.0.0.0/sysbench.yaml | 80 + optimize/oceanbase/4.0.0.0/tpcc.yaml | 85 + optimize/oceanbase/4.0.0.0/tpch.yaml | 93 + .../optimize_parser/0.1/optimize_parser.py | 645 +++++ plugins/dooba/3.1.0/run.py | 79 + plugins/general/0.1/create_snap.py | 83 + plugins/general/0.1/install_repo.py | 7 +- plugins/general/0.1/load_snap.py | 88 + plugins/general/0.1/snap_check.py | 53 + plugins/grafana/7.5.17/bootstrap.py | 76 + plugins/grafana/7.5.17/connect.py | 123 + plugins/grafana/7.5.17/destroy.py | 55 + plugins/grafana/7.5.17/display.py | 56 + plugins/grafana/7.5.17/file_map.yaml | 23 + plugins/grafana/7.5.17/generate_config.py | 65 + plugins/grafana/7.5.17/init.py | 132 + .../7.5.17/oceanbase-metrics_rev1.json | 2498 +++++++++++++++++ plugins/grafana/7.5.17/parameter.yaml | 84 + plugins/grafana/7.5.17/reload.py | 62 + plugins/grafana/7.5.17/restart.py | 136 + plugins/grafana/7.5.17/start.py | 343 +++ plugins/grafana/7.5.17/start_check.py | 90 + plugins/grafana/7.5.17/status.py | 36 + plugins/grafana/7.5.17/stop.py | 106 + plugins/mysqltest/4.0.0.0/check_test.py | 252 ++ plugins/mysqltest/4.0.0.0/init.py | 127 + .../4.0.0.0/mysqltest_lib/__init__.py | 0 .../4.0.0.0/mysqltest_lib/psmallsource.py | 37 + .../4.0.0.0/mysqltest_lib/psmalltest.py | 725 +++++ .../4.0.0.0/mysqltest_lib/rebootcase.py | 134 + .../4.0.0.0/mysqltest_lib/succtest.py | 85 + plugins/obproxy-ce/3.1.0/file_map.yaml | 4 + plugins/obproxy/3.1.0/snap_config.yaml | 4 + plugins/oceanbase/3.1.0/major_freeze.py | 59 + plugins/oceanbase/3.1.0/snap_config.yaml | 5 + plugins/oceanbase/4.0.0.0/bootstrap.py | 126 + plugins/oceanbase/4.0.0.0/create_tenant.py | 308 ++ plugins/oceanbase/4.0.0.0/drop_tenant.py | 93 + plugins/oceanbase/4.0.0.0/file_map.yaml | 14 + plugins/oceanbase/4.0.0.0/generate_config.py | 383 +++ plugins/oceanbase/4.0.0.0/init.py | 197 ++ plugins/oceanbase/4.0.0.0/major_freeze.py | 59 + plugins/oceanbase/4.0.0.0/parameter.yaml | 1816 ++++++++++++ plugins/oceanbase/4.0.0.0/restart.py | 289 ++ plugins/oceanbase/4.0.0.0/start.py | 214 ++ plugins/oceanbase/4.0.0.0/start_check.py | 406 +++ plugins/optimize/0.1/check_options.py | 47 + plugins/optimize/0.1/optimize.py | 73 + plugins/optimize/0.1/recover.py | 47 + plugins/prometheus/2.37.1/bootstrap.py | 37 + plugins/prometheus/2.37.1/connect.py | 101 + plugins/prometheus/2.37.1/destroy.py | 58 + plugins/prometheus/2.37.1/display.py | 54 + plugins/prometheus/2.37.1/file_map.yaml | 14 + plugins/prometheus/2.37.1/generate_config.py | 50 + plugins/prometheus/2.37.1/init.py | 149 + plugins/prometheus/2.37.1/parameter.yaml | 62 + plugins/prometheus/2.37.1/prometheusd.sh | 74 + plugins/prometheus/2.37.1/reload.py | 86 + plugins/prometheus/2.37.1/restart.py | 134 + plugins/prometheus/2.37.1/start.py | 302 ++ plugins/prometheus/2.37.1/start_check.py | 103 + plugins/prometheus/2.37.1/status.py | 38 + plugins/prometheus/2.37.1/stop.py | 110 + plugins/sysbench/3.1.0/pre_test.py | 154 + plugins/sysbench/4.0.0.0/pre_test.py | 157 ++ plugins/sysbench/4.0.0.0/run_test.py | 112 + plugins/tpcc/4.0.0.0/analyze.sql | 11 + plugins/tpcc/4.0.0.0/build.py | 215 ++ plugins/tpcc/4.0.0.0/pre_test.py | 291 ++ plugins/tpcc/4.0.0.0/run/log4j.properties | 22 + .../4.0.0.0/run/misc/os_collector_linux.py | 303 ++ plugins/tpcc/4.0.0.0/run_test.py | 207 ++ .../4.0.0.0/sql.oceanbase/buildFinish.sql | 4 + .../4.0.0.0/sql.oceanbase/indexCreates.sql | 4 + .../tpcc/4.0.0.0/sql.oceanbase/indexDrops.sql | 2 + .../4.0.0.0/sql.oceanbase/tableCreates.sql | 135 + .../tpcc/4.0.0.0/sql.oceanbase/tableDrops.sql | 21 + plugins/tpch/4.0.0.0/analyze.sql | 9 + .../4.0.0.0/create_tpch_mysql_table_part.ddl | 119 + plugins/tpch/4.0.0.0/pre_test.py | 221 ++ plugins/tpch/4.0.0.0/queries/db1.sql | 24 + plugins/tpch/4.0.0.0/queries/db10.sql | 35 + plugins/tpch/4.0.0.0/queries/db11.sql | 30 + plugins/tpch/4.0.0.0/queries/db12.sql | 31 + plugins/tpch/4.0.0.0/queries/db13.sql | 7 + plugins/tpch/4.0.0.0/queries/db14.sql | 16 + plugins/tpch/4.0.0.0/queries/db15.sql | 36 + plugins/tpch/4.0.0.0/queries/db16.sql | 33 + plugins/tpch/4.0.0.0/queries/db17.sql | 20 + plugins/tpch/4.0.0.0/queries/db18.sql | 35 + plugins/tpch/4.0.0.0/queries/db19.sql | 38 + plugins/tpch/4.0.0.0/queries/db2.sql | 46 + plugins/tpch/4.0.0.0/queries/db20.sql | 40 + plugins/tpch/4.0.0.0/queries/db21.sql | 42 + plugins/tpch/4.0.0.0/queries/db22.sql | 40 + plugins/tpch/4.0.0.0/queries/db3.sql | 25 + plugins/tpch/4.0.0.0/queries/db4.sql | 11 + plugins/tpch/4.0.0.0/queries/db5.sql | 27 + plugins/tpch/4.0.0.0/queries/db6.sql | 12 + plugins/tpch/4.0.0.0/queries/db7.sql | 42 + plugins/tpch/4.0.0.0/queries/db8.sql | 40 + plugins/tpch/4.0.0.0/queries/db9.sql | 35 + plugins/tpch/4.0.0.0/run_test.py | 255 ++ 183 files changed, 19461 insertions(+), 293 deletions(-) create mode 100644 _environ.py create mode 100644 _optimize.py create mode 100644 docs/.menu_map.yml create mode 100644 docs/.menu_map_en.yml create mode 100644 docs/en-US/3.user-guide/3.obd-command/4.tools-commands.md rename docs/en-US/{5.faq.md => 5.faq/1.faq.md} (62%) create mode 100644 docs/en-US/5.faq/2.how-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md create mode 100644 docs/en-US/6.error-messages-in-obd.md create mode 100644 docs/zh-CN/3.user-guide/3.obd-command/0.obd-demo.md create mode 100644 docs/zh-CN/3.user-guide/3.obd-command/4.tools-commands.md create mode 100644 docs/zh-CN/3.user-guide/4.OCP-takeover-OBD-deployment-cluster.md rename docs/zh-CN/{5.faq.md => 5.faq/1.faq.md} (54%) create mode 100644 docs/zh-CN/5.faq/2.how-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md create mode 100644 example/all-components-min.yaml create mode 100644 example/all-components.yaml create mode 100644 example/autodeploy/all-components.yaml create mode 100644 example/autodeploy/default-example.yaml create mode 100644 example/grafana/grafana-only-example.yaml create mode 100644 example/grafana/prometheus-and-grafana.yaml create mode 100644 example/oceanbase-3.x/distributed-example.yaml create mode 100644 example/oceanbase-3.x/distributed-with-obproxy-example.yaml create mode 100644 example/oceanbase-3.x/local-example.yaml create mode 100644 example/oceanbase-3.x/mini-distributed-example.yaml create mode 100644 example/oceanbase-3.x/mini-distributed-with-obproxy-example.yaml create mode 100755 example/oceanbase-3.x/mini-local-example.yaml create mode 100755 example/oceanbase-3.x/mini-single-example.yaml create mode 100644 example/oceanbase-3.x/mini-single-with-obproxy-example.yaml create mode 100644 example/oceanbase-3.x/single-example.yaml create mode 100644 example/oceanbase-3.x/single-with-obproxy-example.yaml create mode 100644 example/prometheus/distributed-with-obagent-and-prometheus-example.yaml create mode 100644 example/prometheus/prometheus-only-example.yaml create mode 100644 optimize/obproxy/3.1.0/sysbench.yaml create mode 100644 optimize/obproxy/3.1.0/tpcc.yaml create mode 100644 optimize/obproxy/4.0.0.0/sysbench.yaml create mode 100644 optimize/obproxy/4.0.0.0/tpcc.yaml create mode 100644 optimize/obproxy/optimizer.yaml create mode 100644 optimize/oceanbase-ce/3.1.0/optimizer.yaml create mode 100644 optimize/oceanbase-ce/3.1.0/sysbench.yaml create mode 100644 optimize/oceanbase-ce/3.1.0/tpcc.yaml create mode 100644 optimize/oceanbase-ce/3.1.0/tpch.yaml create mode 100644 optimize/oceanbase-ce/4.0.0.0/optimizer.yaml create mode 100644 optimize/oceanbase-ce/4.0.0.0/sysbench.yaml create mode 100644 optimize/oceanbase-ce/4.0.0.0/tpcc.yaml create mode 100644 optimize/oceanbase-ce/4.0.0.0/tpch.yaml create mode 100644 optimize/oceanbase/3.1.0/optimizer.yaml create mode 100644 optimize/oceanbase/3.1.0/sysbench.yaml create mode 100644 optimize/oceanbase/3.1.0/tpcc.yaml create mode 100644 optimize/oceanbase/3.1.0/tpch.yaml create mode 100644 optimize/oceanbase/4.0.0.0/optimizer.yaml create mode 100644 optimize/oceanbase/4.0.0.0/sysbench.yaml create mode 100644 optimize/oceanbase/4.0.0.0/tpcc.yaml create mode 100644 optimize/oceanbase/4.0.0.0/tpch.yaml create mode 100644 optimize/optimize_parser/0.1/optimize_parser.py create mode 100644 plugins/dooba/3.1.0/run.py create mode 100644 plugins/general/0.1/create_snap.py create mode 100644 plugins/general/0.1/load_snap.py create mode 100644 plugins/general/0.1/snap_check.py create mode 100644 plugins/grafana/7.5.17/bootstrap.py create mode 100644 plugins/grafana/7.5.17/connect.py create mode 100644 plugins/grafana/7.5.17/destroy.py create mode 100644 plugins/grafana/7.5.17/display.py create mode 100644 plugins/grafana/7.5.17/file_map.yaml create mode 100644 plugins/grafana/7.5.17/generate_config.py create mode 100644 plugins/grafana/7.5.17/init.py create mode 100644 plugins/grafana/7.5.17/oceanbase-metrics_rev1.json create mode 100644 plugins/grafana/7.5.17/parameter.yaml create mode 100644 plugins/grafana/7.5.17/reload.py create mode 100644 plugins/grafana/7.5.17/restart.py create mode 100644 plugins/grafana/7.5.17/start.py create mode 100644 plugins/grafana/7.5.17/start_check.py create mode 100644 plugins/grafana/7.5.17/status.py create mode 100644 plugins/grafana/7.5.17/stop.py create mode 100644 plugins/mysqltest/4.0.0.0/check_test.py create mode 100644 plugins/mysqltest/4.0.0.0/init.py create mode 100644 plugins/mysqltest/4.0.0.0/mysqltest_lib/__init__.py create mode 100644 plugins/mysqltest/4.0.0.0/mysqltest_lib/psmallsource.py create mode 100644 plugins/mysqltest/4.0.0.0/mysqltest_lib/psmalltest.py create mode 100644 plugins/mysqltest/4.0.0.0/mysqltest_lib/rebootcase.py create mode 100644 plugins/mysqltest/4.0.0.0/mysqltest_lib/succtest.py create mode 100644 plugins/obproxy-ce/3.1.0/file_map.yaml create mode 100644 plugins/obproxy/3.1.0/snap_config.yaml create mode 100644 plugins/oceanbase/3.1.0/major_freeze.py create mode 100644 plugins/oceanbase/3.1.0/snap_config.yaml create mode 100644 plugins/oceanbase/4.0.0.0/bootstrap.py create mode 100644 plugins/oceanbase/4.0.0.0/create_tenant.py create mode 100644 plugins/oceanbase/4.0.0.0/drop_tenant.py create mode 100644 plugins/oceanbase/4.0.0.0/file_map.yaml create mode 100644 plugins/oceanbase/4.0.0.0/generate_config.py create mode 100644 plugins/oceanbase/4.0.0.0/init.py create mode 100644 plugins/oceanbase/4.0.0.0/major_freeze.py create mode 100644 plugins/oceanbase/4.0.0.0/parameter.yaml create mode 100644 plugins/oceanbase/4.0.0.0/restart.py create mode 100644 plugins/oceanbase/4.0.0.0/start.py create mode 100644 plugins/oceanbase/4.0.0.0/start_check.py create mode 100644 plugins/optimize/0.1/check_options.py create mode 100644 plugins/optimize/0.1/optimize.py create mode 100644 plugins/optimize/0.1/recover.py create mode 100644 plugins/prometheus/2.37.1/bootstrap.py create mode 100644 plugins/prometheus/2.37.1/connect.py create mode 100644 plugins/prometheus/2.37.1/destroy.py create mode 100644 plugins/prometheus/2.37.1/display.py create mode 100644 plugins/prometheus/2.37.1/file_map.yaml create mode 100644 plugins/prometheus/2.37.1/generate_config.py create mode 100644 plugins/prometheus/2.37.1/init.py create mode 100644 plugins/prometheus/2.37.1/parameter.yaml create mode 100644 plugins/prometheus/2.37.1/prometheusd.sh create mode 100644 plugins/prometheus/2.37.1/reload.py create mode 100644 plugins/prometheus/2.37.1/restart.py create mode 100644 plugins/prometheus/2.37.1/start.py create mode 100644 plugins/prometheus/2.37.1/start_check.py create mode 100644 plugins/prometheus/2.37.1/status.py create mode 100644 plugins/prometheus/2.37.1/stop.py create mode 100644 plugins/sysbench/3.1.0/pre_test.py create mode 100644 plugins/sysbench/4.0.0.0/pre_test.py create mode 100644 plugins/sysbench/4.0.0.0/run_test.py create mode 100644 plugins/tpcc/4.0.0.0/analyze.sql create mode 100644 plugins/tpcc/4.0.0.0/build.py create mode 100644 plugins/tpcc/4.0.0.0/pre_test.py create mode 100644 plugins/tpcc/4.0.0.0/run/log4j.properties create mode 100644 plugins/tpcc/4.0.0.0/run/misc/os_collector_linux.py create mode 100644 plugins/tpcc/4.0.0.0/run_test.py create mode 100644 plugins/tpcc/4.0.0.0/sql.oceanbase/buildFinish.sql create mode 100644 plugins/tpcc/4.0.0.0/sql.oceanbase/indexCreates.sql create mode 100644 plugins/tpcc/4.0.0.0/sql.oceanbase/indexDrops.sql create mode 100644 plugins/tpcc/4.0.0.0/sql.oceanbase/tableCreates.sql create mode 100644 plugins/tpcc/4.0.0.0/sql.oceanbase/tableDrops.sql create mode 100644 plugins/tpch/4.0.0.0/analyze.sql create mode 100644 plugins/tpch/4.0.0.0/create_tpch_mysql_table_part.ddl create mode 100644 plugins/tpch/4.0.0.0/pre_test.py create mode 100644 plugins/tpch/4.0.0.0/queries/db1.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db10.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db11.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db12.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db13.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db14.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db15.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db16.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db17.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db18.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db19.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db2.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db20.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db21.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db22.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db3.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db4.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db5.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db6.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db7.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db8.sql create mode 100644 plugins/tpch/4.0.0.0/queries/db9.sql create mode 100644 plugins/tpch/4.0.0.0/run_test.py diff --git a/_environ.py b/_environ.py new file mode 100644 index 0000000..a544ac8 --- /dev/null +++ b/_environ.py @@ -0,0 +1,33 @@ +# coding: utf-8 +# 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 . + + +from __future__ import absolute_import, division, print_function + +# obd dev mode. {0/1} +ENV_DEV_MODE = "OBD_DEV_MODE" + +# base path which will be used by runtime dependencies sync and include config. {absolute path style} +ENV_BASE_DIR = "OBD_DEPLOY_BASE_DIR" + +# the installation mode of remote repository. {cp/ln} +ENV_REPO_INSTALL_MODE = "OBD_REPO_INSTALL_MODE" + +# disable rsync mode even if the rsync exists. {0/1} +ENV_DISABLE_RSYNC = "OBD_DISABLE_RSYNC" diff --git a/_optimize.py b/_optimize.py new file mode 100644 index 0000000..3df8c4e --- /dev/null +++ b/_optimize.py @@ -0,0 +1,142 @@ +# coding: utf-8 +# 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 . + + +from __future__ import absolute_import, division, print_function + +import enum +import os + +from _manager import Manager +from _rpm import Version +from tool import YamlLoader, FileUtil, DynamicLoading + +yaml_loader = YamlLoader() + + +class OptimizeManager(Manager): + + RELATIVE_PATH = "optimize/" + + def __init__(self, home_path, loader=yaml_loader, stdio=None): + self.loader = loader + self.components = {} + self._parser = None + self._optimize_config = None + super(OptimizeManager, self).__init__(home_path, stdio=stdio) + + @property + def optimize_config(self): + if not self._parser: + raise Exception("Optimize parser not load") + return self._parser.optimize_config + + def load_config(self, path, stdio=None): + self._optimize_config = None + with FileUtil.open(path, 'rb') as f: + config = self.loader.load(f) + parser_version = config.get("optimize_version", None) + parser = self._get_parser(version=parser_version) + self._parser = parser + self._load_default_optimizers(parser, stdio=stdio) + self._optimize_config = parser.load(config) + + def _search_yaml_file(self, component, version, yaml_name, stdio=None): + component_dir = os.path.join(self.path, component) + if not os.path.exists(component_dir): + stdio.verbose("no optimize config for component {}".format(component)) + return None + yaml_file = os.path.join(component_dir, version, yaml_name) + if not os.path.exists(yaml_file): + stdio.verbose( + 'yaml file {} not found, try to get earlier version.'.format(yaml_file)) + final_version = Version('') + versions = sorted([Version(v) for v in os.listdir(component_dir)], reverse=True) + for v in versions: + yaml_file = os.path.join(component_dir, v, yaml_name) + if os.path.exists(yaml_file) and v <= version: + self.stdio.verbose('find earlier version yaml file: {}'.format(yaml_file)) + break + else: + yaml_file = os.path.join(component_dir, final_version, yaml_name) + stdio.verbose('try to use top yaml file: {}'.format(yaml_file)) + if not os.path.exists(yaml_file): + stdio.verbose('No such yaml file: {}'.format(yaml_file)) + return None + return yaml_file + + def load_default_config(self, test_name, stdio=None): + self._optimize_config = None + parser = self._get_parser() + self._load_default_optimizers(parser, stdio=stdio) + yaml_name = '{}.yaml'.format(test_name) + for component, version in self.components.items(): + config_path = self._search_yaml_file(component, version, yaml_name, stdio=stdio) + if config_path: + with FileUtil.open(config_path, 'rb', stdio=stdio) as f: + config = self.loader.load(f) + parser.load_config_by_component(component, config, stdio=stdio) + self._parser = parser + + def _load_default_optimizers(self, parser, stdio=None): + yaml_name = 'optimizer.yaml' + for component, version in self.components.items(): + optimizer_path = self._search_yaml_file(component, version, yaml_name, stdio=stdio) + if optimizer_path: + with FileUtil.open(optimizer_path, 'rb') as f: + config = self.loader.load(f) + parser.load_optimizer_by_component(component, config, stdio=stdio) + + @staticmethod + def _get_latest_version(path): + latest_version = Version('') + for name in os.listdir(path): + latest_version = max(latest_version, Version(name)) + return latest_version + + def _get_parser(self, version=None): + if self._parser: + return self._parser + module_name = 'optimize_parser' + class_name = 'OptimizeParser' + file_name = '{}.py'.format(module_name) + parser_base = os.path.join(self.path, module_name) + if version is None: + version = self._get_latest_version(parser_base) + lib_path = os.path.join(parser_base, version) + path = os.path.join(lib_path, file_name) + if os.path.isfile(path): + DynamicLoading.add_lib_path(lib_path) + self.stdio.verbose('load optimize parser: {}'.format(path)) + module = DynamicLoading.import_module(module_name, self.stdio) + try: + self._parser = getattr(module, class_name)() + return self._parser + except: + self.stdio.exception("") + return None + finally: + DynamicLoading.remove_lib_path(lib_path) + else: + self.stdio.verbose('No such optimize parser: {}'.format(path)) + return None + + def register_component(self, name, version): + self.stdio.verbose('register component {}-{} to optimize manager'.format(name, version)) + self.components[name] = Version(version) diff --git a/docs/.menu_map.yml b/docs/.menu_map.yml new file mode 100644 index 0000000..71cca57 --- /dev/null +++ b/docs/.menu_map.yml @@ -0,0 +1,3 @@ +3.user-guide=使用指南 +3.obd-command=OBD 命令 +5.faq=常见问题 diff --git a/docs/.menu_map_en.yml b/docs/.menu_map_en.yml new file mode 100644 index 0000000..264ff28 --- /dev/null +++ b/docs/.menu_map_en.yml @@ -0,0 +1,2 @@ +3.user-guide=User Guide +3.obd-command=OBD command \ No newline at end of file diff --git a/docs/en-US/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md b/docs/en-US/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md index bf19798..674fb08 100644 --- a/docs/en-US/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md +++ b/docs/en-US/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md @@ -4,30 +4,39 @@ To start an OceanBase cluster, follow these steps: ## Step 1: Select a configuration file -Select a configuration file based on your resource configurations: +OBD provides different configuration files for different deployment scenarios. These configuration file examples are placed in the directory `/usr/OBD/example/`. Select a configuration file based on your resource configurations: ### Small-scale deployment mode This deployment mode applies to personal devices with at least 8 GB of memory. -- [Sample configuration file for local single-node deployment](https://github.com/oceanbase/obdeploy/blob/master/example/mini-local-example.yaml) -- [Sample configuration file for single-node deployment](https://github.com/oceanbase/obdeploy/blob/master/example/mini-single-example.yaml) -- [Sample configuration file for three-node deployment](https://github.com/oceanbase/obdeploy/blob/master/example/mini-distributed-example.yaml) -- [Sample configuration file for single-node deployment with ODP](https://github.com/oceanbase/obdeploy/blob/master/example/mini-single-with-obproxy-example.yaml) -- [Sample configuration file for three-node deployment with ODP](https://github.com/oceanbase/obdeploy/blob/master/example/mini-distributed-with-obproxy-example.yaml) +- Sample configuration file for local single-node deployment: /usr/obd/example/mini-local-example.yaml + +- Sample configuration file for single-node deployment: /usr/obd/example/mini-single-example.yaml + +- Sample configuration file for three-node deployment: /usr/obd/example/mini-distributed-example.yaml + +- Sample configuration file for single-node deployment with ODP: /usr/obd/example/mini-single-with-obproxy-example.yaml + +- Sample configuration file for three-node deployment with ODP: /usr/obd/example/mini-distributed-with-obproxy-example.yaml ### Professional deployment mode This deployment mode applies to advanced Elastic Compute Service (ECS) instances or physical servers with at least 16 CPU cores and 64 GB of memory. -- [Sample configuration file for local single-node deployment](https://github.com/oceanbase/obdeploy/blob/master/example/local-example.yaml) -- [Sample configuration file for single-node deployment](https://github.com/oceanbase/obdeploy/blob/master/example/single-example.yaml) -- [Sample configuration file for three-node deployment](https://github.com/oceanbase/obdeploy/blob/master/example/distributed-example.yaml) -- [Sample configuration file for single-node deployment with ODP](https://github.com/oceanbase/obdeploy/blob/master/example/single-with-obproxy-example.yaml) -- [Sample configuration file for three-node deployment with ODP](https://github.com/oceanbase/obdeploy/blob/master/example/distributed-with-obproxy-example.yaml) -- [Sample configuration file for three-node deployment with ODP and obagent](https://github.com/oceanbase/obdeploy/blob/master/example/obagent/distributed-with-obproxy-and-obagent-example.yaml) +- Sample configuration file for local single-node deployment: /usr/obd/example/local-example.yaml + +- Sample configuration file for single-node deployment: /usr/obd/example/single-example.yaml -This section describes how to start a local single-node OceanBase cluster by using the [sample configuration file for local single-node deployment in the small-scale deployment mode](https://github.com/oceanbase/obdeploy/blob/master/example/mini-local-example.yaml). +- Sample configuration file for three-node deployment: /usr/obd/example/distributed-example.yaml + +- Sample configuration file for single-node deployment with ODP: /usr/obd/example/single-with-obproxy-example.yaml + +- Sample configuration file for three-node deployment with ODP: /usr/obd/example/distributed-with-obproxy-example.yaml + +- Sample configuration file for three-node deployment with ODP and obagent: /usr/obd/example/obagent/distributed-with-obproxy-and-obagent-example.yaml + +This section describes how to start a local single-node OceanBase cluster by using the sample configuration file for local single-node deployment in the small-scale deployment mode: /usr/obd/example/mini-local-example.yaml. ```shell # Modify the working directory of the OceanBase cluster: home_path. @@ -47,7 +56,10 @@ user: ``` `username` specifies the username used to log on to the target server. Make sure that your username has the write permission on the `home_path` directory. `password` and `key_file` are used to authenticate the user. Generally, only one of them is required. -> **NOTE:** After you specify the path of the key, add an annotation to the `password` field or delete it if your key does not require a password. Otherwise, `password` will be deemed as the password of the key and used for login, leading to a logon verification failure. + +> **NOTE:** +> +> After you specify the path of the key, add an annotation to the `password` field or delete it if your key does not require a password. Otherwise, `password` will be deemed as the password of the key and used for login, leading to a logon verification failure. ## Step 2: Deploy and start a cluster diff --git a/docs/en-US/3.user-guide/3.obd-command/1.cluster-command-groups.md b/docs/en-US/3.user-guide/3.obd-command/1.cluster-command-groups.md index 64aa0d3..a174ef0 100644 --- a/docs/en-US/3.user-guide/3.obd-command/1.cluster-command-groups.md +++ b/docs/en-US/3.user-guide/3.obd-command/1.cluster-command-groups.md @@ -181,12 +181,28 @@ obd cluster upgrade -c -V [tags] | Option | Required | Data type | Default value | Description | --- | --- | --- |--- |--- -c/--component | Yes | string | empty | The component name you want to upgrade. --V/--version | Yes | string | The target upgrade version number. +-V/--version | Yes | string | empty | The target upgrade version number. --skip-check | No | bool | false | Skip check. --usable | No | string | empty | The hash list for the mirrors that you use during upgrade. Separated with `,`. --disable | No | string | empty | The hash list for the mirrors that you disable during upgrade. Separated with `,`. -e/--executer-path | No | string | /usr/obd/lib/executer | The executer path for the upgrade script. +## obd cluster reinstall + +You can run this command to reinstall the repository of a deployed component. The new repository must have the same version number as the previous repository. If this command is used to replace the repository when the deployment status is 'running', the component is restarted after the replacement without loading parameters. + +```bash +obd cluster reinstall -c --hash [-f/--force] +``` + +The `deploy name` parameter indicates the name of the deployed cluster, which is also the alias of the configuration file. + +| Option name | Required | Data type | Default value | Description | +|---------|----------|-------------|-------------|--------------| +| -c/--component | Yes | string | Null | The name of the component whose repository is to be replaced. | +|--hash | Yes | string | Null | The target repository. It must be of the same version as the current repository. | +| -f/--force | No | Bool | false | Specifies whether to enable forced replacement even if the restart fails. | + ## `obd cluster tenant create` Creates a tenant. This command applies only to an OceanBase cluster. This command automatically creates resource units and resource pools. @@ -232,3 +248,41 @@ obd cluster tenant drop [-n ] `deploy name` specifies the name of the deployment configuration file. `-n` is `--tenant-name`. This option specifies the name of the tenant to be deleted. This option is required. + +## obd cluster chst + +You can run this command to change the configuration style. + +```shell +obd cluster chst --style