diff --git a/_arch.py b/_arch.py index 0dd5b3a2053f352a1ad3263f7ca08f331c038798..8ee6aed9e23b197e7bb9de74450f41570c20db72 100644 --- a/_arch.py +++ b/_arch.py @@ -1,21 +1,4 @@ # coding: utf-8 -# OceanBase Deploy. -# Copyright (C) 2021 OceanBase -# -# This file is part of OceanBase Deploy. -# -# OceanBase Deploy is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# OceanBase Deploy is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OceanBase Deploy. If not, see . import os import ctypes import struct @@ -23,12 +6,13 @@ import struct _ppc64_native_is_best = True # dict mapping arch -> ( multicompat, best personality, biarch personality ) -multilibArches = { "x86_64": ( "athlon", "x86_64", "athlon" ), - "sparc64v": ( "sparcv9v", "sparcv9v", "sparc64v" ), - "sparc64": ( "sparcv9", "sparcv9", "sparc64" ), - "ppc64": ( "ppc", "ppc", "ppc64" ), - "s390x": ( "s390", "s390x", "s390" ), - } +multilibArches = { + "x86_64": ( "athlon", "x86_64", "athlon" ), + "sparc64v": ( "sparcv9v", "sparcv9v", "sparc64v" ), + "sparc64": ( "sparcv9", "sparcv9", "sparc64" ), + "ppc64": ( "ppc", "ppc", "ppc64" ), + "s390x": ( "s390", "s390x", "s390" ), +} if _ppc64_native_is_best: multilibArches["ppc64"] = ( "ppc", "ppc64", "ppc64" ) @@ -103,14 +87,15 @@ arches = { #itanium "ia64": "noarch", - } +} # Will contain information parsed from /proc/self/auxv via _parse_auxv(). # Should move into rpm really. _aux_vector = { "platform": "", "hwcap": 0, - } +} + def _try_read_cpuinfo(): """ Try to read /proc/cpuinfo ... if we can't ignore errors (ie. proc not @@ -120,6 +105,7 @@ def _try_read_cpuinfo(): except: return [] + def _parse_auxv(): """ Read /proc/self/auxv and parse it into global dict for easier access later on, very similar to what rpm does. """ @@ -146,6 +132,7 @@ def _parse_auxv(): _aux_vector["hwcap"] = at_val offset = offset + fmtlen + def getCanonX86Arch(arch): # if arch == "i586": @@ -171,6 +158,7 @@ def getCanonX86Arch(arch): return arch + def getCanonARMArch(arch): # the %{_target_arch} macro in rpm will let us know the abi we are using try: @@ -182,6 +170,7 @@ def getCanonARMArch(arch): pass return arch + def getCanonPPCArch(arch): # FIXME: should I do better handling for mac, etc? if arch != "ppc64": @@ -212,6 +201,7 @@ def getCanonPPCArch(arch): return "ppc64iseries" return arch + def getCanonSPARCArch(arch): # Deal with sun4v, sun4u, sun4m cases SPARCtype = None @@ -253,7 +243,8 @@ def getCanonX86_64Arch(arch): if vendor.find("GenuineIntel") != -1: return "ia32e" return arch - + + def getCanonArch(skipRpmPlatform = 0): if not skipRpmPlatform and os.access("/etc/rpm/platform", os.R_OK): try: @@ -282,8 +273,10 @@ def getCanonArch(skipRpmPlatform = 0): return getCanonX86_64Arch(arch) return arch + canonArch = getCanonArch() + def isMultiLibArch(arch=None): """returns true if arch is a multilib arch, false if not""" if arch is None: @@ -300,6 +293,7 @@ def isMultiLibArch(arch=None): return 0 + def getBaseArch(myarch=None): """returns 'base' arch for myarch, if specified, or canonArch if not. base arch is the arch before noarch in the arches dict if myarch is not @@ -338,7 +332,8 @@ def getBaseArch(myarch=None): value = arches[basearch] return basearch - + + def getArchList(thisarch=None): # this returns a list of archs that are compatible with arch given if not thisarch: diff --git a/_cmd.py b/_cmd.py index 95d4da8ce41b1279b1ab8157d59b0d2d6accb3f6..bb889b7266ec67bc50ff637221d77e8a030afa69 100644 --- a/_cmd.py +++ b/_cmd.py @@ -69,20 +69,27 @@ class AllowUndefinedOptionParser(OptionParser): def _process_long_opt(self, rargs, values): try: + value = rargs[0] OptionParser._process_long_opt(self, rargs, values) except BadOptionError as e: if self.allow_undefine: + key = e.opt_str + value = value[len(key)+1:] + setattr(values, key.strip('-').replace('-', '_'), value if value != '' else True) return self.warn(e) else: raise e def _process_short_opts(self, rargs, values): try: + value = rargs[0] OptionParser._process_short_opts(self, rargs, values) except BadOptionError as e: if self.allow_undefine: + key = e.opt_str + value = value[len(key)+1:] + setattr(values, key.strip('-').replace('-', '_'), value if value != '' else True) return self.warn(e) - return else: raise e @@ -787,6 +794,7 @@ class MySQLTestCommand(TestMirrorCommand): self.parser.add_option('--obclient-bin', type='string', help='OBClient bin path. [obclient]', default='obclient') self.parser.add_option('--test-dir', type='string', help='Test case file directory. [./mysql_test/t]', default='./mysql_test/t') self.parser.add_option('--result-dir', type='string', help='Result case file directory. [./mysql_test/r]', default='./mysql_test/r') + self.parser.add_option('--record', action='store_true', help='record mysqltest execution results', default=False) self.parser.add_option('--record-dir', type='string', help='The directory of the result file for mysqltest.') self.parser.add_option('--log-dir', type='string', help='The log file directory. [./log]', default='./log') self.parser.add_option('--tmp-dir', type='string', help='Temporary directory for mysqltest. [./tmp]', default='./tmp') @@ -910,7 +918,7 @@ class TestMajorCommand(MajorCommand): self.register_command(MySQLTestCommand()) self.register_command(SysBenchCommand()) self.register_command(TPCHCommand()) - # self.register_command(TPCCCommand()) + self.register_command(TPCCCommand()) class BenchMajorCommand(MajorCommand): diff --git a/_deploy.py b/_deploy.py index ed512f08776e606035967f020e9e44d5d03302fc..0631068d04b61e207e295415094618a4e669c746 100644 --- a/_deploy.py +++ b/_deploy.py @@ -1083,7 +1083,7 @@ class ConfigParserManager(Manager): return parser parser = self._get_global_parser(style) if not parser: - raise ParserError('Unsupported configuration style: %s' % style) + raise ParserError('Unsupported configuration style: %s %s' % (component, style)) return parser diff --git a/_errno.py b/_errno.py index 331fc19a44bca52b97a3ab95418f96c564290460..28d78d3605c87d369081a9d403f97fb42dca6571 100644 --- a/_errno.py +++ b/_errno.py @@ -49,7 +49,7 @@ class InitDirFailedErrorMessage(object): PERMISSION_DENIED = ': {path} permission denied .' -DOC_LINK_MSG = 'See https://open.oceanbase.com/docs/obd-cn/V1.3.0/10000000000099584.' +DOC_LINK_MSG = 'See https://open.oceanbase.com/docs/obd-cn/V1.4.0/10000000000436999 .' EC_CONFIG_CONFLICT_PORT = OBDErrorCode(1000, 'Configuration conflict {server1}:{port} port is used for {server2}\'s {key}') EC_CONFLICT_PORT = OBDErrorCode(1001, '{server}:{port} port is already used') @@ -57,6 +57,8 @@ EC_FAIL_TO_INIT_PATH = OBDErrorCode(1002, 'Fail to init {server} {key}{msg}') EC_CLEAN_PATH_FAILED = OBDErrorCode(1003, 'Fail to clean {server}:{path}') EC_CONFIG_CONFLICT_DIR = OBDErrorCode(1004, 'Configuration conflict {server1}: {path} is used for {server2}\'s {key}') EC_SOME_SERVER_STOPED = OBDErrorCode(1005, 'Some of the servers in the cluster have been stopped') +EC_FAIL_TO_CONNECT = OBDErrorCode(1006, 'Failed to connect to {component}') +EC_ULIMIT_CHECK = OBDErrorCode(1007, '({server}) {key} must not be less than {need} (Current value: {now})') EC_OBSERVER_NOT_ENOUGH_MEMORY = OBDErrorCode(2000, '({ip}) not enough memory. (Free: {free}, Need: {need})') EC_OBSERVER_CAN_NOT_MIGRATE_IN = OBDErrorCode(2001, 'server can not migrate in') @@ -66,7 +68,11 @@ EC_OBSERVER_INVALID_MODFILY_GLOBAL_KEY = OBDErrorCode(2004, 'Invalid: {key} is n EC_MYSQLTEST_PARSE_CMD_FAILED = OBDErrorCode(3000, 'parse cmd failed: {path}') EC_MYSQLTEST_FAILE_NOT_FOUND = OBDErrorCode(3001, '{file} not found in {path}') +EC_TPCC_LOAD_DATA_FAILED = OBDErrorCode(3002, 'Failed to load data.') +EC_TPCC_RUN_TEST_FAILED = OBDErrorCode(3003, 'Failed to run TPC-C benchmark.') EC_OBAGENT_RELOAD_FAILED = OBDErrorCode(4000, 'Fail to reload {server}') EC_OBAGENT_SEND_CONFIG_FAILED = OBDErrorCode(4001, 'Fail to send config file to {server}') +# WARN CODE +WC_ULIMIT_CHECK = OBDErrorCode(1007, '({server}) The recommended number of {key} is {need} (Current value: %s)') \ No newline at end of file diff --git a/core.py b/core.py index ee37376674781973ba9045a9ed32aa7ca163e57d..21820b7098bc6df23fcae69e6937792b29e00437 100644 --- a/core.py +++ b/core.py @@ -939,7 +939,6 @@ class ObdHome(object): db = ret.get_return('connect') cursor = ret.get_return('cursor') else: - self._call_stdio('error', 'Failed to connect %s' % repository.name) break self._call_stdio('verbose', 'Call %s for %s' % (ocp_check[repository], repository)) @@ -1257,7 +1256,6 @@ class ObdHome(object): db = ret.get_return('connect') cursor = ret.get_return('cursor') else: - self._call_stdio('error', 'Failed to connect %s' % repository.name) break if need_bootstrap and start_all: @@ -1329,7 +1327,6 @@ class ObdHome(object): db = ret.get_return('connect') cursor = ret.get_return('cursor') if not db: - self._call_stdio('error', 'Failed to connect %s' % repository.name) return False self._call_stdio('verbose', 'Call %s for %s' % (create_tenant_plugins[repository], repository)) @@ -1376,7 +1373,6 @@ class ObdHome(object): db = ret.get_return('connect') cursor = ret.get_return('cursor') if not db: - self._call_stdio('error', 'Failed to connect %s' % repository.name) return False self._call_stdio('verbose', 'Call %s for %s' % (drop_tenant_plugins[repository], repository)) @@ -1466,7 +1462,6 @@ class ObdHome(object): db = ret.get_return('connect') cursor = ret.get_return('cursor') else: - self._call_stdio('error', 'Failed to connect %s' % repository.name) continue self._call_stdio('verbose', 'Call %s for %s' % (reload_plugins[repository], repository)) @@ -1537,7 +1532,6 @@ class ObdHome(object): db = ret.get_return('connect') cursor = ret.get_return('cursor') if not db: - self._call_stdio('error', 'Failed to connect %s' % repository.name) return False self._call_stdio('verbose', 'Call %s for %s' % (display_plugins[repository], repository)) @@ -2135,7 +2129,6 @@ class ObdHome(object): db = ret.get_return('connect') cursor = ret.get_return('cursor') if not db: - self._call_stdio('error', 'Failed to connect %s' % current_repository.name) return False self._call_stdio('verbose', 'Call %s for %s' % (upgrade_check_plugins[current_repository], current_repository)) if not upgrade_check_plugins[current_repository]( @@ -2369,7 +2362,6 @@ class ObdHome(object): connect_plugin = self.search_py_script_plugin(repositories, 'connect')[repository] ret = connect_plugin(deploy_config.components.keys(), ssh_clients, cluster_config, [], {}, self.stdio, target_server=opts.test_server, sys_root=False) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False db = ret.get_return('connect') cursor = ret.get_return('cursor') @@ -2430,7 +2422,6 @@ class ObdHome(object): connect_plugin = self.search_py_script_plugin(repositories, 'connect')[repository] ret = connect_plugin(deploy_config.components.keys(), ssh_clients, cluster_config, [], {}, self.stdio, target_server=opts.test_server, sys_root=False) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect server') break db = ret.get_return('connect') cursor = ret.get_return('cursor') @@ -2482,6 +2473,14 @@ class ObdHome(object): if opts.component is None: for component_name in allow_components: if component_name in deploy_config.components: + if opts.test_server is not None: + cluster_config = deploy_config.components[component_name] + for server in cluster_config.servers: + if server.name == opts.test_server: + break + else: + continue + self._call_stdio('verbose', 'Select component %s' % component_name) opts.component = component_name break elif opts.component not in allow_components: @@ -2556,14 +2555,12 @@ class ObdHome(object): break ret = connect_plugin(deploy_config.components.keys(), ssh_clients, cluster_config, [], {}, self.stdio, target_server=opts.test_server) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False odp_db = ret.get_return('connect') odp_cursor = ret.get_return('cursor') ret = connect_plugin(deploy_config.components.keys(), ssh_clients, cluster_config, [], {}, self.stdio, target_server=opts.test_server, **env) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False db = ret.get_return('connect') cursor = ret.get_return('cursor') @@ -2650,7 +2647,6 @@ class ObdHome(object): connect_plugin = self.search_py_script_plugin(repositories, 'connect')[repository] ret = connect_plugin(deploy_config.components.keys(), ssh_clients, cluster_config, [], {}, self.stdio, target_server=opts.test_server) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False db = ret.get_return('connect') cursor = ret.get_return('cursor') @@ -2786,7 +2782,6 @@ class ObdHome(object): ret = connect_plugin(deploy_config.components.keys(), ssh_clients, cluster_config, [], {}, self.stdio, target_server=opts.test_server) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False odp_db = ret.get_return('connect') odp_cursor = ret.get_return('cursor') @@ -2798,7 +2793,6 @@ class ObdHome(object): ret = connect_plugin(deploy_config.components.keys(), ssh_clients, cluster_config, [], {}, self.stdio, target_server=opts.test_server, **env) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False db = ret.get_return('connect') cursor = ret.get_return('cursor') @@ -2867,7 +2861,6 @@ class ObdHome(object): self.stdio, target_server=opts.test_server) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False odp_db = ret.get_return('connect') odp_cursor = ret.get_return('cursor') @@ -2875,7 +2868,6 @@ class ObdHome(object): self.stdio, target_server=opts.test_server, **env) if not ret or not ret.get_return('connect'): - self._call_stdio('error', 'Failed to connect to the server') return False db = ret.get_return('connect') cursor = ret.get_return('cursor') diff --git a/docs/docs-cn/Q&A.md b/docs/docs-cn/Q&A.md index a2aa2c15c20bcce9346c3e49707f2de7a6b6e6d2..fc7686ab05d025755342f7feca1d820587a7fc2c 100644 --- a/docs/docs-cn/Q&A.md +++ b/docs/docs-cn/Q&A.md @@ -30,73 +30,6 @@ oceanbase-ce: A:您可以修改 `~/.obd/plugins/oceanbase-ce/` 下的启动相关插件。比如您为 3.1.0 版本的 OceanBase-CE 添加了一个新的启动配置,可以修改 `~/.obd/plugins/oceanbase-ce/3.1.0/start.py`。 -## Q:如何在离线模式下更新 OBD 本地镜像? - -A:当您安装 OBD 的机器不能连通公网,却需要更新 OBD 或其他组件时,您可先在一台可以连通公网的机器上下载好您需要的 RPM 包,将其拷贝到安装 OBD 的机器上后通过 `obd mirror clone` 将新的 RPM 包添加到 local mirror 中。 - -下面展示如何更新本地仓库中的 OBD 镜像: -```shell -# 先在一台可以连通公网的机器上下载 OBD 1.2.1 el7 RPM 包 -# 最新的 RPM 包链接可以在对应的组件的 git 仓库中的 release note 或 OceanBase 开源官网(https://open.oceanbase.com/softwareCenter/community)中获得 -wget https://github.com/oceanbase/obdeploy/releases/download/v1.2.1/ob-deploy-1.2.1-9.el7.x86_64.rpm -# 将下载好的 RPM 包拷贝到安装 OBD 的机器(obd_server)中 -sh ob-deploy-1.2.1-9.el7.x86_64.rpm obd_server:~ -# 将下载好的镜像加入到 local 中 -obd mirror clone ob-deploy-1.2.1-9.el7.x86_64.rpm -# 关闭远程镜像源 -obd mirror disable remote -``` - ## Q:如何升级 OBD? -A:升级 OBD 有以下两种方式,您可根据您的实际情况进行选择: -+ 如果您的机器可以连通公网或者您配置的 mirror 中有用于更新的 OBD 的 RPM 包,您可直接使用 `obd update` 命令升级 OBD。当您升级完成后可以使用命令 `obd --version` 查看版本,确认是否升级成功。 -+ 如果您的机器不能连通公网且您配置的 mirror 中没有用于更新的 OBD 的 RPM 包,请先通过 `obd mirror clone` 将用于更新的 OBD 的 RPM 包添加到 local mirror 中,之后再使用 `obd update` 命令升级 OBD。 - -下面展示在离线模式下,如何在 CentOS7 系统中将 OBD 升级到 V1.2.1: -```shell -# 先在一台可以连通公网的机器上下载 OBD 1.2.1 el7 RPM 包 -# 最新的 RPM 包链接可以在 git 仓库中的 release note 或 OceanBase 开源官网(https://open.oceanbase.com/softwareCenter/community)中获得 -wget https://github.com/oceanbase/obdeploy/releases/download/v1.2.1/ob-deploy-1.2.1-9.el7.x86_64.rpm -# 将下载好的 RPM 包拷贝到安装 OBD 的机器(obd_server)中 -sh ob-deploy-1.2.1-9.el7.x86_64.rpm obd_server:~ -# 在 OBD 机器上执行以下命令完成升级 -# 1.将下载好的镜像加入到 local 中 -obd mirror clone ob-deploy-1.2.1-9.el7.x86_64.rpm -# 2.关闭远程镜像源 -obd mirror disable remote -# 3.升级 -obd update -``` - -## Q:如何使用 OBD 升级 OceanBase 数据库? - -A:使用 OBD 升级 OceanBase 数据库有以下两种方式,您可根据您的实际情况进行选择: -+ 如果您的机器可以连通公网或者您配置的 mirror 中有用于更新的 OceanBase 数据库的 RPM 包,您可直接使用 `obd cluster upgrade` 命令升级 OceanBase 数据库。 -+ 如果您的机器不能连通公网且您配置的 mirror 中没有用于更新的 OceanBase 数据库的 RPM 包,请先通过 `obd mirror clone` 将用于更新的 OceanBase 数据库的 RPM 包添加到 local mirror 中,之后再使用 `obd cluster upgrade` 命令升级 OceanBase 数据库。 - -下面展示在离线模式下,如何在 CentOS7 系统中使用 OBD 将 OceanBase-CE V3.1.1 升级到 V3.1.2: - -```shell -# 请先确认您的 OBD 版本,如果版本低于 V1.2.1,请先更新 OBD 的版本 -# 在一台可以连通公网的机器上下载 OceanBase-CE RPM 包 -# 最新的 RPM 包链接可以在 git 仓库中的 release note 或 OceanBase 开源官网(https://open.oceanbase.com/softwareCenter/community)中获得 -wget https://github.com/oceanbase/oceanbase/releases/download/v3.1.2_CE/oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm -# 将下载好的 RPM 包拷贝到安装 OBD 的机器(obd_server)中 -sh oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm obd_server:~ -# 在 OBD 机器上执行以下命令完成升级 -# 1.将下载好的镜像加入到 local 中 -obd mirror clone oceanbase-ce-3.1.2-10000392021123010.el7.x86_64.rpm -# 2.关闭远程镜像源 -obd mirror disable remote -# 3.升级 -obd cluster upgrade -c oceanbase-ce -V 3.1.2 -``` - -### 报错处理 - -您可能会遇到 `Too many match` 的报错,这时只需在 `Candidates` 上选择一个 `hash` 即可。比如: - -```shell -obd cluster upgrade -c oceanbase-ce -V 3.1.2 --usable 7fafba0fac1e90cbd1b5b7ae5fa129b64dc63aed -``` +A:您可以使用 `obd update` 命令升级 OBD。当您升级完成后可以使用命令 `obd --version` 查看版本,确认是否升级成功。 diff --git a/docs/docs-cn/install-and-use/install-obd.md b/docs/docs-cn/install-and-use/install-obd.md index 8498cb161305361c55a408e085f9be5ca45ef9fc..08619c632420278a6d8d38f506f4f6089109ec2a 100644 --- a/docs/docs-cn/install-and-use/install-obd.md +++ b/docs/docs-cn/install-and-use/install-obd.md @@ -37,7 +37,3 @@ pip install -r requirements3.txt sh build.sh source /etc/profile.d/obd.sh ``` - -> **注意:** 为了与 release 版本区分开,源码安装产生的版本号为 4 位版本号,即在 rpm 包的版本号基础上加上安装时间,比如 1.2.0.1641267289。 - -另外您可通过在安装前设置环境变量 `export OBD_DUBUG=1` 安装开启 DEBUG 模式的 OBD,该模式下每一条命令结束后都会输出对应的 trace id 以方便问题定位。 diff --git a/docs/docs-cn/obd-commands/cluster-commands.md b/docs/docs-cn/obd-commands/cluster-commands.md index 9e79b44fe4bc4f6a4a8d1e96634e50b589bc9098..a5312badb9c9a795cb486208d7e55305ace70af2 100644 --- a/docs/docs-cn/obd-commands/cluster-commands.md +++ b/docs/docs-cn/obd-commands/cluster-commands.md @@ -74,7 +74,7 @@ obd cluster start [flags] 选项名 | 是否必选 | 数据类型 | 默认值 | 说明 --- | --- | --- |--- |--- --s/--servers | 否 | string | 空 | 机器列表,后跟 `yaml` 文件中 `servers` 对应的 `name` 值,用 `,` 间隔。用于指定启动的机器。如果组件下的机器没有全部启动,则 start 不会执行 bootstrap。 +-s/--servers | 否 | string | 空 | 机器列表,用 `,` 间隔。用于指定启动的机器。如果组件下的机器没有全部启动,则 start 不会执行 bootstrap。 -c/--components | 否 | string | 空 | 组件列表,用 `,` 间隔。用于指定启动的组件。如果配置下的组件没有全部启动,该配置不会进入 running 状态。 --wop/--without-parameter | 否 | bool | false | 无参启动。启动的时候不带参数。节点第一次的启动时,不响应此选项。 -S/--strict-check | 否 | bool | false | 部分组件在启动前会做相关的检查。检查不通过时,OBD 将发出告警,不会强制停止流程。使用该选项可开启检查失败报错直接退出。建议开启,可以避免一些资源不足导致的启动失败。 @@ -111,7 +111,7 @@ obd cluster reload ## `obd cluster restart` -重启一个运行中集群。重启默认是无参数重启。当您使用 edit-config 修改一个运行的集群的配置信息后,可以通过 `restart` 命令应用修改。 +重启一个运行中集群。重启默认是无参重启。当您使用 edit-config 修改一个运行的集群的配置信息后,可以通过 `obd cluster restart --wp` 命令应用修改。 > **注意:** 并非所有的配置项都可以通过 `restart` 来应用。有些配置项需要重部署集群才能生效。请根据 `edit-config` 后返回的信息进行操作。 @@ -125,9 +125,9 @@ obd cluster restart 选项名 | 是否必选 | 数据类型 | 默认值 | 说明 --- | --- | --- |--- |--- --s/--servers | 否 | string | 空 | 机器列表,后跟 `yaml` 文件中 `servers` 对应的 `name` 值,用 `,` 间隔。 +-s/--servers | 否 | string | 空 | 机器列表,用 `,` 间隔。 -c/--components | 否 | string | 空 | 组件列表,用 `,` 间隔。用于指定启动的组件。如果配置下的组件没有全部启动,该配置不会进入 running 状态。 ---wp/--with-parameter | 否 | bool | false | 使用参数重启 OBD。用于在重启时使配置项生效。 +--wp/--with-parameter | 否 | bool | false | 带参重启。用于让重启生效的配置项生效。 ## `obd cluster redeploy` @@ -155,7 +155,7 @@ obd cluster stop 选项名 | 是否必选 | 数据类型 | 默认值 | 说明 --- | --- | --- |--- |--- --s/--servers | 否 | string | 空 | 机器列表,后跟 `yaml` 文件中 `servers` 对应的 `name` 值,用 `,` 间隔。用于指定停止的机器。 +-s/--servers | 否 | string | 空 | 机器列表,用 `,` 间隔。用于指定停止的机器。 -c/--components | 否 | string | 空 | 组件列表,用 `,` 间隔。用于指定停止的组件。如果配置下的组件没有全部停止,该配置不会进入 stopped 状态。 ## `obd cluster destroy` @@ -175,7 +175,7 @@ obd cluster destroy [-f] 升级一个已经启动的组件。 ```shell -obd cluster upgrade -c -V [tags] +obd cluster upgrade -c -V [tags] ``` 参数 `deploy name` 为部署配置名称,可以理解为配置文件名称。 @@ -183,12 +183,28 @@ obd cluster upgrade -c -V [tags] 选项名 | 是否必选 | 数据类型 | 默认值 | 说明 --- | --- | --- |--- |--- -c/--component | 是 | string | 空 | 要升级的组件名。 --V/--version | 是 | string | 目标版本号。 +-V/--version | 是 | string | 空 | 目标版本号。 --skip-check | 否 | bool | false | 跳过可以跳过的检查。 --usable | 否 | string | 空 | 升级中使用到的镜像hash列表,用 `,` 间隔。 --disable | 否 | string | 空 | 升级中禁用到的镜像hash列表,用 `,` 间隔。 -e/--executer-path | 否 | string | /usr/obd/lib/executer | 升级脚本使用的解释器所在路径。 +## `obd cluster change-repo` + +修改一个已部署的组件的仓库。新的仓库必须与当前仓库版本号相同。仅在部署状态为running时,该命令在替换仓库后会使用无参启动,重新拉起组件。 + +```shell +obd cluster change-repo -c --hash [-f/--force] +``` + +参数 `deploy name` 为部署配置名称,可以理解为配置文件名称。 + +选项名 | 是否必选 | 数据类型 | 默认值 | 说明 +--- | --- | --- |--- |--- +-c/--component | 是 | string | 空 | 要替换仓库的组件名。 +--hash | 是 | string | 空 | 目标仓库。必须必须与当前仓库版本号相同。 +-f/--force | 否 | bool | false | 启动失败也强制替换。 + ## `obd cluster tenant create` 创建租户。该命令仅对 OceanBase 数据库有效。该命令会自动创建资源单元和资源池,用户不需要手动创建。 @@ -234,3 +250,39 @@ obd cluster tenant drop [-n ] 参数 `deploy name` 为部署配置名称,可以理解为配置文件名称。 选项 `-n` 为 `--tenant-name`。要删除的租户名。必填项。 + +## `obd cluster chst` + +配置风格转换。 + +```shell +obd cluster chst --style