[ERROR] ocp-server-ce-py_script_start_check-4.2.1 RuntimeError: ‘tenant_name‘

Oceanbase 安装成功后关闭OCP,在重新启动时报错

使用OBD 启动OCP报如下错误

admin@obd \~\]$ obd cluster start ocp Get local repositories ok Search plugins ok Open ssh connection ok Load cluster param plugin ok Check before start ocp-server x \[ERROR\] ocp-server-ce-py_script_start_check-4.2.1 RuntimeError: 'tenant_name' See https://www.oceanbase.com/product/ob-deployer/error-codes . Trace ID: 02d391f8-9a97-11ee-8034-000c291a63cd If you want to view detailed obd logs, please run: obd display-trace 02d391f8-9a97-11ee-8034-000c291a63cd 查看报错日志: 使用 more /home/admin/.obd/log/obd 或报错日志中的 obd display-trace 02d391f8-9a97-11ee-8034-000c291a63cd 查看报错日志 \[2023-12-12 19:23:23.870\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] ocp-server-ce-py_script_start_check-4.2.1 RuntimeError: 'tenant_name' \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] Traceback (most recent call last): \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] File "core.py", line 1673, in start_cluster \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] File "core.py", line 1743, in _start_cluster \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] File "core.py", line 184, in call_plugin \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] File "_plugin.py", line 324, in __call__ \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] File "_plugin.py", line 286, in _new_func \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] File "/home/admin/.obd/plugins/ocp-server-ce/4.2.1/start_check.py", line 318, in start_check \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] error('tenant', err.EC_OCP_SERVER_TENANT_ALREADY_EXISTS.format({"tenant_name":monitor_tenant})) \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] File "_errno.py", line 50, in format \[2023-12-12 19:23:23.871\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR\] KeyError: 'tenant_name' \[2023-12-12 19:23:23.872\] \[dbde7188-98e0-11ee-9459-000c291a63cd\] \[ERROR

处理方法:

编辑 /home/admin/.obd/plugins/ocp-server-ce/4.2.1/start_check.py Python文件 318 上方的skip_create_tenant强制赋值为True,并注释掉如下两行,保存文件。

304 #skip_create_tenant = 'False'

305 #skip_create_tenant = getattr(options, "skip_create_tenant", "False")

vi /home/admin/.obd/plugins/ocp-server-ce/4.2.1/start_check.py

python 复制代码
303                 # tenant check
304                 #skip_create_tenant = 'False'
305                 #skip_create_tenant = getattr(options, "skip_create_tenant", "False")
306                 skip_create_tenant = 'True'
307                 if skip_create_tenant == 'False':
308                     sql = "select * from oceanbase.DBA_OB_TENANTS where TENANT_NAME = %s"
309                     meta_tenant = server_config.get('ocp_meta_tenant')['tenant_name']
310                     meta_max_cpu = server_config['ocp_meta_tenant'].get('max_cpu', 2)
311                     meta_memory_size = server_config['ocp_meta_tenant'].get('memory_size', '2G')
312                     if server_config.get('ocp_monitor_tenant'):
313                         monitor_user = server_config.get('ocp_monitor_username', 'monitor_user')
314                         monitor_tenant = server_config['ocp_monitor_tenant']['tenant_name']
315                         monitor_max_cpu = server_config['ocp_monitor_tenant'].get('max_cpu', 2)
316                         monitor_memory_size = server_config['ocp_monitor_tenant'].get('memory_size',     '4G')
317                         res = cursor.fetchone(sql, [monitor_tenant])
318                         if res:
319                             error('tenant', err.EC_OCP_SERVER_TENANT_ALREADY_EXISTS.format({"tenant_    name":monitor_tenant}))
320                     res = cursor.fetchone(sql, [meta_tenant])
321                     if res:
322                         error('tenant', err.EC_OCP_SERVER_TENANT_ALREADY_EXISTS.format({"tenant_name    ":meta_tenant}))
323                     break

然后 输入如下命令可以正常启动了

bash 复制代码
 obd cluster start ocp
相关推荐
一只栖枝8 天前
OCP证书有效期是永久,但需要更新
数据库·开闭原则·ocp·oracle认证·ocp培训·ocp证书
一只栖枝11 天前
Oracle OCP知识点详解3:使用 vim 编辑文件
oracle·vim·开闭原则·技巧·ocp
一只栖枝13 天前
Oracle OCP知识点详解2:yum 等服务的搭建
数据库·oracle·开闭原则·yum·ocp·服务搭建
一只栖枝23 天前
Oracle OCP知识点详解2:管理用户密码期限
数据库·oracle·开闭原则·ocp
xmweisi2 个月前
解锁OCP认证:通往数据库精英之路
oracle·dba·数据库管理·ocp·ocp认证·ocp培训·ocp考试
leegong231113 个月前
什么是Oracle认证专家(OCP)?
数据库·oracle·ocp
xmweisi3 个月前
【ORACLE战报】2025.1月OCP | MySQL考试
mysql·oracle·ocp·oracle认证·082·083·908
一只栖枝4 个月前
Oracle OCP考试常见问题之线上考试流程
数据库·oracle·开闭原则·ocp
咕噜Yuki06095 个月前
OCP证书如何下载?
数据库·ocp·证书查询
solinger8 个月前
kubebuiler安装
kubernetes·openshift·ocp