执行版本升级:
obd cluster upgrade cluster_name -c oceanbase-ce -V 4.3.5.0 --usable=3bf011e10e446a947e15649f193dd75a766fc8a6c28034279d49d478faf54d2e
版本升级的起始版本:
| name | version | release | arch | md5 | mark |
+--------------+---------+------------------------+--------+------------------------------------------+-------+
| oceanbase-ce | 4.3.4.1 | 101000032024121814.el7 | x86_64 | fa56bff3614d8bcbb2a0c5f4c03f99979cc25d6a | start |
| oceanbase-ce | 4.3.5.0 | 100000202024123117.el7 | x86_64 | 48b61655aaa13e9b01b722928d1979c76b41937e | dest |
+--------------+---------+------------------------+--------+------------------------------------------+-------+
报错日志:
cluster scenario: olap
Start observer ok
observer program health check ok
Connect to observer 172.25.133.51:2881 ok
Exec upgrade_checker.py x <-- 报错
See https://www.oceanbase.com/product/ob-deployer/error-codes .
Trace ID: 7c37a610-fa86-11ef-8642-e8611f37b696
详细日志:
[2025-03-06 20:37:48.685] [ERROR] Traceback (most recent call last):
[2025-03-06 20:37:48.685] [ERROR] File "core.py", line 3223, in upgrade_cluster
[2025-03-06 20:37:48.685] [ERROR] File "core.py", line 233, in run_workflow
[2025-03-06 20:37:48.685] [ERROR] File "core.py", line 275, in run_plugin_template
[2025-03-06 20:37:48.685] [ERROR] File "core.py", line 320, in call_plugin
[2025-03-06 20:37:48.685] [ERROR] File "_plugin.py", line 352, in __call__
[2025-03-06 20:37:48.685] [ERROR] File "_plugin.py", line 309, in _new_func
[2025-03-06 20:37:48.685] [ERROR] File "/root/.obd/plugins/oceanbase-ce/4.2.1.4/upgrade.py", line 565, in upgrade
[2025-03-06 20:37:48.685] [ERROR] if upgrader.run():
[2025-03-06 20:37:48.685] [ERROR] File "/root/.obd/plugins/oceanbase-ce/4.2.1.4/upgrade.py", line 194, in run
[2025-03-06 20:37:48.685] [ERROR] if not self.process[self.process_index]():
[2025-03-06 20:37:48.685] [ERROR] File "/root/.obd/plugins/oceanbase-ce/4.2.1.4/upgrade.py", line 534, in take_over
[2025-03-06 20:37:48.685] [ERROR] if not self.run_workflow(obshell_port_check_workflows, repository, self.cluster_config, **{repository.name: {"upgrade_check": True}}):
[2025-03-06 20:37:48.685] [ERROR] File "/root/.obd/plugins/oceanbase-ce/4.2.1.4/upgrade.py", line 131, in run_workflow
[2025-03-06 20:37:48.685] [ERROR] return self._run_workflow(workflows, repositories=[repository], **kwargs)
[2025-03-06 20:37:48.685] [ERROR] File "core.py", line 233, in run_workflow
[2025-03-06 20:37:48.685] [ERROR] File "core.py", line 275, in run_plugin_template
[2025-03-06 20:37:48.685] [ERROR] File "core.py", line 320, in call_plugin
[2025-03-06 20:37:48.685] [ERROR] File "_plugin.py", line 352, in __call__
[2025-03-06 20:37:48.685] [ERROR] File "_plugin.py", line 309, in _new_func
[2025-03-06 20:37:48.685] [ERROR] File "/root/.obd/plugins/oceanbase-ce/4.2.1.4/obshell_port_check.py", line 40, in obshell_port_check
[2025-03-06 20:37:48.685] [ERROR] ports = servers_port[ip]
[2025-03-06 20:37:48.685] [ERROR] TypeError: 'NoneType' object is not subscriptable
报错代码:
def obshell_port_check(plugin_context, upgrade_check=False, *args, **kwargs):
cluster_config = plugin_context.cluster_config
clients = plugin_context.clients
stdio = plugin_context.stdio
critical = plugin_context.get_variable('critical')
servers_port = plugin_context.get_variable('servers_port')
port_check = upgrade_check or plugin_context.get_variable('port_check')
if not port_check:
return plugin_context.return_true()
stdio.info("plugin_context={}".format(plugin_context.__dict__)) # 手动添加日志输出
stdio.info("servers_port={}".format(servers_port)) # 手动添加日志输出
for server in cluster_config.servers:
ip = server.ip
stdio.info("Current IP={}".format(ip)) # 手动添加日志输出
client = clients[server]
server_config = cluster_config.get_server_conf_with_default(server)
ports = servers_port[ip] # <-- 【此处 servers_port 为 None】
if port_check:
stdio.verbose('%s port check' % server)
port = int(server_config.get('obshell_port'))
if port in ports:
critical(
server,
'port',
err.EC_CONFIG_CONFLICT_PORT.format(server1=server, port=port, server2=ports[port]['server'], key=ports[port]['key']),
[err.SUG_PORT_CONFLICTS.format()]
)
continue
if get_port_socket_inode(client, port):
critical(server, 'port', err.EC_CONFLICT_PORT.format(server=ip, port=port), [err.SUG_USE_OTHER_PORT.format()])
return plugin_context.return_true()
日志输出结果:
[2025-03-06 22:04:33.478] [INFO] plugin_context={'namespace': <_plugin.PluginContextNamespace object at 0x7f0caa766400>, 'namespaces': {'oceanbase-ce': <_plugin.PluginContextNamespace object at 0x7f0caa766400>}, 'deploy_name': 'cluster_name', 'deploy_status': <DeployStatus.STATUS_UPRADEING: 'upgrading'>, 'repositories': [<_repository.Repository object at 0x7f0caa8c53a0>], 'plugin_name': 'obshell_port_check', 'components': dict_keys(['oceanbase-ce', 'obagent', 'ocp-express']), 'clients': {<172.*.*.*>: <_plugin.ScriptPlugin.ClientForScriptPlugin object at 0x7f0caa7f49a0>}, 'cluster_config': <_deploy.ClusterConfig object at 0x7f0cab1b5ca0>, 'cmds': ['nrlj'], 'options': <Values at 0x7f0cab1f3e50: {'component': 'oceanbase-ce', 'version': '4.3.5.0', 'skip_check': None, 'usable': '3bf011e10e446a947e15649f193dd75a766fc8a6c28034279d49d478faf54d2e', 'disable': '', 'executer_path': '/usr/obd/lib/executer', 'script_query_timeout': '', 'ignore_standby': None, 'without_parameter': True}>, 'dev_mode': False, 'stdio': <_plugin.SubIO object at 0x7f0caa7f48e0>, 'concurrent_executor': <ssh.ConcurrentExecutor object at 0x7f0caa7f4c40>, '_return': <_plugin.PluginReturn object at 0x7f0caa7f4910>}
[2025-03-06 21:02:57.626] [INFO] servers_port=None
[2025-03-06 21:02:57.626] [INFO] Current IP=172.*.*.*
[2025-03-06 21:02:57.628] [ERROR] oceanbase-ce-py_script_obshell_port_check-4.2.1.4 RuntimeError: 'NoneType' object is not subscriptable
可以看出是 servers_port=None 导致的。
另外,当我回到 OCP EXPRESS 时,当前版本已经变更为了 4.3.5.0,说明版本升级成功了?
希望有大佬能帮忙协助排查一下,万分感谢。