From 68d897d53792a21bb796fa3a050e4a68e4a3216e Mon Sep 17 00:00:00 2001 From: Rongfeng Fu Date: Fri, 15 Sep 2023 15:06:23 +0800 Subject: [PATCH] V2.3.0 (#177) * V2.3.0 * V2.3.0 * update docs --- _cmd.py | 104 ++- _deploy.py | 124 ++- _errno.py | 16 +- _mirror.py | 2 + core.py | 287 +++++- docs/en-US/1.what-is-obd.md | 3 - docs/en-US/100.what-is-obd.md | 7 + docs/en-US/1000.configure-rules.md | 67 ++ docs/en-US/1100.error-messages-in-obd.md | 535 +++++++++++ docs/en-US/2.install-obd.md | 45 - docs/en-US/200.quick-start/100.install-obd.md | 187 ++++ ...0.quickly-start-the-oceanbase-database.md} | 4 +- .../300.use-ui-deploy-oceanbase.md | 250 ++++++ ...tart-the-oceanbase-cluster-by-using-obd.md | 116 --- .../3.obd-command/1.cluster-command-groups.md | 298 ------- .../000.obd-demo.md} | 84 +- .../100.cluster-command-groups.md | 372 ++++++++ ...nd-group-for-mirroring-and-warehousing.md} | 20 +- .../300.test-command-group.md} | 100 ++- .../400.tools-commands.md} | 12 +- .../300.obd-command/500.obdiag-command.md | 228 +++++ .../300.obd-command/600.telemetry-commands.md | 55 ++ .../100.configuration-file-description.md} | 22 +- ...tart-the-oceanbase-cluster-by-using-obd.md | 267 ++++++ .../300.deploy-ocp-express-by-using-obd.md | 253 ++++++ ...00.OCP-takeover-OBD-deployment-cluster.md} | 586 ++++++------- .../500.add-white-screen-monitoring.md} | 141 ++- .../400.user-guide/600.update-ocp-express.md | 121 +++ .../400.user-guide/700.update-oceanbase.md | 222 +++++ .../{5.faq/1.faq.md => 500.faq/100.faq.md} | 40 +- ...to-upgrade-obproxy-to-obproxy-ce-3.2.3.md} | 0 docs/en-US/6.error-messages-in-obd.md | 231 ----- docs/zh-CN/1.what-is-obd.md | 3 - docs/zh-CN/100.what-is-obd.md | 7 + docs/zh-CN/1000.configure-rules.md | 67 ++ docs/zh-CN/1100.error-messages-in-obd.md | 544 ++++++++++++ docs/zh-CN/2.install-obd.md | 50 -- .../2.quickly-start-the-oceanbase-database.md | 25 - .../100.install-obd.md} | 0 ...00.quickly-start-the-oceanbase-database.md | 34 + .../300.use-ui-deploy-oceanbase.md} | 495 ++++++----- .../1.quickly-start-the-oceanbase-database.md | 22 - ...tart-the-oceanbase-cluster-by-using-obd.md | 120 --- .../3.user-guide/3.obd-command/0.obd-demo.md | 41 - .../3.obd-command/1.cluster-command-groups.md | 307 ------- ...and-group-for-mirroring-and-warehousing.md | 73 -- .../3.obd-command/3.test-command-group.md | 168 ---- .../3.obd-command/4.tools-commands.md | 114 --- .../3.obd-command/5.obdiag-commands.md | 233 ----- .../4.OCP-takeover-OBD-deployment-cluster.md | 295 ------- .../000.obd-demo.md} | 88 +- .../100.cluster-command-groups.md} | 9 +- ...nd-group-for-mirroring-and-warehousing.md} | 0 .../300.test-command-group.md} | 47 +- .../400.tools-commands.md} | 6 +- .../300.obd-command/500.obdiag-command.md | 228 +++++ .../300.obd-command/600.telemetry-commands.md | 55 ++ .../zh-CN/4.configuration-file-description.md | 81 -- .../3.deploy-ocp-express-by-using-obd.md | 257 ------ .../100.configuration-file-description.md} | 16 +- ...art-the-oceanbase-cluster-by-using-obd.md} | 44 +- .../300.deploy-ocp-express-by-using-obd.md | 504 +++++++++++ ...00.OCP-takeover-OBD-deployment-cluster.md} | 604 ++++++------- .../500.add-white-screen-monitoring.md} | 135 ++- .../400.user-guide/600.update-ocp-express.md | 121 +++ .../400.user-guide/700.update-oceanbase.md | 222 +++++ .../{5.faq/1.faq.md => 500.faq/100.faq.md} | 116 +-- ...to-upgrade-obproxy-to-obproxy-ce-3.2.3.md} | 6 +- docs/zh-CN/6.error-messages-in-obd.md | 231 ----- example/all-components-min.yaml | 33 +- example/all-components.yaml | 33 +- ...omponents-with-prometheus-and-grafana.yaml | 12 +- ...with-obproxy-and-configserver-example.yaml | 102 +++ .../ob-configserver-only-example.yaml | 36 + optimize/oceanbase-ce/4.2.0/tpch.yaml | 27 + plugins/ob-configserver/1.0.0/bootstrap.py | 25 + plugins/ob-configserver/1.0.0/connect.py | 90 ++ plugins/ob-configserver/1.0.0/destroy.py | 48 + plugins/ob-configserver/1.0.0/display.py | 60 ++ plugins/ob-configserver/1.0.0/file_map.yaml | 5 + .../ob-configserver/1.0.0/generate_config.py | 25 + plugins/ob-configserver/1.0.0/init.py | 84 ++ plugins/ob-configserver/1.0.0/parameter.yaml | 98 +++ plugins/ob-configserver/1.0.0/reload.py | 25 + plugins/ob-configserver/1.0.0/restart.py | 156 ++++ plugins/ob-configserver/1.0.0/start.py | 156 ++++ plugins/ob-configserver/1.0.0/start_check.py | 296 +++++++ plugins/ob-configserver/1.0.0/status.py | 35 + plugins/ob-configserver/1.0.0/stop.py | 98 +++ plugins/obproxy/3.1.0/connect.py | 10 +- plugins/obproxy/3.1.0/start.py | 19 +- plugins/oceanbase/3.1.0/connect.py | 23 +- plugins/oceanbase/3.1.0/generate_config.py | 4 + plugins/oceanbase/3.1.0/start.py | 34 +- plugins/oceanbase/3.1.0/stop.py | 9 +- plugins/oceanbase/4.0.0.0/generate_config.py | 6 +- plugins/oceanbase/4.0.0.0/start.py | 34 +- .../oceanbase/4.2.0.0/check_exit_standby.py | 42 + .../4.2.0.0/create_standby_tenant_pre.py | 207 +++++ plugins/oceanbase/4.2.0.0/create_tenant.py | 543 ++++++++++++ .../oceanbase/4.2.0.0/delete_standby_info.py | 100 +++ .../4.2.0.0/failover_decouple_tenant.py | 100 +++ .../4.2.0.0/failover_decouple_tenant_pre.py | 110 +++ plugins/oceanbase/4.2.0.0/generate_config.py | 6 +- .../4.2.0.0/get_deployment_connections.py | 59 ++ .../oceanbase/4.2.0.0/get_relation_tenants.py | 74 ++ plugins/oceanbase/4.2.0.0/get_standbys.py | 112 +++ plugins/oceanbase/4.2.0.0/list_tenant.py | 125 +++ .../oceanbase/4.2.0.0/print_standby_graph.py | 148 ++++ .../4.2.0.0/standby_version_check.py | 35 + .../oceanbase/4.2.0.0/switchover_tenant.py | 347 ++++++++ .../4.2.0.0/switchover_tenant_pre.py | 96 ++ plugins/oceanbase/4.2.0.0/upgrade_check.py | 99 +++ plugins/ocp-express/1.0.1/parameter.yaml | 4 +- plugins/ocp-express/1.0/parameter.yaml | 2 +- plugins/ocp-express/4.1.0/parameter.yaml | 4 +- plugins/tpch/4.2.0.0/analyze.sql | 8 + plugins/tpch/4.2.0.0/run_test.py | 249 ++++++ profile/obd.sh | 29 +- web/config/config.ts | 1 - web/src/pages/components/CheckInfo.tsx | 1 - .../components/ClusterConfig/ConfigTable.tsx | 132 +++ .../pages/components/ClusterConfig/Footer.tsx | 81 ++ .../components/ClusterConfig/Parameter.tsx | 244 ++++++ .../pages/components/ClusterConfig/helper.ts | 50 ++ .../pages/components/ClusterConfig/index.tsx | 828 ++++++++++++++++++ web/src/pages/components/indexEn.less | 2 +- web/src/pages/components/indexZh.less | 2 +- web/src/typings/global.d.ts | 2 + 129 files changed, 11550 insertions(+), 4042 deletions(-) delete mode 100644 docs/en-US/1.what-is-obd.md create mode 100644 docs/en-US/100.what-is-obd.md create mode 100644 docs/en-US/1000.configure-rules.md create mode 100644 docs/en-US/1100.error-messages-in-obd.md delete mode 100644 docs/en-US/2.install-obd.md create mode 100644 docs/en-US/200.quick-start/100.install-obd.md rename docs/en-US/{3.user-guide/1.quickly-start-the-oceanbase-database.md => 200.quick-start/200.quickly-start-the-oceanbase-database.md} (69%) create mode 100644 docs/en-US/200.quick-start/300.use-ui-deploy-oceanbase.md delete mode 100644 docs/en-US/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md delete mode 100644 docs/en-US/3.user-guide/3.obd-command/1.cluster-command-groups.md rename docs/en-US/{3.user-guide/3.obd-command/0.obd-demo.md => 300.obd-command/000.obd-demo.md} (93%) create mode 100644 docs/en-US/300.obd-command/100.cluster-command-groups.md rename docs/en-US/{3.user-guide/3.obd-command/2.command-group-for-mirroring-and-warehousing.md => 300.obd-command/200.command-group-for-mirroring-and-warehousing.md} (76%) rename docs/en-US/{3.user-guide/3.obd-command/3.test-command-group.md => 300.obd-command/300.test-command-group.md} (61%) rename docs/en-US/{3.user-guide/3.obd-command/4.tools-commands.md => 300.obd-command/400.tools-commands.md} (93%) create mode 100644 docs/en-US/300.obd-command/500.obdiag-command.md create mode 100644 docs/en-US/300.obd-command/600.telemetry-commands.md rename docs/en-US/{4.configuration-file-description.md => 400.user-guide/100.configuration-file-description.md} (90%) create mode 100644 docs/en-US/400.user-guide/200.start-the-oceanbase-cluster-by-using-obd.md create mode 100644 docs/en-US/400.user-guide/300.deploy-ocp-express-by-using-obd.md rename docs/en-US/{3.user-guide/4.OCP-takeover-OBD-deployment-cluster.md => 400.user-guide/400.OCP-takeover-OBD-deployment-cluster.md} (94%) rename docs/en-US/{3.user-guide/5.add-white-screen-monitoring.md => 400.user-guide/500.add-white-screen-monitoring.md} (76%) create mode 100644 docs/en-US/400.user-guide/600.update-ocp-express.md create mode 100644 docs/en-US/400.user-guide/700.update-oceanbase.md rename docs/en-US/{5.faq/1.faq.md => 500.faq/100.faq.md} (82%) rename docs/en-US/{5.faq/2.how-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md => 500.faq/200.how-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md} (100%) delete mode 100644 docs/en-US/6.error-messages-in-obd.md delete mode 100644 docs/zh-CN/1.what-is-obd.md create mode 100644 docs/zh-CN/100.what-is-obd.md create mode 100644 docs/zh-CN/1000.configure-rules.md create mode 100644 docs/zh-CN/1100.error-messages-in-obd.md delete mode 100644 docs/zh-CN/2.install-obd.md delete mode 100644 docs/zh-CN/2.quick-start/2.quickly-start-the-oceanbase-database.md rename docs/zh-CN/{2.quick-start/1.install-obd.md => 200.quick-start/100.install-obd.md} (100%) create mode 100644 docs/zh-CN/200.quick-start/200.quickly-start-the-oceanbase-database.md rename docs/zh-CN/{2.quick-start/3.use-ui-deploy-oceanbase.md => 200.quick-start/300.use-ui-deploy-oceanbase.md} (69%) delete mode 100644 docs/zh-CN/3.user-guide/1.quickly-start-the-oceanbase-database.md delete mode 100644 docs/zh-CN/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md delete mode 100644 docs/zh-CN/3.user-guide/3.obd-command/0.obd-demo.md delete mode 100644 docs/zh-CN/3.user-guide/3.obd-command/1.cluster-command-groups.md delete mode 100644 docs/zh-CN/3.user-guide/3.obd-command/2.command-group-for-mirroring-and-warehousing.md delete mode 100644 docs/zh-CN/3.user-guide/3.obd-command/3.test-command-group.md delete mode 100644 docs/zh-CN/3.user-guide/3.obd-command/4.tools-commands.md delete mode 100644 docs/zh-CN/3.user-guide/3.obd-command/5.obdiag-commands.md delete mode 100644 docs/zh-CN/3.user-guide/4.OCP-takeover-OBD-deployment-cluster.md rename docs/zh-CN/{3.obd-command/0.obd-demo.md => 300.obd-command/000.obd-demo.md} (95%) rename docs/zh-CN/{3.obd-command/1.cluster-command-groups.md => 300.obd-command/100.cluster-command-groups.md} (98%) rename docs/zh-CN/{3.obd-command/2.command-group-for-mirroring-and-warehousing.md => 300.obd-command/200.command-group-for-mirroring-and-warehousing.md} (100%) rename docs/zh-CN/{3.obd-command/3.test-command-group.md => 300.obd-command/300.test-command-group.md} (93%) rename docs/zh-CN/{3.obd-command/4.tools-commands.md => 300.obd-command/400.tools-commands.md} (93%) create mode 100644 docs/zh-CN/300.obd-command/500.obdiag-command.md create mode 100644 docs/zh-CN/300.obd-command/600.telemetry-commands.md delete mode 100644 docs/zh-CN/4.configuration-file-description.md delete mode 100644 docs/zh-CN/4.user-guide/3.deploy-ocp-express-by-using-obd.md rename docs/zh-CN/{4.user-guide/1.configuration-file-description.md => 400.user-guide/100.configuration-file-description.md} (93%) rename docs/zh-CN/{4.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md => 400.user-guide/200.start-the-oceanbase-cluster-by-using-obd.md} (85%) create mode 100644 docs/zh-CN/400.user-guide/300.deploy-ocp-express-by-using-obd.md rename docs/zh-CN/{4.user-guide/4.OCP-takeover-OBD-deployment-cluster.md => 400.user-guide/400.OCP-takeover-OBD-deployment-cluster.md} (94%) rename docs/zh-CN/{4.user-guide/5.add-white-screen-monitoring.md => 400.user-guide/500.add-white-screen-monitoring.md} (76%) create mode 100644 docs/zh-CN/400.user-guide/600.update-ocp-express.md create mode 100644 docs/zh-CN/400.user-guide/700.update-oceanbase.md rename docs/zh-CN/{5.faq/1.faq.md => 500.faq/100.faq.md} (56%) rename docs/zh-CN/{5.faq/2.how-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md => 500.faq/200.how-to-upgrade-obproxy-to-obproxy-ce-3.2.3.md} (91%) delete mode 100644 docs/zh-CN/6.error-messages-in-obd.md create mode 100644 example/ob-configserver/distributed-with-obproxy-and-configserver-example.yaml create mode 100644 example/ob-configserver/ob-configserver-only-example.yaml create mode 100644 optimize/oceanbase-ce/4.2.0/tpch.yaml create mode 100644 plugins/ob-configserver/1.0.0/bootstrap.py create mode 100644 plugins/ob-configserver/1.0.0/connect.py create mode 100644 plugins/ob-configserver/1.0.0/destroy.py create mode 100644 plugins/ob-configserver/1.0.0/display.py create mode 100644 plugins/ob-configserver/1.0.0/file_map.yaml create mode 100644 plugins/ob-configserver/1.0.0/generate_config.py create mode 100644 plugins/ob-configserver/1.0.0/init.py create mode 100644 plugins/ob-configserver/1.0.0/parameter.yaml create mode 100644 plugins/ob-configserver/1.0.0/reload.py create mode 100644 plugins/ob-configserver/1.0.0/restart.py create mode 100644 plugins/ob-configserver/1.0.0/start.py create mode 100644 plugins/ob-configserver/1.0.0/start_check.py create mode 100644 plugins/ob-configserver/1.0.0/status.py create mode 100644 plugins/ob-configserver/1.0.0/stop.py create mode 100644 plugins/oceanbase/4.2.0.0/check_exit_standby.py create mode 100644 plugins/oceanbase/4.2.0.0/create_standby_tenant_pre.py create mode 100644 plugins/oceanbase/4.2.0.0/create_tenant.py create mode 100644 plugins/oceanbase/4.2.0.0/delete_standby_info.py create mode 100644 plugins/oceanbase/4.2.0.0/failover_decouple_tenant.py create mode 100644 plugins/oceanbase/4.2.0.0/failover_decouple_tenant_pre.py create mode 100644 plugins/oceanbase/4.2.0.0/get_deployment_connections.py create mode 100644 plugins/oceanbase/4.2.0.0/get_relation_tenants.py create mode 100644 plugins/oceanbase/4.2.0.0/get_standbys.py create mode 100644 plugins/oceanbase/4.2.0.0/list_tenant.py create mode 100644 plugins/oceanbase/4.2.0.0/print_standby_graph.py create mode 100644 plugins/oceanbase/4.2.0.0/standby_version_check.py create mode 100644 plugins/oceanbase/4.2.0.0/switchover_tenant.py create mode 100644 plugins/oceanbase/4.2.0.0/switchover_tenant_pre.py create mode 100644 plugins/oceanbase/4.2.0.0/upgrade_check.py create mode 100644 plugins/tpch/4.2.0.0/analyze.sql create mode 100644 plugins/tpch/4.2.0.0/run_test.py create mode 100644 web/src/pages/components/ClusterConfig/ConfigTable.tsx create mode 100644 web/src/pages/components/ClusterConfig/Footer.tsx create mode 100644 web/src/pages/components/ClusterConfig/Parameter.tsx create mode 100644 web/src/pages/components/ClusterConfig/helper.ts create mode 100644 web/src/pages/components/ClusterConfig/index.tsx diff --git a/_cmd.py b/_cmd.py index 87894af..36b82fd 100644 --- a/_cmd.py +++ b/_cmd.py @@ -29,8 +29,10 @@ from uuid import uuid1 as uuid, UUID from optparse import OptionParser, BadOptionError, Option, IndentedHelpFormatter +from colorama import Fore + from core import ObdHome -from _stdio import IO +from _stdio import IO, FormtatText from _lock import LockMode from tool import DirectoryUtil, FileUtil, NetUtil, COMMAND_ENV from _errno import DOC_LINK_MSG, LockError @@ -780,6 +782,8 @@ def _do_command(self, obd): obd.set_options(self.opts) res = obd.deploy_cluster(self.cmds[0]) self.background_telemetry_task(obd) + if res: + obd.stdio.print(FormtatText('Please execute ` obd cluster start %s ` to start' % self.cmds[0], Fore.GREEN)) return res else: return self._show_help() @@ -826,6 +830,7 @@ class ClusterDestroyCommand(ClusterMirrorCommand): def __init__(self): super(ClusterDestroyCommand, self).__init__('destroy', 'Destroy a deployed cluster.') self.parser.add_option('-f', '--force-kill', action='store_true', help="Force kill the running observer process in the working directory.") + self.parser.add_option('--ignore-standby', '--igs', action='store_true', help="Force kill the observer while standby tenant in others cluster exists.") def _do_command(self, obd): if self.cmds: @@ -873,6 +878,7 @@ def __init__(self): super(ClusterRedeployCommand, self).__init__('redeploy', 'Redeploy a started cluster.') self.parser.add_option('-f', '--force-kill', action='store_true', help="Force kill the running observer process in the working directory.") self.parser.add_option('--confirm', action='store_true', help='Confirm to redeploy.') + self.parser.add_option('--ignore-standby', '--igs', action='store_true', help="Force kill the observer while standby tenant in others cluster exists.") def _do_command(self, obd): if self.cmds: @@ -951,6 +957,7 @@ def __init__(self): self.parser.add_option('--disable', type='string', help="Hash list for disabled mirrors, separated with `,`.", default='') self.parser.add_option('-e', '--executer-path', type='string', help="Executer path.", default=os.path.join(ObdCommand.OBD_INSTALL_PATH, 'lib/executer')) self.parser.add_option('-t', '--script-query-timeout', type='string', help="The timeout(s) for executing sql in upgrade scripts. Supported since version 4.1.0", default='') + self.parser.add_option('--ignore-standby', '--igs', action='store_true', help="Force upgrade, before upgrade standby tenant`s cluster.") def _do_command(self, obd): if self.cmds: @@ -996,11 +1003,100 @@ def _do_command(self, obd): return self._show_help() +class ClusterTenantCreateStandByCommand(ClusterTenantCreateCommand): + + def __init__(self): + super(ClusterTenantCreateStandByCommand, self).__init__() + self.name = 'create-standby' + self.summary = 'Create a standby tenant.' + self.parser.remove_option('-t') + self.parser.remove_option('--max-memory') + self.parser.remove_option('--min-memory') + self.parser.remove_option('--max-disk-size') + self.parser.remove_option('--max-session-num') + self.parser.remove_option('--mode') + self.parser.remove_option('--charset') + self.parser.remove_option('--collate') + self.parser.remove_option('--logonly-replica-num') + self.parser.remove_option('--tablegroup') + self.parser.remove_option('-s') + self.parser.add_option('-t', '-n', '--tenant-name', type='string', help="The standby tenant name. The default tenant name is consistent with the primary tenant name.", default='') + self.parser.add_option('--standbyro-password', type='string', help="standbyro user password.") + self.parser.add_option('-p', '--tenant-root-password', type='string', help="tenant root password,for crate standby user.") + + + def init(self, cmd, args): + super(ClusterTenantCreateStandByCommand, self).init(cmd, args) + self.parser.set_usage('%s [options]' % self.prev_cmd) + return self + + def _do_command(self, obd): + if len(self.cmds) == 3: + return obd.create_standby_tenant(self.cmds[0], self.cmds[1], self.cmds[2]) + else: + return self._show_help() + + +class ClusterTenantSwitchoverCommand(ClusterMirrorCommand): + + def __init__(self): + super(ClusterTenantSwitchoverCommand, self).__init__('switchover', 'Switchover primary-standby tenant.') + self.parser.add_option('-p', '--tenant-root-password', type='string', help="tenant root password") + self.parser.add_option('--standbyro-password', type='string', help="standbyro user password.") + + def init(self, cmd, args): + super(ClusterTenantSwitchoverCommand, self).init(cmd, args) + self.parser.set_usage('%s [options]' % self.prev_cmd) + return self + + def _do_command(self, obd): + if len(self.cmds) == 2: + return obd.switchover_tenant(self.cmds[0], self.cmds[1]) + else: + return self._show_help() + + +class ClusterTenantFailoverCommand(ClusterMirrorCommand): + def __init__(self): + super(ClusterTenantFailoverCommand, self).__init__('failover', 'failover standby tenant.') + self.parser.add_option('-p', '--tenant-root-password', type='string', help="tenant root password") + + def init(self, cmd, args): + super(ClusterTenantFailoverCommand, self).init(cmd, args) + self.parser.set_usage('%s [options]' % self.prev_cmd) + return self + + def _do_command(self, obd): + if len(self.cmds) == 2: + return obd.failover_decouple_tenant(self.cmds[0], self.cmds[1], 'failover') + else: + return self._show_help() + + +class ClusterTenantDecoupleCommand(ClusterMirrorCommand): + + def __init__(self): + super(ClusterTenantDecoupleCommand, self).__init__('decouple', 'decouple standby tenant.') + self.parser.add_option('-p', '--tenant-root-password', type='string', help="tenant root password") + + def init(self, cmd, args): + super(ClusterTenantDecoupleCommand, self).init(cmd, args) + self.parser.set_usage('%s [options]' % self.prev_cmd) + return self + + def _do_command(self, obd): + if len(self.cmds) == 2: + return obd.failover_decouple_tenant(self.cmds[0], self.cmds[1], 'decouple') + else: + return self._show_help() + + class ClusterTenantDropCommand(ClusterMirrorCommand): def __init__(self): super(ClusterTenantDropCommand, self).__init__('drop', 'Drop a tenant.') self.parser.add_option('-t', '-n', '--tenant-name', type='string', help="Tenant name.") + self.parser.add_option('--ignore-standby', '--igs', action='store_true', help="Force drop tenant when it has standby tenant, the standby tenants will become unavailable.") def _do_command(self, obd): if self.cmds: @@ -1013,6 +1109,8 @@ class ClusterTenantListCommand(ClusterMirrorCommand): def __init__(self): super(ClusterTenantListCommand, self).__init__('show', 'Show the list of tenant.') + self.parser.add_option('-t', '--tenant', type='string', help='Tenant name', default='') + self.parser.add_option('-g', '--graph', action='store_true', help='view standby by graph') def _do_command(self, obd): if self.cmds: @@ -1028,6 +1126,10 @@ def __init__(self): self.register_command(ClusterTenantCreateCommand()) self.register_command(ClusterTenantDropCommand()) self.register_command(ClusterTenantListCommand()) + self.register_command(ClusterTenantCreateStandByCommand()) + self.register_command(ClusterTenantSwitchoverCommand()) + self.register_command(ClusterTenantFailoverCommand()) + self.register_command(ClusterTenantDecoupleCommand()) class ClusterMajorCommand(MajorCommand): diff --git a/_deploy.py b/_deploy.py index 7c5559a..cfb2bbc 100644 --- a/_deploy.py +++ b/_deploy.py @@ -19,6 +19,7 @@ from __future__ import absolute_import, division, print_function +from collections.abc import Iterable, Iterator import os import re @@ -111,48 +112,107 @@ class InnerConfigItem(str): pass +class InnerConfigKey(object): + + keyword_symbol = "$_" + + @classmethod + def is_keyword(cls, s): + return s.startswith(cls.keyword_symbol) + + @classmethod + def to_keyword(cls, key): + return "{}{}".format(cls.keyword_symbol, key) + + @classmethod + def keyword_to_str(cls, _keyword): + return str(_keyword.replace(cls.keyword_symbol, '', 1)) + + +class ComponentInnerConfig(dict): + + COMPONENT_GLOBAL_ATTRS = InnerConfigKey.to_keyword('component_global_attrs') + + def __init__(self, component_name, config): + super(ComponentInnerConfig, self).__init__() + self.component_name = component_name + c_config = {} + for server in config: + i_config = {} + s_config = config[server] + for key in s_config: + i_config[InnerConfigItem(key)] = s_config[key] + c_config[server] = i_config + self.update(c_config) + + def __iter__(self): + keys = self.keys() + servers = [] + for key in keys: + if key != self.COMPONENT_GLOBAL_ATTRS: + servers.append(key) + return iter(servers) + + def update_server_config(self, server, key, value): + self._update_config(server, key, value) + + def update_attr(self, key, value): + self._update_config(self.COMPONENT_GLOBAL_ATTRS, key, value) + + def del_server_config(self, server, key): + self._del_config(server, key) + + def del_attr(self, key): + self._del_config(self.COMPONENT_GLOBAL_ATTRS, key) + + def get_attr(self, key): + return self._get_config(self.COMPONENT_GLOBAL_ATTRS, key) + + def _update_config(self, item, key, value): + if not self.__contains__(item): + self[item] = {} + if not InnerConfigKey.is_keyword(key): + key = InnerConfigKey.to_keyword(key) + self[item][key] = value + + def _del_config(self, item, key): + if not self.__contains__(item): + return + if not InnerConfigKey.is_keyword(key): + key = InnerConfigKey.to_keyword(key) + if key in self[item]: + del self[item][key] + + def _get_config(self, item, key): + if not self.__contains__(item): + return + if not InnerConfigKey.is_keyword(key): + key = InnerConfigKey.to_keyword(key) + return self[item].get(key) + class InnerConfigKeywords(object): DEPLOY_INSTALL_MODE = 'deploy_install_mode' DEPLOY_BASE_DIR = 'deploy_base_dir' - class InnerConfig(object): - keyword_symbol = "$_" - def __init__(self, path, yaml_loader): self.path = path self.yaml_loader = yaml_loader self.config = {} self._load() - def is_keyword(self, s): - return s.startswith(self.keyword_symbol) - - def to_keyword(self, key): - return "{}{}".format(self.keyword_symbol, key) - - def keyword_to_str(self, _keyword): - return str(_keyword.replace(self.keyword_symbol, '', 1)) - def _load(self): self.config = {} try: with FileUtil.open(self.path, 'rb') as f: config = self.yaml_loader.load(f) for component_name in config: - if self.is_keyword(component_name): + if InnerConfigKey.is_keyword(component_name): self.config[InnerConfigItem(component_name)] = config[component_name] - continue - self.config[component_name] = {} - c_config = config[component_name] - for server in c_config: - i_config = {} - s_config = c_config[server] - for key in s_config: - i_config[InnerConfigItem(key)] = s_config[key] - self.config[component_name][server] = i_config + else: + self.config[component_name] = ComponentInnerConfig(component_name, config[component_name]) except: pass @@ -176,11 +236,11 @@ def get_server_config(self, component_name, server): return self.get_component_config(component_name).get(server, {}) def get_global_config(self, key, default=None): - key = self.to_keyword(key) + key = InnerConfigKey.to_keyword(key) return self.config.get(key, default) def update_global_config(self, key, value): - self.config[self.to_keyword(key)] = value + self.config[InnerConfigKey.to_keyword(key)] = value def update_component_config(self, component_name, config): self.config[component_name] = {} @@ -192,6 +252,8 @@ def update_component_config(self, component_name, config): key = InnerConfigItem(key) c_config[key] = data[key] self.config[component_name][server] = c_config + if ComponentInnerConfig.COMPONENT_GLOBAL_ATTRS in config: + self.config[component_name][ComponentInnerConfig.COMPONENT_GLOBAL_ATTRS] = config[ComponentInnerConfig.COMPONENT_GLOBAL_ATTRS] class ConfigParser(object): @@ -449,6 +511,10 @@ def set_base_dir(self, base_dir): self._include_config = None self._global_conf = None + @property + def deploy_name(self): + return self._deploy_config.name + @property def original_servers(self): return self._original_servers @@ -465,7 +531,14 @@ def _clear_cache_server(self): def get_inner_config(self): return self._inner_config - + + def update_component_attr(self, key, value, save=True): + self._inner_config.update_attr(key, value) + return self._deploy_config.dump() if save else True + + def get_component_attr(self, key): + return self._inner_config.get_attr(key) + def is_cp_install_mode(self): return self._deploy_config.is_cp_install_mode() @@ -889,6 +962,7 @@ def __init__(self, yaml_path, yaml_loader=yaml, inner_config=None, config_parser self._inner_config = inner_config self.components = OrderedDict() self._src_data = None + self.name = os.path.split(os.path.split(yaml_path)[0])[-1] self.yaml_path = yaml_path self.yaml_loader = yaml_loader self.config_parser_manager = config_parser_manager if config_parser_manager else DEFAULT_CONFIG_PARSER_MANAGER diff --git a/_errno.py b/_errno.py index 9abce07..314ecf8 100644 --- a/_errno.py +++ b/_errno.py @@ -127,6 +127,7 @@ class InitDirFailedErrorMessage(object): EC_AIO_NOT_ENOUGH = OBDErrorCodeTemplate(1011, '({ip}) Insufficient AIO remaining (Avail: {avail}, Need: {need}), The recommended value of fs.aio-max-nr is 1048576') EC_PARAM_CHECK = OBDErrorCodeTemplate(1012, '{errors}') EC_SSH_CONNECT = OBDErrorCodeTemplate(1013, '{user}@{ip} connect failed: {message}') +EC_CHECK_STANDBY = OBDErrorCodeTemplate(1015, 'Unable to confirm the primary-standby relationship, rerun with "--ignore-standby" option if you want to proceed despite the risks.') # error code for observer EC_OBSERVER_NOT_ENOUGH_MEMORY = OBDErrorCodeTemplate(2000, '({ip}) not enough memory. (Free: {free}, Need: {need})') @@ -175,9 +176,19 @@ class InitDirFailedErrorMessage(object): EC_OCP_EXPRESS_META_DB_NOT_ENOUGH_LOG_DISK = OBDErrorCodeTemplate(4305, 'There is not enough log disk for ocp meta tenant.') EC_OCP_EXPRESS_META_DB_NOT_ENOUGH_MEM = OBDErrorCodeTemplate(4305, 'There is not enough memory for ocp meta tenant') EC_OCP_EXPRESS_ADMIN_PASSWD_ERROR = OBDErrorCodeTemplate(4306, '({ip}) ocp-express admin_passwd invalid.(Current :{current})') - # 4350-4399 had been used by ocp +#ob-configserver +EC_OBC_PROGRAM_START_ERROR = OBDErrorCodeTemplate(4401, 'Failed to start {server} ob-configserver.') +EC_OBC_VIP_SET_ERROR = OBDErrorCodeTemplate(4402, '{server} ob-configserver config error: vip_address and vip_port must be set together') +EC_OBC_CONNECTION_URL_EMPTY = OBDErrorCodeTemplate(4402, '{server} ob-configserver config error: connection_url is empty') +EC_OBC_CONNECTION_URL_ERROR = OBDErrorCodeTemplate(4402, '{server} ob-configserver config error: connection_url must be an absolute path') +EC_OBC_DATABASE_TYPE_ERROR = OBDErrorCodeTemplate(4402, '{server} ob-configserver config error: database_type can only be set to `mysql` or `sqlite3`, and must be in lowercase. ') +EC_OBC_SQLITE_PERMISSION_DENIED = OBDErrorCodeTemplate(4403, '{ip}: {path}: permission denied.') +EC_OBC_DATABASE_CONNECT_ERROR = OBDErrorCodeTemplate(4404, '{server}: failed to connect to database: {url}') + + + # sql EC_SQL_EXECUTE_FAILED = OBDErrorCodeTemplate(5000, "{sql} execute failed") @@ -186,6 +197,9 @@ class InitDirFailedErrorMessage(object): EC_OBDIAG_NOT_CONTAIN_DEPEND_COMPONENT = OBDErrorCodeTemplate(6001, 'obdiag must contain depend components {components}') EC_OBDIAG_OPTIONS_FORMAT_ERROR = OBDErrorCodeTemplate(6002, 'obdiag options {option} format error, please check the value : {value}') +# Unexpected exceptions code +EC_UNEXPECTED_EXCEPTION = OBDErrorCodeTemplate(9999, 'Unexpected exception: need to be posted on "https://ask.oceanbase.com", and we will help you resolve them.') + # WARN CODE WC_ULIMIT_CHECK = OBDErrorCodeTemplate(1007, '({server}) The recommended number of {key} is {need} (Current value: {now})') WC_AIO_NOT_ENOUGH = OBDErrorCodeTemplate(1011, '({ip}) The recommended value of fs.aio-max-nr is 1048576 (Current value: {current})') diff --git a/_mirror.py b/_mirror.py index 9ee44af..2ac336d 100644 --- a/_mirror.py +++ b/_mirror.py @@ -56,6 +56,8 @@ 'sles': (([15, 2], 7), ), 'fedora': (([33], 7), ), 'uos': (([20], 8), ), + 'anolis': (([23], 7), ), + 'openEuler': (([22, 3], 7), ), } _SERVER_VARS = { 'basearch': getBaseArch(), diff --git a/core.py b/core.py index 4466f73..3d699b5 100644 --- a/core.py +++ b/core.py @@ -923,6 +923,24 @@ def servers_apply_lib_repository_and_check(self, ssh_clients, deploy_config, rep client = ssh_clients[server] return ret + # check cluster server status, running/stopped + def cluster_server_status_check(self, status='running'): + if status not in ['running', 'stopped']: + self.stdio.error(err.EC_INVALID_PARAMETER.format('status', status)) + return False + component_status = {} + cluster_status = self.cluster_status_check(self.repositories, component_status) + value = 0 if status == 'running' else 1 + if cluster_status is False or cluster_status == value: + self.stdio.error(err.EC_SOME_SERVER_STOPED.format()) + for repository in component_status: + cluster_status = component_status[repository] + for server in cluster_status: + if cluster_status[server] == value: + self. stdio.error('server status error: %s %s is %s' % (server, repository.name, status)) + return False + return True + # If the cluster states are consistent, the status value is returned. Else False is returned. def cluster_status_check(self, repositories, ret_status={}): self._call_stdio('start_loading', 'Cluster status check') @@ -1684,7 +1702,7 @@ def _start_cluster(self, deploy, repositories): if deploy_config.auto_create_tenant: create_tenant_options = Values({"variables": "ob_tcp_invited_nodes='%'", "create_if_not_exists": True}) - self.call_plugin(create_tenant_plugins[repository], repository, create_tenant_options=create_tenant_options, cursor=cursor) + self.call_plugin(create_tenant_plugins[repository], repository, cursor=cursor, create_tenant_options=create_tenant_options) if not start_all: component_num -= 1 @@ -1751,6 +1769,145 @@ def create_tenant(self, name): return False return True + def get_component_repositories(self, deploy_info, components): + repositories = self.load_local_repositories(deploy_info) + component_repositories = [] + for repository in repositories: + if repository.name in components: + component_repositories.append(repository) + return component_repositories + + def create_standby_tenant(self, standby_deploy_name, primary_deploy_name, primary_tenant): + standby_deploy = self.deploy_manager.get_deploy_config(standby_deploy_name) + if not standby_deploy: + self._call_stdio('error', 'No such deploy: %s.' % standby_deploy_name) + return None + self.set_deploy(standby_deploy) + primary_deploy = self.deploy_manager.get_deploy_config(primary_deploy_name) + if not primary_deploy: + self._call_stdio('error', 'No such deploy: %s.' % primary_deploy_name) + return None + if standby_deploy.deploy_info.status != DeployStatus.STATUS_RUNNING: + self._call_stdio('error', 'Deploy "%s" is %s' % (standby_deploy_name, standby_deploy.deploy_info.status.value)) + return False + if primary_deploy.deploy_info.status != DeployStatus.STATUS_RUNNING: + self._call_stdio('error', 'Deploy "%s" is %s' % (primary_deploy_name, primary_deploy.deploy_info.status.value)) + return False + primary_repositories = self.load_local_repositories(primary_deploy.deploy_info) + standby_repositories = self.get_component_repositories(standby_deploy.deploy_info, ['oceanbase-ce', 'oceanbase']) + standby_version_check_plugins = self.search_py_script_plugin(standby_repositories, 'standby_version_check') + self.set_repositories(standby_repositories) + for repository in standby_version_check_plugins: + if not self.call_plugin(standby_version_check_plugins[repository], repository, primary_repositories=primary_repositories): + return + # Check the status for standby cluster + if not self.cluster_server_status_check(): + return + create_standby_tenant_pre_plugins = self.search_py_script_plugin(standby_repositories, 'create_standby_tenant_pre') + connect_plugins = self.search_py_script_plugin(standby_repositories, 'connect') + get_relation_tenants_plugins = self.search_py_script_plugin(standby_repositories, 'get_relation_tenants') + create_tenant_plugins = self.search_py_script_plugin(standby_repositories, 'create_tenant') + get_deployment_connections_plugins = self.search_py_script_plugin(standby_repositories, 'get_deployment_connections') + for repository in get_relation_tenants_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, deployment_name=primary_deploy_name, get_deploy=self.deploy_manager.get_deploy_config, tenant_name=primary_tenant): + return False + for repository in get_deployment_connections_plugins: + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository], relation_deploy_names=[primary_deploy_name, standby_deploy_name]): + return False + + for repository in create_standby_tenant_pre_plugins: + if not self.call_plugin(create_standby_tenant_pre_plugins[repository], repository, + primary_deploy_name=primary_deploy_name, + primary_tenant=primary_tenant): + return False + + for repository in create_tenant_plugins: + if not self.call_plugin(create_tenant_plugins[repository], repository, cursor=None): + return False + return True + + def switchover_tenant(self, standby_deploy_name, tenant_name): + # check oceanbase connect status + deploy = self.deploy_manager.get_deploy_config(standby_deploy_name) + if not deploy: + self._call_stdio('error', 'No such deploy: %s.' % standby_deploy_name) + return False + self.set_deploy(deploy) + if deploy.deploy_info.status != DeployStatus.STATUS_RUNNING: + self._call_stdio('error', 'Deploy "%s" is %s' % (standby_deploy_name, deploy.deploy_info.status.value)) + return False + standby_repositories = self.get_component_repositories(deploy.deploy_info, ['oceanbase-ce', 'oceanbase']) + self.set_repositories(standby_repositories) + get_relation_tenants_plugins = self.search_py_script_plugin(standby_repositories, 'get_relation_tenants') + get_deployment_connections_plugins = self.search_py_script_plugin(standby_repositories, 'get_deployment_connections') + switchover_tenant_pre_plugins = self.search_py_script_plugin(standby_repositories, 'switchover_tenant_pre') + switchover_tenant_plugins = self.search_py_script_plugin(standby_repositories, 'switchover_tenant') + get_standbys_plugins = self.search_py_script_plugin(standby_repositories, 'get_standbys') + connect_plugins = self.search_py_script_plugin(standby_repositories, 'connect') + # Check the status for standby cluster + if not self.cluster_server_status_check(): + return False + setattr(self.options, 'tenant_name', tenant_name) + for repository in get_relation_tenants_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config): + return False + + for repository in get_deployment_connections_plugins: + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository]): + return False + + for repository in switchover_tenant_pre_plugins: + if not self.call_plugin(switchover_tenant_pre_plugins[repository], repository): + return False + + for repository in switchover_tenant_plugins: + if not self.call_plugin(switchover_tenant_plugins[repository], repository, get_standbys_plugins=get_standbys_plugins): + return False + return True + + def failover_decouple_tenant(self, standby_deploy_name, tenant_name, option_type='failover'): + deploy = self.deploy_manager.get_deploy_config(standby_deploy_name) + if not deploy: + self._call_stdio('error', 'No such deploy: %s.' % standby_deploy_name) + return False + self.set_deploy(deploy) + if deploy.deploy_info.status != DeployStatus.STATUS_RUNNING: + self._call_stdio('error', 'Deploy "%s" is %s' % (standby_deploy_name, deploy.deploy_info.status.value)) + return False + standby_repositories = self.get_component_repositories(deploy.deploy_info, ['oceanbase-ce', 'oceanbase']) + self.set_repositories(standby_repositories) + self.search_py_script_plugin(standby_repositories, 'standby_version_check') + get_deployment_connections_plugins = self.search_py_script_plugin(standby_repositories, 'get_deployment_connections') + failover_decouple_tenant_pre_plugins = self.search_py_script_plugin(standby_repositories, 'failover_decouple_tenant_pre') + connect_plugins = self.search_py_script_plugin(standby_repositories, 'connect') + get_relation_tenants_plugins = self.search_py_script_plugin(standby_repositories, 'get_relation_tenants') + failover_decouple_tenant_plugins = self.search_py_script_plugin(standby_repositories, 'failover_decouple_tenant') + # Check the status for standby cluster + if not self.cluster_server_status_check(): + return + setattr(self.options, 'tenant_name', tenant_name) + for repository in get_relation_tenants_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config): + return False + + for repository in get_deployment_connections_plugins: + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository]): + return False + + for repository in failover_decouple_tenant_pre_plugins: + if not self.call_plugin(failover_decouple_tenant_pre_plugins[repository], repository, option_type=option_type): + return False + + for repository in failover_decouple_tenant_plugins: + if not self.call_plugin(failover_decouple_tenant_plugins[repository], repository, option_type=option_type): + return False + + delete_standby_info_plugins = self.search_py_script_plugin(standby_repositories, 'delete_standby_info', no_found_act='ignore') + for repository in delete_standby_info_plugins: + if not self.call_plugin(delete_standby_info_plugins[repository], repository, delete_password=False): + self._call_stdio('warn', 'Delete relation of standby tenant failed') + return True + def drop_tenant(self, name): self._call_stdio('verbose', 'Get Deploy by name') deploy = self.deploy_manager.get_deploy_config(name) @@ -1777,13 +1934,15 @@ def drop_tenant(self, name): connect_plugins = self.search_py_script_plugin(repositories, 'connect') drop_tenant_plugins = self.search_py_script_plugin(repositories, 'drop_tenant', no_found_act='ignore') + get_standbys_plugins = self.search_py_script_plugin(repositories, 'get_standbys', no_found_act='ignore') + get_relation_tenants_plugins = self.search_py_script_plugin(repositories, 'get_relation_tenants', no_found_act='ignore') + get_deployment_connections_plugins = self.search_py_script_plugin(repositories, 'get_deployment_connections', no_found_act='ignore') + check_exit_standby_plugins = self.search_py_script_plugin(repositories, 'check_exit_standby', no_found_act='ignore') self._call_stdio('stop_loading', 'succeed') # Get the client ssh_clients = self.get_clients(deploy_config, repositories) - for repository in drop_tenant_plugins: - cluster_config = deploy_config.components[repository.name] db = None cursor = None ret = self.call_plugin(connect_plugins[repository], repository) @@ -1793,8 +1952,34 @@ def drop_tenant(self, name): if not db: return False + if repository in get_relation_tenants_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config): + self._call_stdio('error', err.EC_UNEXPECTED_EXCEPTION) + return False + if not getattr(self.options, 'ignore_standby', False): + # check if the current tenant has a standby tenant in other cluster + if repository in get_relation_tenants_plugins and repository in get_deployment_connections_plugins\ + and repository in get_standbys_plugins and repository in check_exit_standby_plugins: + + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository]): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + + if not self.call_plugin(get_standbys_plugins[repository], repository, primary_deploy_name=name): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + + if not self.call_plugin(check_exit_standby_plugins[repository], repository): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if not self.call_plugin(drop_tenant_plugins[repository], repository, cursor=cursor): return False + delete_standby_info_plugins = self.search_py_script_plugin(repositories, 'delete_standby_info', no_found_act='ignore') + for repository in delete_standby_info_plugins: + ret = self.call_plugin(delete_standby_info_plugins[repository], repository) + if not ret: + self._call_stdio('warn', 'Delete relation of standby tenant failed') return True def list_tenant(self, name): @@ -1822,11 +2007,21 @@ def list_tenant(self, name): self.search_param_plugin_and_apply(repositories, deploy_config) connect_plugins = self.search_py_script_plugin(repositories, 'connect') list_tenant_plugins = self.search_py_script_plugin(repositories, 'list_tenant', no_found_act='ignore') - self._call_stdio('stop_loading', 'succeed') - + print_standby_graph_plugins = self.search_py_script_plugin(repositories, 'print_standby_graph', no_found_act='ignore') + get_deployment_connections_plugins = self.search_py_script_plugin(repositories, 'get_deployment_connections', no_found_act='ignore') + get_relation_tenants_plugins = self.search_py_script_plugin(repositories, 'get_relation_tenants', no_found_act='ignore') # Get the client ssh_clients = self.get_clients(deploy_config, repositories) + + for repository in get_relation_tenants_plugins: + if repository in get_deployment_connections_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config): + return False + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository]): + return False + self._call_stdio('stop_loading', 'succeed') + for repository in list_tenant_plugins: cluster_config = deploy_config.components[repository.name] db = None @@ -1837,8 +2032,12 @@ def list_tenant(self, name): cursor = ret.get_return('cursor') if not db: return False - - if not self.call_plugin(list_tenant_plugins[repository], repository, cursor=cursor): + if not self.call_plugin(list_tenant_plugins[repository], repository, cursor=cursor, name=name): + return False + + for repository in print_standby_graph_plugins: + if not self.call_plugin(print_standby_graph_plugins[repository], repository): + self._call_stdio('error', 'print standby tenant graph error.') return False return True @@ -2291,7 +2490,7 @@ def redeploy_cluster(self, name, search_repo=True, need_confirm=False): if not deploy: self._call_stdio('error', 'No such deploy: %s.' % name) return False - + if need_confirm and not self._call_stdio('confirm', 'Are you sure to destroy the "%s" cluster and rebuild it?' % name): return False deploy_info = deploy.deploy_info @@ -2304,6 +2503,30 @@ def redeploy_cluster(self, name, search_repo=True, need_confirm=False): self.set_repositories(repositories) self._call_stdio('stop_loading', 'succeed') + get_relation_tenants_plugins = self.search_py_script_plugin(repositories, 'get_relation_tenants', no_found_act='ignore') + for repository in get_relation_tenants_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config): + self._call_stdio('error', err.EC_UNEXPECTED_EXCEPTION) + return False + if not getattr(self.options, 'ignore_standby', False): + # check if the current cluster's tenant has a standby tenant in other cluster + self._call_stdio('start_loading', 'check is exit standby tenant') + connect_plugins = self.search_py_script_plugin(repositories, 'connect') + get_standbys_plugins = self.search_py_script_plugin(repositories, 'get_standbys', no_found_act='ignore') + get_deployment_connections_plugins = self.search_py_script_plugin(repositories, 'get_deployment_connections', no_found_act='ignore') + check_exit_standby_plugins = self.search_py_script_plugin(repositories, 'check_exit_standby', no_found_act='ignore') + for repository in get_relation_tenants_plugins: + if repository in get_deployment_connections_plugins and repository in get_standbys_plugins and repository in check_exit_standby_plugins: + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository]): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if not self.call_plugin(get_standbys_plugins[repository], repository, primary_deploy_name=name, skip_no_primary_cursor=True): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if not self.call_plugin(check_exit_standby_plugins[repository], repository): + return False + self._call_stdio('stop_loading', 'succeed') + self._call_stdio('verbose', 'Check deploy status') if deploy_info.status in [DeployStatus.STATUS_RUNNING, DeployStatus.STATUS_UPRADEING]: obd = self.fork(options=Values({'force': True})) @@ -2351,6 +2574,31 @@ def destroy_cluster(self, name): self.set_repositories(repositories) self._call_stdio('stop_loading', 'succeed') + get_relation_tenants_plugins = self.search_py_script_plugin(repositories, 'get_relation_tenants', no_found_act='ignore') + for repository in get_relation_tenants_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config): + self._call_stdio('error', err.EC_UNEXPECTED_EXCEPTION) + return False + if not getattr(self.options, 'ignore_standby', False): + self._call_stdio('verbose', 'Check exit standby tenant') + # check if the current cluster's tenant has a standby tenant in other cluster + self._call_stdio('start_loading', 'check is exit standby tenant') + connect_plugins = self.search_py_script_plugin(repositories, 'connect') + get_standbys_plugins = self.search_py_script_plugin(repositories, 'get_standbys', no_found_act='ignore') + get_deployment_connections_plugins = self.search_py_script_plugin(repositories, 'get_deployment_connections', no_found_act='ignore') + check_exit_standby_plugins = self.search_py_script_plugin(repositories, 'check_exit_standby', no_found_act='ignore') + for repository in get_relation_tenants_plugins: + if repository in get_deployment_connections_plugins and repository in get_standbys_plugins and repository in check_exit_standby_plugins: + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository]): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if not self.call_plugin(get_standbys_plugins[repository], repository, primary_deploy_name=name, skip_no_primary_cursor=True): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if not self.call_plugin(check_exit_standby_plugins[repository], repository): + return False + self._call_stdio('stop_loading', 'succeed') + self._call_stdio('verbose', 'Check deploy status') if deploy_info.status in [DeployStatus.STATUS_RUNNING, DeployStatus.STATUS_UPRADEING]: obd = self.fork(options=Values({'force': True})) @@ -2398,6 +2646,12 @@ def _destroy_cluster(self, deploy, repositories): for repository in repositories: self.call_plugin(destroy_plugins[repository], repository) + delete_standby_info_plugins = self.search_py_script_plugin(repositories, 'delete_standby_info', no_found_act='ignore') + for repository in delete_standby_info_plugins: + ret = self.call_plugin(delete_standby_info_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config) + if not ret: + self._call_stdio('warn', 'Delete relation of standby tenant failed') + self._call_stdio('verbose', 'Set %s deploy status to destroyed' % deploy.name) if deploy.update_deploy_status(DeployStatus.STATUS_DESTROYED): self._call_stdio('print', '%s destroyed' % deploy.name) @@ -2542,6 +2796,23 @@ def upgrade_cluster(self, name): self._call_stdio('stop_loading', 'succeed') + get_standbys_plugins = self.search_py_script_plugin(repositories, 'get_standbys', no_found_act='ignore') + get_relation_tenants_plugins = self.search_py_script_plugin(repositories, 'get_relation_tenants', no_found_act='ignore') + get_deployment_connections_plugins = self.search_py_script_plugin(repositories, 'get_deployment_connections', no_found_act='ignore') + connect_plugins = self.search_py_script_plugin(repositories, 'connect', no_found_act='ignore') + if not getattr(self.options, 'ignore_standby', False): + for repository in get_relation_tenants_plugins: + if repository in get_deployment_connections_plugins and repository in get_standbys_plugins: + if not self.call_plugin(get_relation_tenants_plugins[repository], repository, get_deploy=self.deploy_manager.get_deploy_config): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if not self.call_plugin(get_deployment_connections_plugins[repository], repository, connect_plugin=connect_plugins[repository]): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if not self.call_plugin(get_standbys_plugins[repository], repository, primary_deploy_name=name): + self._call_stdio('error', err.EC_CHECK_STANDBY) + return False + if deploy_info.status == DeployStatus.STATUS_RUNNING: component = getattr(self.options, 'component') version = getattr(self.options, 'version') diff --git a/docs/en-US/1.what-is-obd.md b/docs/en-US/1.what-is-obd.md deleted file mode 100644 index 71e945a..0000000 --- a/docs/en-US/1.what-is-obd.md +++ /dev/null @@ -1,3 +0,0 @@ -# What is OBD - -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. diff --git a/docs/en-US/100.what-is-obd.md b/docs/en-US/100.what-is-obd.md new file mode 100644 index 0000000..c62238a --- /dev/null +++ b/docs/en-US/100.what-is-obd.md @@ -0,0 +1,7 @@ +# What is OBD + +OceanBase Deployer (OBD) is a tool for installing and deploying OceanBase clusters. OBD allows you to deploy an OceanBase cluster on the CLI or GUI and provides a standardized configuration process to simplify cluster deployment. For more information, see [Deploy OceanBase Database on a single OBServer node](400.user-guide/200.start-the-oceanbase-cluster-by-using-obd.md). + +In CLI-based deployment, you can edit the configuration file to flexibly adjust the configurations. This deployment mode is not easy for new hands and is suitable for users who want to deeply understand OceanBase Database. In GUI-based deployment, you can easily deploy a cluster by following the wizard. This deployment mode is suitable for users who want to quickly experience OceanBase Database in a standard environment. + +Besides cluster deployment, OBD also provides general O&M capabilities such as the package manager, stress test software, and cluster management to provide better user experience on OceanBase Database. diff --git a/docs/en-US/1000.configure-rules.md b/docs/en-US/1000.configure-rules.md new file mode 100644 index 0000000..e4cfa4f --- /dev/null +++ b/docs/en-US/1000.configure-rules.md @@ -0,0 +1,67 @@ +# Mode configuration rules + +This topic describes the rules for OceanBase Deployer (OBD) to automatically generate configurations when you deploy an OceanBase cluster on the GUI. + +## CPU + +You can obtain the CPU resource metrics by running the following command: + +```shell +grep -e 'processor\s*:' /proc/cpuinfo | wc -l +``` + +The value of the `cpu_count` parameter is fixed at `16` in Minimum Required mode, and is equal to `max(16, number of CPU cores - 2)` in Maximum Utilization mode. + +## Memory + +You can obtain the memory resource metrics by running the following command: + +```shell +# Total memory +grep MemTotal /proc/meminfo +# Available memory +grep MemAvailable /proc/meminfo +``` + +Specify the following memory parameters based on the corresponding rules. + +### memory_limit + +* In Minimum Required mode, the value is fixed at `6G`. + +* In Maximum Utilization mode, the value of the `memory_limit` parameter is equal to `max(6G, available memory × 0.9)`. If the available disk space is insufficient, the value will be automatically adjusted. The minimum value is `6G`. + +### system_memory + +* In Minimum Required mode, the value is fixed at `1G`. + +* In Maximum Utilization mode, the value of this parameter varies with that of the `memory_limit` parameter based on the rules described in the following table. + + | memory_limit | [6G, 8G) | [8G, 16G) | [16G, 32G) | [32G, 48G) | [48G, 64G] | (64G, +∞) | + |---------------|----------|-----------|------------|-----------|------------|-----------| + | system_memory | 2G | 3G | 5G | 7G | 10G | ![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/obd/V2.1.0/zh-CN/10.configure-rules-01.png) | + +## Disk + +You can obtain the total disk size, occupied disk size, and available disk size by running the following command: + +```shell +df --output=size,avail,target +``` + +The following table describes the rules for specifying disk parameters. + +| Parameter | Minimum Required mode | Maximum Utilization mode | +|--------------|---------------|--------------| +| datafile_size | The value is fixed at `20G`. | The value varies with the value of the `memory_limit` parameter based on this rule: `datafile_size` = `memory_limit` × 3. | +| log_disk_size | The value is fixed at `15G`. | The value varies with the value of the `memory_limit` parameter based on this rule: `log_disk_size` = `memory_limit` × 3. | + +Note the following: + +* When the disk space is insufficient, the value of the `memory_limit` parameter is adjusted to ensure storage security. + +* A certain amount of disk space must be reserved on a mounted disk for OBServer logs. + + * If log rotation is disabled, 1 GB is reserved. + + * If log rotation is enabled, the space to be reserved is calculated based on the total number of log files that can be retained. diff --git a/docs/en-US/1100.error-messages-in-obd.md b/docs/en-US/1100.error-messages-in-obd.md new file mode 100644 index 0000000..5dec884 --- /dev/null +++ b/docs/en-US/1100.error-messages-in-obd.md @@ -0,0 +1,535 @@ +# Error codes + +This topic summarizes the errors that may occur during the use of OBD. + +## General errors + +### OBD-1000: Configuration conflict x.x.x.x: xxx port is used for x.x.x.x + +Cause: Port conflicts occur in the configuration file. + +Solution: You can run the `obd cluster edit-config` command to open the configuration file, and view and modify the port configuration. + +### OBD-1001: x.x.x.x:xxx port is already used + +Cause: The port has been occupied. + +Solution: You can check the configuration and change the port by using one of the following methods: + +- Method 1: If you use a configuration file for deployment, run the `obd cluster edit-config` command to modify the port configuration in the configuration file. Then, run the `obd cluster start` command to continue to start the cluster. + +
+

Note

+

For more information about the commands used in Method 1, see Cluster commands.

+
+ +- Method 2: If you run the `obd demo` command for deployment, run the following command to specify the port. In this example, the `mysql_port` parameter of the oceanbase-ce component is specified: + + ```shell + obd demo --oceanbase-ce.mysql_port=3881 + ``` + +
+

Note

+

For more information about the commands used in Method 2, see Quick deployment command.

+
+ +- Method 3: If you perform deployment on the GUI of OBD, you can change the port number on the **Cluster Configuration** page. + +### OBD-1002: Fail to init x.x.x.x path + +Cause: + +1. `user` in the configuration file (the current user by default, if unspecified) does not have the write permission on the corresponding directory. + +2. home_path is not empty. + +You can determine the cause based on the error information. + +Solution: + +For case 1, you can resolve the problem in two ways. + +- Run the following command to add or modify `user` information: + + ```shell + obd cluster edit-config + ``` + +- Log on to the target server and grant the current account the write permission on the corresponding directory. + +For case 2, you can also resolve the problem in two ways. + +- Select another directory. + +- If you are sure that the current directory can be cleared, you can use the `-f` option. OBD will clear this directory by using the current user. + +### OBD-1003: fail to clean x.x.x.x:xxx + +Cause: `user` in the configuration file (the current user by default, if unspecified) does not have the write permission on the home_path directory. + +Solution: You can resolve the problem in two ways. + +- Run the following command to add or modify `user` information: + + ```shell + obd cluster edit-config + ``` + +- Log on to the target server and grant the current account the write permission on the corresponding directory. + +### OBD-1004: Configuration conflict x.x.x.x: xxx is used for x.x.x.x + +Cause: Path conflicts occur in the configuration file. + +Solution: Check and modify the configuration. + +### OBD-1005: Some of the servers in the cluster have been stopped + +Cause: Some servers in the current configuration have been stopped, but subsequent operations require the services of all servers to be online. + +Solution: Run the `obd cluster start --wop` command to start all services without loading parameters. + +### OBD-1006: Failed to connect to xxx + +Cause: + +1. OceanBase Deployer (OBD) and the specified server are disconnected. + +2. The corresponding component process has exited or does not provide service. + +3. The account and password do not match. + +Solution: + +If the error is due to cause 1, you need to solve the network connection issue. + +If the error is due to cause 2, you can try restarting the component first. If the startup still fails, please refer to the error of startup failure for troubleshooting, such as **OBD-2002**. + +If the error is due to cause 3, it is likely that you have changed the password by executing SQL statements, and the account password is different from that stored in the configuration file. As a result, OBD cannot connect to the component. In this case, you can use any of the following two solutions: + +1. Execute SQL statements to change the password back to that stored in the configuration file of OBD. + +2. Run the `vi ~/.obd/cluster//config.yaml` command to change the password to the one that is in use for the component. + +### OBD-1007: (x.x.x.x) xxx must not be less than xxx (Current value: xxx) + +Cause: The configuration of the ulimit parameter does not meet the requirements. + +Solution: You can modify the corresponding files in the /etc/security/limits.d/ directory and the limits.conf file in the /etc/security/ directory as needed. + +### OBD-1008: (x.x.x.x) failed to get fs.aio-max-nr and fs.aio-nr + +Cause: OBD cannot obtain the asynchronous I/O (AIO) configuration from the server. + +Solution: Check whether the current user has the privilege to view `fs.aio-max-nr/fs.aio-nr`. + +```bash +cat /proc/sys/fs/aio-max-nr /proc/sys/fs/aio-nr +``` + +### OBD-1009: x.x.x.x xxx need config: xxx + +Cause: A parameter is missing for the related service component. + +Solution: Run the following command to open the configuration file. Then, add the missing parameter to the configuration file and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +### OBD-1010: x.x.x.x No such net interface: xxx + +Cause: + +1. The `devname` parameter cannot be obtained on the CLI. + +2. The `devname` parameter cannot be obtained on the GUI. + +Solution: + +For the first case, run the following command to open the configuration file. Then, add or modify the `devname` parameter in the configuration file and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +For the second case, choose **Cluster Configuration** > **More Settings** on the GUI. On the page that appears, set the `devname` parameter. + +### OBD-1011: (x.x.x.x) Insufficient AIO remaining (Avail: xxx, Need: xxx), The recommended value of fs.aio-max-nr is 1048576 + +Cause: The number of AIOs available in the system is less than that required by the database. + +Solution: Run the following command to modify `linux aio-max-nr`: + +```bash +echo 1048576 > /proc/sys/fs/aio-max-nr +``` + +### OBD-1012: xxx + +Cause: + +1. A type conversion exception occurs. For example, a string is passed in for an int parameter. + +2. The value of a parameter is beyond the allowed range. For example, the value range of `rpc_port` is 1025 to 65535. If the value configured for `rpc_port` is not within this range, an error is returned. + +3. A parameter is missing. For example, a key parameter such as `home_path` is not configured. + +Solution: + +For the first case, check the parameter type and modify the value. + +For the second case, check the passed-in parameter value and modify it. + +For the third case, check the parameter configuration. If any parameter is missing, configure it. + +### OBD-1013: xxx@x.x.x.x connect failed: xxx + +Cause (two most common causes): + +1. The username or password was incorrect. + +2. The connection timed out. + +Solution: + +For the first case, run the following command to open the configuration file. Then, modify the username or password in the configuration file and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +For the second case, check the server configuration. For example, check whether the port is correct and whether the firewall is enabled. + +If the problem persists, submit an issue on GitHub (), and designated professionals will help you fix the issue. + +## OceanBase deployment errors + +### OBD-2000: x.x.x.x not enough memory + +Cause: The memory is insufficient. + +Solution: When OBD starts, the memory is strictly calculated based on MemAvailable. If any cached memory can be released, run the following command: + +```shell +echo 3 > /proc/sys/vm/drop_caches +``` + +If the memory is still insufficient, run `edit-config` and then adjust `memory_limt` and `system_memory`. Ensure that the following condition is met: `memory_limt/3 ≤ system_memory ≤ memory_limt/2`. + +> **Note** +> +> `memory_limt` cannot be lower than 8 GB. In other words, your available memory must be greater than 8 GB. + +### OBD-2001: server can not migrate in + +Cause: The number of available units is smaller than `--unit-num`. + +Solution: Modify the passed value of `--unit-num`. Run the following command to view the number of available units: + +```sql +select count(*) num from oceanbase.__all_server where status = 'active' and start_service_time > 0 +``` + +### OBD-2002: failed to start x.x.x.x observer + +Cause: There are multiple causes for this error. Two most common causes are as follows. + +- `memory_limit` is lower than 8 GB. + +- `system_memory` is too large or small. Generally, the following condition must be met: `memory_limt/3 ≤ system_memory ≤ memory_limt/2`. + +Solution: + +- If the problem is caused by either of the preceding reasons, take actions accordingly. + +- If the problem persists, submit an issue on GitHub (), and designated professionals will help you fix the issue. + +### OBD-2003: not enough disk space for clog. Use redo_dir to set other disk for clog, or reduce the value of datafile_size + +Cause: The disk usage exceeds the limit. + +Solution: Adjust the storage of disks. + +- For automatic deployment, the disk usage cannot exceed 72%. + +- For manual deployment, the disk usage cannot exceed 64%, if the configuration is not modified. + +> **Note** +> +> If redo_dir and data_dir are on the same disk, the space to be occupied by data files is included when the disk usage is calculated. + +### OBD-2004: Invalid: xxx is not a single server configuration item + +Cause: The modified parameter is a global one and cannot be separately modified for a single server. + +Solution: Place the parameter to modify under global. + +### OBD-2005: Failed to register cluster. xxx may have been registered in xxx + +Cause: The cluster registration failed or the cluster has been registered. + +Solution: + +- Run the `obd cluster edit-config` command to open the configuration file. Then, set the value of the `obconfig_url` parameter to the URL of the correct config server. + +- If the config server is correct and you want to forcibly override the registered cluster, add the `-f` option to the `obd cluster start` command. + +- If the config server is correct, you can run the `obd cluster edit-config` command to open the configuration file. Then, modify the `appname` and `cluster_id` parameters to specify a new cluster name and ID for deployment. + +### OBD-2006: x.x.x.x has more than one network interface. Please set `devname` for x.x.x.x + +Cause: + +1. The `devname` parameter cannot be obtained on the CLI. + +2. The `devname` parameter cannot be obtained on the GUI. + +Solution: + +For the first case, run the following command to open the configuration file. Then, add or modify the `devname` parameter in the configuration file and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +For the second case, choose **Cluster Configuration** > **More Settings** on the GUI. On the page that appears, set the `devname` parameter. + +### OBD-2007: x.x.x.x xxx fail to ping x.x.x.x. Please check configuration `devname` + +Cause: The nodes cannot ping each other. + +Solution: + +1. Check whether the NIC configuration is correct. + +2. Check whether the network connection between the nodes is normal. + +### OBD-2008: Cluster clocks are out of sync + +Cause: The clocks on the servers in the cluster are out of synchronization. + +Solution: Synchronize the clocks on the servers. + +### OBD-2009: x.x.x.x: when production_mode is True, xxx can not be less then xxx + +Cause: In the production mode, the values of parameters such as `__min_full_resource_pool_mem` and `memory_limit` cannot be smaller than specified values. + +Solution: + +- If you are deploying a non-production environment, run the following command to open the configuration file. Change the value of the `production_mode` parameter to `False` and run the restart command provided in the output. + + ```bash + obd cluster edit-config + ``` + +- If you are deploying a production environment, run the following command to open the configuration file. Modify the `__min_full_resource_pool_mem` and `memory_limit` parameters to values greater than the specified values. Then, run the restart command provided in the output. + + ```bash + obd cluster edit-config + ``` + +### OBD-2010: x.x.x.x: system_memory too large. system_memory must be less than memory_limit/memory_limit_percentage + +Cause: The value of the `system_memory` parameter is too large. Its value must be smaller than the result of `memory_limit`/`memory_limit_percentage` × `total_memory`. + +Solution: + +1. CLI: Run the following command to open the configuration file. Change the value of `system_memory` and run the restart command provided in the output. + + ```bash + obd cluster edit-config + ``` + +2. GUI: Choose **Cluster Configuration** > **More Settings** and specify `system_memory`. + +### OBD-2011: x.x.x.x: fail to get memory info.\nPlease configure 'memory_limit' manually in configuration file + +Cause: The server cannot obtain the memory information. + +Solution: + +1. CLI: Run the following command to open the configuration file. Specify `memory_limit` and run the restart command provided in the output. + + ```bash + obd cluster edit-config + ``` + +2. GUI: Choose **Cluster Configuration** > **More Settings** and specify `memory_limit`. + +## Test-related errors + +### OBD-3000: parse cmd failed + +Cause: The mysqltest initialization file is not an `.sql` file. + +Solution: Check the `--init-sql-files` parameter. + +### OBD-3001: xxx.sql not found + +Cause: The initialization file cannot be found during the initialization of mysqltest. + +Solution: Check whether the file declared by `--init-sql-files` is located under the `--init-sql-dir` directory. + +### OBD-3002: Failed to load data + +Cause: There are multiple causes for this error. Two most common causes are as follows. + +1. The tenant has insufficient resources or is under excessive test stress. + +2. An error occurred in the data build script. + +Solution: + +If the error is due to cause 1, you can use a tenant with larger resource specifications or adjust parameters such as warehouses and load-workers to reduce the test stress. + +If the error is due to cause 2, you can rerun the test because the data build script is obtained from the TPC official website. If the issue persists, submit an issue on GitHub (), and designated professionals will help you fix the issue. + +### OBD-3003: Failed to run TPC-C benchmark + +Cause: + +1. The test process was stuck and then terminated due to timeout. + +2. An error occurred for the TPC-C test command. + +Solution: + +- You can try to rerun the test directly, or you can adjust parameters such as terminals to reduce the test pressure before you rerun the test. + +- If you did not use the obtpcc package provided on the OceanBase Database official website, use obtpcc for testing. + +If the issue persists, submit an issue on GitHub (), and designated professionals will help you fix the issue. + +## OBAgent-related errors + +### OBD-4000: Fail to reload x.x.x.x + +Cause: The `http_basic_auth_password` of the node is not the same as that stored in OBD, which causes OBD to fail to access OBAgent. + +Solution: If the two passwords are the same, check whether an unsupported parameter is included among the modified options, or whether the name of a parameter is incorrect. + +### OBD-4001: Fail to send config file to x.x.x.x + +Cause: (Check whether the error is caused by either of the reasons.) + +- The disk space for the home_path directory on OBAgent is insufficient. + +- `user` in the configuration file (the current user by default, if unspecified) does not have the write permission on the home_path directory on OBAgent. + +Solution: You can resolve the problem in two ways. + +- Run the following command to add or modify `user` information: + + ```shell + obd cluster edit-config + ``` + +- Log on to the target server and grant the current account the write permission on the corresponding directory. + +## ODP-related errors + +### OBD-4100: x.x.x.x need config "rs_list" or "obproxy_config_server_url" + +Cause: The server cannot obtain the `rs_list` or `obproxy_config_server_url` information. + +Solution: Run the following command to open the configuration file. Add or modify the `rs_list` or `obproxy_config_server_url` parameter and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +### OBD-4101: failed to start x.x.x.x obproxy: xxx + +Cause: Failed to start ODP. + +Solution: Perform further analysis based on the error message. + +## Grafana-related errors + +### OBD-4200: x.x.x.x grafana admin password should not be 'admin' + +Cause: The password of the admin user of Grafana cannot be `admin`. + +Solution: Run the following command to open the configuration file. Add or change the password and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +### OBD-4201: x.x.x.x grafana admin password length should not be less than 5 + +Cause: The password of the admin user of Grafana cannot be shorter than 5 characters in length. + +Solution: Run the following command to open the configuration file. Add or change the password and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +## OCP Express-related errors + +### OBD-4300: x.x.x.x: failed to query java version, you may not have java installed + +Cause: OBD cannot obtain the Java information from the server. + +Solution: + +1. Install Java. For more information, see the **How do I configure the Java environment before I deploy OCP Express?** section in [FAQ](500.faq/100.faq.md). + +2. If Java has been installed, set the value of the `java_bin` parameter to the path of the executable file of Java. + +### OBD-4301: x.x.x.x: ocp-express need java with version xxx + +Cause: The Java version on the server is earlier than needed. + +Solution: Install Java of the version provided in the error message. If the target Java version has been installed, set the value of the `java_bin` parameter to the path of the executable file of Java. + +### OBD-4302: x.x.x.x not enough memory. (Free: xxx, Need: xxx) + +Cause: The server has insufficient memory. + +Solution: + +- If the total memory available for the server is insufficient, run the `obd cluster edit-config` command to open the configuration file and modify the `memory_limit` parameter to a smaller value, or replace the server with one that has sufficient memory. + +- If the remaining memory on the server is insufficient, run the following command to release cached objects that can be released. + + ```shell + echo 3 > /proc/sys/vm/drop_caches + ``` + +### OBD-4303: x.x.x.x xxx not enough disk space. (Avail: xxx, Need: xxx) + +Cause: The server has insufficient disk space. + +Solution: Check and clean up the disk. + +### OBD-4304: OCP express xxx needs to use xxx with version xxx or above + +Cause: OCP Express must be used with the corresponding component of the specified version. + +Solution: Run the following command to open the configuration file. Modify the version of the corresponding component and run the restart command provided in the output. + +```bash +obd cluster edit-config +``` + +### OBD-4305: There is not enough xxx for ocp meta tenant + +Cause: The log disk space and memory are insufficient for creating a meta tenant for OCP Express. + +Solution: + +- If the OceanBase cluster is deployed in **Maximum Utilization** mode on the GUI, or deployed by using the `obd cluster autodeploy` command on the CLI, we recommend that you clean up the disk and memory and then try again. + +- If a resource specification is configured for the cluster, increase the values of the resource-related parameters for the `oceanbase-ce` component, for example, the memory-related parameters such as `memory_limit` and `memory_limit_percentage` and the log disk-related parameters such as `log_disk_size` and `log_disk_percentage`. + +## SQL-related errors + +OBD-5000: sql execute failed + +Cause: The SQL execution failed. + +Solution: Determine the solution based on the actual situation. diff --git a/docs/en-US/2.install-obd.md b/docs/en-US/2.install-obd.md deleted file mode 100644 index 382ad23..0000000 --- a/docs/en-US/2.install-obd.md +++ /dev/null @@ -1,45 +0,0 @@ -# Install OBD - -You can install OBD by using these methods: - -## Method 1: Install OBD by using RPM packages (only for CentOS 7 or later) - -```shell -sudo yum install -y yum-utils -sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo -sudo yum install -y ob-deploy -source /etc/profile.d/obd.sh -``` - -## Method 2: Install OBD by using the source code - -Before you install OBD by using the source code, make sure that you have installed these dependencies: - -- gcc -- wget -- python-devel -- openssl-devel -- xz-devel -- mysql-devel - -To install OBD on Python2.7, run these commands: - -```shell -sh rpm/build.sh build -source /etc/profile.d/obd.sh -``` - -To install OBD on Python3.8, perform the following steps - -First, you should run these commands on Python2.7: - -```shell -sh rpm/build.sh executer -``` - -Then run these commands on Python 3.8. - -```shell -sh rpm/build.sh build_obd -source /etc/profile.d/obd.sh -``` diff --git a/docs/en-US/200.quick-start/100.install-obd.md b/docs/en-US/200.quick-start/100.install-obd.md new file mode 100644 index 0000000..6e42678 --- /dev/null +++ b/docs/en-US/200.quick-start/100.install-obd.md @@ -0,0 +1,187 @@ +# Install and configure OBD + +This topic describes how to install and configure OceanBase Deployer (OBD). + +## Install OBD + +### Install OBD by using an RPM package + +#### Online installation + +If your server can connect to the Internet and runs on CentOS or RedHat, you can run the following commands to install OBD online. + +```shell +sudo yum install -y yum-utils +sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo +sudo yum install -y ob-deploy +source /etc/profile.d/obd.sh +``` + +
+

Note

+

The yum command automatically installs the latest version. You can declare a version number to install the specified version. If you use the yum install -y ob-deploy command to install OBD, we recommend that you install the latest version.

+
+ +#### Offline installation + +If your server cannot connect to the Internet, you can download the desired OBD version from [OceanBase Download Center](https://en.oceanbase.com/softwarecenter). After you download the OBD installation package, copy it to your central control server. We recommend that you download the latest version. + +To install OBD on CentOS or RedHat, run the following command: + +```shell +sudo yum install ob-deploy-*.rpm +``` + +To install OBD on Ubuntu or Debian, run the following command: + +```shell +sudo alien --scripts -i ob-deploy-*.rpm +``` + +### Install OBD by using an all-in-one package + +OceanBase Database provides an all-in-one package since V4.0.0. You can use this package to install OBD, OceanBase Database, OceanBase Database Proxy (ODP), OceanBase Agent (OBAgent), Grafana, Prometheus, and OceanBase Cloud Platform (OCP) Express at a time. + +#### Online installation + +If your server can connect to the Internet, run the following commands to install OBD online. + +```shell +bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)" +source ~/.oceanbase-all-in-one/bin/env.sh +``` + +#### Offline installation + +If your server cannot connect to the Internet, perform the following steps to install OBD offline. + +1. Download the latest all-in-one package from [OceanBase Download Center](https://en.oceanbase.com/softwarecenter) and copy it to the central control server. + +2. In the directory where the package is located, run the following commands to decompress and install the package. + + ```shell + tar -xzf oceanbase-all-in-one-*.tar.gz + cd oceanbase-all-in-one/bin/ + ./install.sh + source ~/.oceanbase-all-in-one/bin/env.sh + ``` + +### Install OBD by using the source code + +Before you use the source code to install OBD, make sure that the following dependencies are installed: + +* GCC + +* wget + +* Python-devel + +* openssl-devel + +* xz-devel + +* mysql-devel + +To compile the source code to build OBD, you must use the Python 2.7 and Python 3.8 environments. Perform the following steps: + +1. Run the following command in Python 2.7: + + ```shell + sh rpm/build.sh executer + ``` + +
+

Note

+

The preceding command compiles the interpreter needed in OceanBase Database upgrades. If no upgrade is needed, skip this step.

+
+ +2. Run the following commands in Python 3.8: + + ```shell + sh rpm/build.sh build_obd + source /etc/profile.d/obd.sh + ``` + +
+

Note

+

OBD does not support source code-based installation in Python 2 since V2.0.0.

+
+ +## Configure OBD + +### Online configuration + +The repository information is built in OBD. When the server can connect to the Internet, you do not need to configure OBD. In this case, you can run the `obd mirror list` command to view the software in the OBD repository. + +```shell +# View OBD repository information +[admin@test001 ~]$ obd mirror list ++-----------------------------------------------------------------------------+ +| Mirror Repository List | ++----------------------------+--------+---------+----------+------------------+ +| SectionName | Type | Enabled | Available | Update Time | ++----------------------------+--------+---------+----------+------------------+ +| oceanbase.community.stable | remote | True | True | 2023-03-20 11:21 | +| oceanbase.development-kit | remote | True | True | 2023-03-20 11:21 | +| local | local | - | True | 2023-03-20 11:23 | ++----------------------------+--------+---------+----------+------------------+ +Use `obd mirror list
` for more details +Trace ID: 8a4da3a0-c6ce-11ed-91cc-00163e030166 +If you want to view detailed obd logs, please run: obd display-trace 8a4da3a0-c6ce-11ed-91cc-00163e030166 +# View information about the software in the repository +[admin@test001 ~]$ obd mirror list oceanbase.community.stable +Update OceanBase-community-stable-el7 ok +Update OceanBase-development-kit-el7 ok ++--------------------------------------------------------------------------------------------------------------------------------------------------+ +| oceanbase.community.stable Package List | ++-----------------------------------+---------+------------------------+--------+------------------------------------------------------------------+ +| name | version | release | arch | md5 | ++-----------------------------------+---------+------------------------+--------+------------------------------------------------------------------+ +| grafana | 7.5.17 | 1 | x86_64 | f0c86571a2987ee6338a42b79bc1a38aebe2b07500d0120ee003aa7dd30973a5 | +| libobclient | 2.0.0 | 1.el7 | x86_64 | 7bbb2aeb9c628ee35c79d6dc2c1668ebbf97a3323f902e8fd33ff1a5ea95220f | +| libobclient | 2.0.0 | 2.el7 | x86_64 | 6c1587b80df64b68343479aecddb0ca912d5ccd3d085cb41c7a37a1e38effc34 | +| libobclient | 2.0.1 | 3.el7 | x86_64 | 4f92926496dec89936422f41f2f2206eb61c5e62e7b0dde1006c6e02eaebec6e | +| libobclient | 2.0.2 | 2.el7 | x86_64 | eed33520e6911140dad65197cff53652310609ab79d7960ec4d2d6d4b2318ba7 | +# Subsequent outputs omitted +``` + +### Offline configuration + +If your server cannot connect to the Internet, download the desired installation package in advance and add it to the local repository of OBD. + +Download links: + +* [Redhat/CentOS 7.x](https://mirrors.aliyun.com/oceanbase/community/stable/el/7/x86_64) + +* [Redhat/CentOS 8.x](https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64) + +
+

Note

+

We recommend that you download the latest software version.

+
+ +#### Add an installation package to the local repository + +Perform the following steps as the system user that deployed OBD. In this example, the `admin` user is used. + +1. Run the following command to disable remote repositories: + + ```shell + obd mirror disable remote + ``` + + Run the `obd mirror list` command to confirm whether the remote repositories are disabled. If the values of the remote repositories in the `Enabled` column are changed to `False`, the remote image sources are disabled. + +2. In the directory where the installation package is located, run the following command to upload the installation package to the local repository. + + ```shell + obd mirror clone *.rpm + ``` + +3. View the list of installation packages in the local repository. + + ```shell + obd mirror list local + ``` + + If the desired installation package is in the list, the installation package is uploaded. diff --git a/docs/en-US/3.user-guide/1.quickly-start-the-oceanbase-database.md b/docs/en-US/200.quick-start/200.quickly-start-the-oceanbase-database.md similarity index 69% rename from docs/en-US/3.user-guide/1.quickly-start-the-oceanbase-database.md rename to docs/en-US/200.quick-start/200.quickly-start-the-oceanbase-database.md index 33e4024..e92f291 100644 --- a/docs/en-US/3.user-guide/1.quickly-start-the-oceanbase-database.md +++ b/docs/en-US/200.quick-start/200.quickly-start-the-oceanbase-database.md @@ -10,9 +10,11 @@ After you deploy OceanBase Deployer (OBD), you can run the `obd demo` command to - At least 54 GB of disk space is available on the server. +- Your server can be connected to the network, or there are installation packages required for deployment. + > **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). +> If the foregoing prerequisites are not met, see [Deploy OceanBase Database on a single OBServer node](../400.user-guide/200.start-the-oceanbase-cluster-by-using-obd.md). ```shell # Deploy and start OceanBase Database. diff --git a/docs/en-US/200.quick-start/300.use-ui-deploy-oceanbase.md b/docs/en-US/200.quick-start/300.use-ui-deploy-oceanbase.md new file mode 100644 index 0000000..793b7a3 --- /dev/null +++ b/docs/en-US/200.quick-start/300.use-ui-deploy-oceanbase.md @@ -0,0 +1,250 @@ +# Deploy an OceanBase cluster on the GUI + +This topic describes how to use OceanBase Deployer (OBD) to deploy OceanBase Database in an x86-based CentOS Linux 7.9 system on the GUI. + +## Background + +OBD V2.0.0 or later supports GUI-based deployment for OceanBase Database and related components such as OceanBase Agent (OBAgent), OceanBase Database Proxy (OBD), and OceanBase Cloud Platform (OCP) Express. You can easily deploy an OceanBase cluster by following the wizard. + +## Prerequisites + +* At least 2 vCPUs, 8 GB of memory, and 45 GB of disk space are available for deploying OceanBase Database only. + +* At least 4 vCPUs, 10 GB of memory, and 50 GB of disk space are available for deploying OceanBase Database and all its components. We recommend that more than 16 GB of memory be available. + +* The Java environment has been installed and configured if OCP Express is to be deployed. At present, only Java Development Kit (JDK) 1.8 is supported. For more information, see the **How do I configure the Java environment before I deploy OCP Express?** section in [FAQ](../500.faq/100.faq.md). + +
+

Notice

+

OBD remotely performs installation and deployment by using the Secure Shell (SSH) protocol. Therefore, you must use SSH to verify whether the Java environment is available. For more information, see Verify the Java environment.

+
+ +## Prepare the software + +You can use OBD to deploy OceanBase Database on the GUI in online or offline mode. + +* Online deployment: Make sure that the server where OBD resides can connect to the Internet. In this deployment mode, OBD obtains the installation package from a remote image repository during deployment, without the need for you to deploy and configure the installation package in advance. + +* Offline deployment: The server where OBD resides does not need to connect to the Internet during deployment. In this deployment mode, you must upload the installation package to the local image repository of OBD in advance. If you choose offline deployment, we recommend that you download the all-in-one package of the desired version. + +Prepare the software based on the deployment mode. + +### Online deployment + +If you choose online deployment, run the following commands to install OBD on the central control server. + +```shell +[admin@test001 ~]$ sudo yum install -y yum-utils +[admin@test001 ~]$ sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo +[admin@test001 ~]$ sudo yum install -y ob-deploy +[admin@test001 ~]$ source /etc/profile.d/obd.sh +``` + +### Offline deployment + +If you choose offline deployment, run the following commands to download and install the all-in-one package. + +You can download the latest all-in-one package from [OceanBase Download Center](https://www.oceanbase.com/softwarecenter) and copy the package to the central control server. Run the following commands to decompress and install the package: + +```shell +[admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz +[admin@test001 ~]$ cd oceanbase-all-in-one/bin/ +[admin@test001 bin]$ ./install.sh +[admin@test001 bin]$ source ~/.oceanbase-all-in-one/bin/env.sh +``` + +## Procedure + +1. Go to the GUI. + + Run the `obd web` command on the CLI, and click the generated URL to go to the GUI. On the GUI, click **Experience Now** to go to the OceanBase Database configuration page. + + ```shell + [admin@test001 ~]$ obd web + start OBD WEB in 0.0.0.0:8680 + please open http://172.xx.xxx.233:8680 + ``` + +
+

Note

+
    +
  • +

    The default port in the URL is 8680. You can use the obd web -p <PORT> command to specify a port.

    +
  • +
  • +

    On Alibaba Cloud or other cloud environments, the program may fail to obtain a public IP address but output an intranet IP address. You must use a correct public IP address to access the GUI.

    +
  • +
+
+ + To change the display language, click the **English** icon in the upper-right corner of the page and select a language as needed. + + English + +2. Configure the deployment information. + + On the **Deployment Configuration** page, you can configure the cluster name, deployment type, and components to deploy. + + Deployment Configuration + + On the **Deployment Configuration** page: + + * The default value of **Cluster Name** is `myoceanbase`, which can be modified and must not be the same as the name of an existing cluster. + + * Valid values of **Deployment Type** are **Complete Deployment** and **Lean Deployment**. In **Complete Deployment**, all components are deployed, while in **Lean Deployment**, only OceanBase Database is deployed. + + * Click **Learn more** in the **Description** column of a component to view more information about the component. + + * You can click the drop-down list in the **Version** column of OceanBase Database and select a version. For other components, the latest versions are displayed by default. + + Click **Next Step** to go to the **Node Configuration** page. + +3. Configure the node information. + + On the **Node Configuration** page, configure the database and component nodes, and specify the user information and software installation path. + + Node Configuration + + On the **Node Configuration** page: + + * By default, three zones are available for the database nodes. You can click **+ Add Zone** to add a zone or click the delete icon to delete a zone. + + * For **OCP Express Node**, you can select the IP address of an OBServer node from the drop-down list or enter the IP address of a new node. You can select or enter only one IP address. + + * For **OBProxy Node**, you can select the IP address of an OBServer node or enter the IP address of a new node. You can configure multiple OBProxy nodes. + + * By default, the value of **User Name** is the user who started the current process and the SSH port is Port 22. You can change the user and SSH port as needed. If password-free access is not configured for the nodes, you must enter the password of the specified user. + + * By default, the value of **Software Path** is the home directory of the user who performed the deployment. You can change the path as needed. + + Click **Next Step** to go to the **Cluster Configuration** page. + +4. Configure the cluster information. + + On the **Cluster Configuration** page, configure related cluster information, including the password of the administrator user in the sys tenant (root@sys), data directory, log directory, and ports and parameters of OceanBase Database and its components. + + Cluster Configuration + + On the **Cluster Configuration** page: + + * Valid values of **Mode Configuration** are **Maximum Utilization** and **Minimum Availability**. The **Maximum Utilization** mode maximizes resource utilization to ensure cluster performance and stability, and is recommended. In the **Minimum Availability** mode, minimum resources required for the normal running of the cluster are configured. For more information about mode configuration, visit [Mode configuration rules](../1000.configure-rules.md). + + * The default password of the root@sys user is a random string automatically generated by OBD, and can be modified. The password must be 8 to 32 characters in length and can contain digits, letters, and special characters such as ~!@#%^&*_-+=`|(){}[]:;',.?/ + + * By default, the data directory and log directory of the cluster are in the software path configured on the **Node Configuration** page. The data and log directories must be absolute paths beginning with `/`. You can change the data and log directories. Make sure that the specified directories are empty. + + * The default ports are retained for the database and its components. You can change the ports. Make sure that the specified ports range from 1024 to 65535 and are not occupied. + + * Enable **More Configurations** to view more cluster or component parameters. You can retain the default settings or modify the settings. + + Click **Next Step** to go to the **Pre-check** page. + +5. Perform a precheck. + + On the **Pre-check** page, confirm all the configuration information. If any information is incorrect, you can click **Previous Step** to modify the information. After you confirm that all the information is correct, click **Pre-check**. + + If an error is returned, you can click **Auto repair** to automatically correct the error, or click **Learn more** to go to the error code document and correct the error based on the reference document. After all the errors are corrected, click **Re-check** to perform a precheck again. + + Precheck + +6. Deploy OceanBase Database. + + After the precheck is passed, click **Deploy** to start to deploy OceanBase Database. + + Deploy + + On the deployment page: + + * After the deployment succeeds, you can copy the displayed connection string and use it to connect to OceanBase Database from the CLI. + + * Click the connection string of OCP Express to go to the logon page of OCP Express. Log on with the account and password provided on the deployment page, and then change the password. Then, you can manage the cluster on the GUI. + +
+

Note

+

On Alibaba Cloud or other cloud environments, the program may fail to obtain a public IP address but output an intranet IP address. You must use a correct public IP address to access the GUI.

+
+ + * In the **Deployment Report** section, click the Expand icon in front of the corresponding component to view the deployment log on the GUI. + + * In the **Deployment Report** section, find the target component and click **View Details**. Then, you can click the Copy icon next to a command to copy the command and run the command on the central control server to view the log location of the component. + +7. Click **Finish**. + +
+

Notice

+

To deploy multiple clusters, click Finish on the GUI to end the current OBD process and then run theobd web command to start the deployment of another cluster.

+
+ +## Related operations + +### Verify the Java environment + +OBD remotely executes a script to deploy OCP Express. Therefore, you must use SSH to verify the Java environment. You cannot directly run the `java -version` command on the server where OCP Express is deployed to verify the Java environment. + +
+

Note

+

Interactions between the client and server will initialize the environment variables, but the SSH access mode does not initialize environment variables. As a result, the system prompts that the Java command does not exist or the Java version is wrong when you use SSH.

+
+ +You can run the following command on any server that has established a network connection with the node where OCP Express resides. + +```shell +# ocp_express_node_username: the username of the node where OCP Express resides +# ocp_express_node_ip: the IP address of the node where OCP Express resides +[admin@test001 ~]$ ssh @ 'java -version' + +# Command output +openjdk version "1.8.0_xxx" +OpenJDK Runtime Environment (build 1.8.0_362-b08) +OpenJDK 64-Bit Server VM (build 25.362-b08, mixed mode) +``` + +If the required Java environment has been installed but failed the verification, you can resolve the issue in the following ways: + +* Method 1: Specify the **java_bin** parameter in the **More Configurations** section. + + As shown in the following figure, set `java_bin` to the real path of Java, such as `/jdk8/bin/java`. + + More Settings + +* Method 2: Create a soft link from the executable file of Java to `/usr/bin/java`. + + ```shell + [admin@test001 bin]$ pwd + /jdk8/bin + [admin@test001 bin]$ ln -s /jdk8/bin/java /usr/bin/java + ``` + +### Manage the cluster + +You can run the following commands to manage a cluster deployed by using OBD. For more information, see [Cluster commands](../300.obd-command/100.cluster-command-groups.md). + +```shell +# View the cluster list. +[admin@test001 ~]$ obd cluster list + +# View the status of the myoceanbase cluster. +[admin@test001 ~]$ obd cluster display myoceanbase + +# Stop the myoceanbase cluster in the running state. +[admin@test001 ~]$ obd cluster stop myoceanbase + +# Destroy the myoceanbase cluster. +[admin@test001 ~]$ obd cluster destroy myoceanbase +``` + +### Deploy a component of the desired version + +The all-in-one package is iterated based on OceanBase Database versions. If any component in the package has a later version, you can download the component of the latest version from [OceanBase Download Center](https://www.oceanbase.com/softwarecenter) and then upload it to the local image repository of OBD. OBD will automatically obtain the latest version from the local image repository during deployment. + +1. Go to the directory where the component installation package is located, run the following command to add it to the local image repository. + + ```shell + [admin@test001 rpm]$ obd mirror clone *.rpm + ``` + +2. View the list of installation packages in the local image repository. + + ```shell + [admin@test001 rpm]$ obd mirror list local + ``` 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 deleted file mode 100644 index 674fb08..0000000 --- a/docs/en-US/3.user-guide/2.start-the-oceanbase-cluster-by-using-obd.md +++ /dev/null @@ -1,116 +0,0 @@ -# Use OBD to start an OceanBase cluster - -To start an OceanBase cluster, follow these steps: - -## Step 1: Select a configuration file - -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: /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: /usr/obd/example/local-example.yaml - -- Sample configuration file for single-node deployment: /usr/obd/example/single-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. -# Modify the SQL service protocol port of the OceanBase cluster: mysql_port. This port will be used to connect to the cluster later. -# Modify the internal communication port of the OceanBase cluster: rpc_port. -vi ./example/mini-local-example.yaml -``` - -If the target server to run the OceanBase cluster is not the logged-in server, do not use the `sample configuration file for local single-node deployment`. Use another configuration file. -Do not forget to change the user password at the beginning of the configuration file. - -```yaml -user: - username: - password: - key_file: -``` - -`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. - -## Step 2: Deploy and start a cluster - -```shell -# The following command checks whether the home_path and data_dir directories are empty. -# If not, an error is returned. In this case, you can add the -f option to forcibly clear the directories. -obd cluster deploy lo -c local-example.yaml - -# The following command checks whether the value of the fs.aio-max-nr parameter is no less than 1048576. -# Generally, you do not need to modify the fs.aio-max-nr parameter when you start one node on a server. -# However, you must modify the fs.aio-max-nr parameter when you start four or more nodes on a server. -obd cluster start lo -``` - -## Step 3: View the cluster status - -```shell -# View clusters managed by OBD. -obd cluster list -# View the status of the lo cluster. -obd cluster display lo -``` - -## Step 4: Modify configurations - -OceanBase Database has hundreds of configuration items and some of them are coupled. We recommend that you do not modify the configurations in the sample configuration file unless you are familiar with OceanBase Database. The following example shows how to modify the configurations and make them take effect. - -```shell -# Run the edit-config command to enter the editing mode and modify the cluster configurations. -obd cluster edit-config lo -# Set the value of sys_bkgd_migration_retry_num to 5. -# Note that the minimum value of sys_bkgd_migration_retry_num is 3. -# Save the settings and exit. OBD will tell you how to make the modification take effect. -# To make the modification take effect, you only need to run the reload command. -obd cluster reload lo -``` - -## Step 5: Stop the cluster - -You can run the `stop` command to stop a running cluster. If the `start` command fails but some processes are still running, run the `destroy` command to destroy the cluster. - -```shell -obd cluster stop lo -``` - -## Step 6: Destroy the cluster - -To destroy the cluster, run this command: - -```shell -# When the start command fails, some processes may still be running. -# In this case, use the -f option to forcibly stop and destroy the cluster. -obd cluster destroy lo -``` 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 deleted file mode 100644 index 0ee395e..0000000 --- a/docs/en-US/3.user-guide/3.obd-command/1.cluster-command-groups.md +++ /dev/null @@ -1,298 +0,0 @@ -# Cluster commands - -OBD provides multiple-level commands. You can use the`-h/--help` option to view the help information of sub-commands. - -A deployment configuration is the minimum unit for OBD cluster commands. A deployment configuration is a `yaml` file. It contains all configuration information of a deployment, including the server login information, component information, component configuration information, and component server list. - -To start a cluster by using OBD, you must register the deployment configuration of your cluster to OBD. You can run the `obd cluster edit-config` command to create an empty deployment configuration or run the `obd cluster deploy -c config` command to import a deployment configuration. - -## `obd cluster autodeploy` - -When you pass a simple configuration file to OBD, OBD will automatically generate a complete configuration file with the maximum specifications based on the resources of the target server, and then deploy and start a cluster on the target server. - -```shell -obd cluster autodeploy -c [-f] [-U] [-A] [-s] -``` - -`deploy name` specifies the name of the deployment configuration file. - -The following table describes the corresponding options. - -| Option | Required | Data type | Default value | Description | ---- | --- | --- |--- |--- -| -c/--config | Yes | string | None | Specifies the yaml file used for deployment and registers the deployment configuration to OBD.
When the `deploy name` already exists, OBD will check the status of the existing deployment configuration. If the existing deployment configuration has not been applied, it will be overwritten. If the existing deployment configuration is in use, an error will be returned. | -| -f/--force | No | bool | false | Specifies whether to forcibly clear the working directory.
When the component requires an empty working directory but this option is disabled, an error will be returned if the working directory is not empty. | -| -U/--ulp/--unuselibrepo | No | bool | false | Specifies whether to prevent OBD from automatically taking actions when dependencies are missing. If this option is disabled and OBD detects that some dependencies are missing, OBD will automatically search for the corresponding libs mirrors and install them. If this option is enabled, the **unuse_lib_repository: true** field will be added to the corresponding configuration file. You can also add the **unuse_lib_repository: true** field to the configuration file to enable this option. | -| -A/--act/--auto-create-tenant | No | bool | false | Specifies whether to enable OBD to create the `test` tenant during the bootstrap by using all available resources of the cluster. If this option is enabled, the **auto_create_tenant: true** field will be added to the corresponding configuration file. You can also add the **auto_create_tenant: true** field to the configuration file to enable this option. | -| -s/--strict-check | No | bool | false | Some components will do relevant checks before starting. It will issue an alarm when the check fails, but it will not force the process to stop. Using this option can return an error and directly exit the process when the component pre-check fails. We recommend that you enable this option to avoid startup failures due to insufficient resources. | - -## `obd cluster edit-config` - -Modifies a deployment configuration or creates one when the specified deployment configuration does not exist. - -```shell -obd cluster edit-config -``` - -`deploy name` specifies the name for the deployment configuration file. - -## `obd cluster deploy` - -Deploys a cluster based on the deployment configuration file. Based on the deployment configuration file, this command finds the matching mirror, then installs the mirror in a local repository. This process is called local installation. -Then, OBD distributes the components of the required version in the local repository to the target server. This process is called remote installation. -During both local and remote installation, OBD checks whether the server stores dependencies required for running the components. -This command allows you to deploy a cluster based on a deployment configuration that has been registered to OBD or by passing a `yaml` file. - -```shell -obd cluster deploy [-c ] [-f] [-U] [-A] -``` - -`deploy name` specifies the name of the deployment configuration file. - -The following table describes the corresponding options. - -| Option | Required | Data type | Default value | Description | ---- | --- | --- |--- |--- -| -c/--config | No | string | None | Specifies the yaml file used for deployment and registers the deployment configuration to OBD.
If this option is enabled and a deployment configuration of the specified `deploy name` already exists, the existing deployment configuration will be overwritten.
If this option is not enabled, OBD will search for the registered deployment configuration of the specified `deploy name`. | -| -f/--force | No | bool | false | Specifies whether to forcibly clear the working directory.
When the component requires an empty working directory but this option is disabled, an error will be returned if the working directory is not empty. | -| -U/--ulp/--unuselibrepo | No | bool | false | Specifies whether to prevent OBD from automatically taking actions when dependencies are missing. If this option is disabled and OBD detects that some dependencies are missing, OBD will automatically search for the corresponding libs mirrors and install them. If this option is enabled, the **unuse_lib_repository: true** field will be added to the corresponding configuration file. You can also add the **unuse_lib_repository: true** field to the configuration file to enable this option. | -| -A/--act/--auto-create-tenant | No | bool | false | Specifies whether to enable OBD to create the `test` tenant during the bootstrap by using all available resources of the cluster. If this option is enabled, the **auto_create_tenant: true** field will be added to the corresponding configuration file. You can also add the **auto_create_tenant: true** field to the configuration file to enable this option. | - -## `obd cluster start` - -Starts a deployed cluster. If the cluster is started, OBD will return its status. - -```shell -obd cluster start [flags] -``` - -`deploy name` specifies the name of the deployment configuration file. - -This table describes the corresponding options. - -| Option | Required | Data type | Default value | Description | ---- | --- | --- |--- | --- -| -s/--servers | No | string | | A list of machines, followed by the `name` value corresponding to `servers` in the `yaml` file, separated by `,`. Be used for specifying the start-up machines. If this option is disabled, all machines under the component will start without executing bootstrap. | -| -c/--components | No | string | | A list of components, separated by `,`. Be used for specifying the start-up components. If this option is disabled, all machines under the component will start without entering the running state. | -| --wop/--without-parameter | No | bool | false | Start without parameters. The node does not respond to this option when this node is starting for the first time. | -| -S/--strict-check | No | bool | false | Some components will do relevant checks before starting. OBD will throw an error when the check fails, but OBD will not force the process to stop. Using this option can return an error and directly exit the process when the component pre-check fails. We recommend that you enable this option to avoid startup failures due to insufficient resources. | - -## `obd cluster list` - -Shows the status of all clusters that have been registered to OBD. The cluster names are specified by the deploy name parameter. - -```shell -obd cluster list -``` - -## `obd cluster display` - -Shows the status of the specified cluster. - -```shell -obd cluster display -``` - -`deploy name` specifies the name of the deployment configuration file. - -## `obd cluster reload` - -Reloads a running cluster. After you modify the configuration information of a running cluster by using the `edit-config` command, you can run the `reload` command to let your modification take effect. - -> **NOTE:** Some configuration items may not take effect after you run the `reload` command. You need to restart or even redeploy the cluster for these configuration items to take effect. Do operations based on the result returned by the `edit-config` command. - -```shell -obd cluster reload -``` - -`deploy name` specifies the name of the deployment configuration file. - -## `obd cluster restart` - -Restarts a running cluster. By default, OBD restarts without any parameters. After you run the edit-config command to modify the configuration information of a running cluster, you can run the `restart` command for the modification to take effect. - -> **NOTE:** Some configuration items may not take effect after you run the `restart` command. You even need to redeploy the cluster for some configuration items to take effect. Perform operations based on the result returned by the edit-config command. - -```shell -obd cluster restart -``` - -`deploy name` specifies the name of the deployment configuration file. - -This table describes the corresponding options. - -| Option | Required | Data type | Default value | Description | ---- | --- | --- |--- | --- -| -s/--servers | No | string | | A list of machines, followed by the `name` value corresponding to `servers` in the `yaml` file, separated by `,`. | -| -c/--components | No | string | | A list of components, separated by `,`. Be used for specifying the start-up components. If this option is disabled, all machines under the component will start without entering the running state. | -| --wp/--with-parameter | No | bool | false | Restarts OBD with parameters. This option makes the parameters valid when you restart OBD. | - -## `obd cluster redeploy` - -Redeploys a running cluster. After you run the `edit-config` command to modify the configuration information of a running cluster, you can run the `redeploy` command to let your modification take effect. - -> **NOTE:** This command destroys the cluster and redeploys it. Data in the cluster will be lost. Please back up the data before you run this command. - -```shell -obd cluster redeploy -``` - -`deploy name` specifies the name of the deployment configuration file. - -## `obd cluster stop` - -Stops a running cluster. - -```shell -obd cluster stop -``` - -`deploy name` specifies the name of the deployment configuration file. - -This table describes the corresponding options. - -| Option | Required | Data type | Default value | Description | ---- | --- | --- |--- | --- -| -s/--servers | No | string | | A list of machines, followed by the `name` value corresponding to `servers` in the `yaml` file, separated by `,`. Be used for specifying the start-up machines. | -| -c/--components | No | string | | A list of components, separated by `,`. Be used for specifying the start-up components. If not all components under the configuration start, this configuration will not enter the stopped state. | - -## `obd cluster destroy` - -Destroys a deployed cluster. If the cluster is running state, this command will first try to execute `stop` and then `destroy` after success. - -```shell -obd cluster destroy [-f] -``` - -`deploy name` specifies the name of the deployment configuration file. - -`-f` is `--force-kill`. This option specifies whether to forcibly stop running processes in the working directory. Before OBD destroys the cluster, it will check for running processes. These processes may result from the failure of the **start** command. They may also belong to other clusters when configurations of this cluster overlap with those of other clusters. If an ongoing process is found in the working directory, OBD will stop the **destroy** command. However, if this option is enabled, OBD will forcibly stop the ongoing processes and run the **destroy** command. `-f` is optional. Its data type is `bool`. This option is disabled by default. - -## `obd cluster upgrade` - -Update a running component. - -```shell -obd cluster upgrade -c -V [tags] -``` - -`deploy name` specifies the name of the deployment configuration file. - -| Option | Required | Data type | Default value | Description | ---- | --- | --- |--- |--- --c/--component | Yes | string | empty | The component name you want to upgrade. --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. - -```shell -obd cluster tenant create [-n ] [flags] -``` - -`deploy name` specifies the name of the deployment configuration file. - -This table describes the corresponding options. - -| Option | Required | Data type | Default value | Description | ---- | --- | --- |--- | --- -| -n/--tenant-name | No | string | test | The tenant name. OBD will automatically generate resource units and resource pools with unique names based on the tenant name. | -| --max-cpu | No | float | 0 | The maximum number of CPU cores available for the tenant. When this option is set to 0, all available CPU cores of the cluster can be used by the tenant. | -| --min-cpu | No | float | 0 | The minimum number of CPU cores available for the tenant. When this option is set to 0, the minimum number of CPU cores is the same as the maximum number of CPU cores. | -| --max-memory | No | int | 0 | The maximum memory capacity available for the tenant. When this option is set to 0, all available memory capacity of the cluster can be used by the tenant. When the actual value is less than 1 GB, an error is returned. | -| --min-memory | No | int | 0 | The minimum memory capacity available for the tenant. When this option is set to 0, the minimum memory capacity is the same as the maximum memory capacity. | -| --max-disk-size | No | int | 0 | The maximum disk space available for the tenant. When this option is set to 0, all available disk space of the cluster can be used by the tenant. If the actual value is less than 512 MB, an error is returned. | -| --max-iops | No | int | 128 | The maximum IOPS for the tenant. Value range: [128, +∞). | -| --min-iops | No | int | 0 | The minimum IOPS for the tenant. Value range: [128, +∞). When this option is set to 0, the minimum IOPS is the same as the maximum IOPS. | -| --max-session-num | No | int | 64 | The maximum number of sessions allowed for the tenant. Value range: [64, +∞). | -| --unit-num | No | int | 0 | The number of units to be created in a zone. It must be less than the number of OBServers in the zone. When this option is set to 0, the maximum value is used. | -| -z/--zone-list | No | string | | Specifies the list of zones of the tenant. Separate multiple zones with commas (,). If this option is not specified, all zones of the cluster are included. | -| --primary-zone | No | string | RANDOM | The primary zone of the tenant. | -| --charset | No | string | | The character set of the tenant. | -| --collate | No | string | | The collation of the tenant. | -| --replica-num | No | int | 0 | The number of replicas of the tenant. When this option is set to 0, the number of replicas is the same as that of zones. | -| --logonly-replica-num | No | string | 0 | The number of log replicas of the tenant. When this option is set to 0, the number of log replicas is the same as that of replicas. | -| --tablegroup | No | string | | The default table group of the tenant. | -| --locality | No | string | | The distribution status of replicas across zones. For example, F@z1,F@z2,F@z3,R@z4 means that z1, z2, and z3 are full-featured replicas and z4 is a read-only replica. | -| -s/--variables | No | string | ob_tcp_invited_nodes='%' | The system variables of the tenant. | - -## `obd cluster tenant drop` - -Deletes a tenant. This command applies only to an OceanBase cluster. This command automatically deletes the corresponding resource units and resource pools. - -```shell -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 tenant list` - -list all tenant. This command applies only to an OceanBase cluster. - -```shell -obd cluster tenant list -``` - -`deploy name` specifies the name of the deployment configuration file. - -## obd cluster chst - -You can run this command to change the configuration style. - -```shell -obd cluster chst --style