【 使用环境 】测试环境
【 OB or 其他组件 】
【 使用版本 】
【问题描述】ocp创建集群报错
【复现路径】问题出现前后相关操作
你这报错的原因已经很清楚了啊
你发下ocp版本以及包含报错时间的ocp-server.log
先把其中明确的容量报错的问题解决了。 再看看。
是ocp.log吗?
这个不影响的,这三台机器只是用来测试。用不了那么多
日志盘太小了
早上9点半左右
你点其它页面会随机出现“Unexpected error”吗?
F12打开调试界面看下 是否有哪个接口异常
学习!!!!
Duplicate entry ‘192.168.2.184-2882’ for key ‘uk_ob_server_ip_port’
uk_ob_server_ip_port 看起来是唯一约束冲突,我看下这个
2026-05-19 10:38:17.819 INFO 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.o.s.c.c.s.utils.CsrfRequestMatcher : CSRF token required for API [POST /api/v2/ob/clusters, client 192.168.2.3, traceId ad38d69221df98b2]
2026-05-19 10:38:17.822 INFO 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.o.s.c.trace.RequestTracingAspect : API: [POST /api/v2/ob/clusters?null, client=192.168.2.3, traceId=ad38d69221df98b2, method=SuccessResponse com.oceanbase.ocp.server.common.controller.ObClusterController.createObCluster(CreateObClusterParam), args=CreateObClusterParam(name=ocp, vpcName=null, vpcId=null, obClusterId=null, fullVersion=4.2.5.5-105020012025081414, packageOperatingSystem=null, rpmName=null, type=PRIMARY, password=xxx saveToCredential=true, primaryZone=null, zones=[ObZoneParam(name=zone1, idcName=idc, servers=[2000001], architecture=x86_64, rpmName=oceanbase-4.2.5.5-105020012025081414.el7.x86_64.rpm, rootServer=2000001)], startupParameters=[ObParameterParam(name=enable_record_trace_log, value=false), ObParameterParam(name=enable_syslog_recycle, value=1), ObParameterParam(name=large_query_threshold, value=600s), ObParameterParam(name=max_syslog_file_count, value=300)], obproxyClusterIds=null, obproxyClusterKeyList=null, obproxyUserName=proxyro, obproxyUserpassword=xxx attributes=ClusterAttributes(installPath=/home/admin/oceanbase, runPath=null, dataDiskPath=/data/1, logDiskPath=/data/log1, diskPathStyle=null, operatingSystemUser=null, sqlPort=2881, svrPort=2882), installPath=/home/admin/oceanbase, dataDiskPath=/data/1, logDiskPath=/data/log1, primaryClusterInfo=PrimaryClusterInfo(rootSyspassword=xxx obClusterId=null, vpcId=null, vpcName=null, fullVersion=null, rootserverJson=null), arbitrationServiceId=null, timeZone=null, clientToken=null, oversellingFactor=null, cgroupEnabled=true, createExtraTenant=false, supportObsBackup=false, simplifiedCreateTenantParam=null, loadType=HTAP),]
2026-05-19 10:38:17.837 INFO 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.o.s.common.DistributedLockAspect : Get distributed lock, lockKey=ob-cluster-ocp, method=createCluster
2026-05-19 10:38:17.915 INFO 8 --- [pool-22494-thread-1,,] c.o.o.c.agent.HostAgentServiceImpl : Finding OCP agent: hostId=2000001
2026-05-19 10:38:17.919 INFO 8 --- [pool-22494-thread-1,,] c.o.o.c.a.p.HostAgentProcessServiceImpl : Getting all OCP agent processes on host 2000001
2026-05-19 10:38:17.972 INFO 8 --- [pool-22494-thread-1,,] c.o.o.e.internal.template.HttpTemplate : POST request to agent, url:http://192.168.2.184:62888/api/v1/system/userExists, request body:CheckUserExistsRequest(name=admin), params:null
2026-05-19 10:38:18.137 INFO 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.o.o.i.cluster.ClusterServiceImpl : obClusterId not given, generateObClusterId, obClusterId=1762681003
2026-05-19 10:38:18.154 INFO 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.o.o.i.c.ClusterGroupServiceImpl : create cluster group, name=ocp, description=ocp, create by cluster service, affectedRows=1
2026-05-19 10:38:18.247 INFO 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.o.c.s.o.OrganizationResourceManager : add resource for current organization,organizationId=10000000,resourceType=4000023, resourceId=4000023
2026-05-19 10:38:18.264 WARN 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1062, SQLState: 23000
2026-05-19 10:38:18.264 ERROR 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] o.h.engine.jdbc.spi.SqlExceptionHelper : (conn=3219246) Duplicate entry '192.168.2.184-2882' for key 'uk_ob_server_ip_port'
2026-05-19 10:38:18.278 INFO 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.ocp.service.audit.AuditEventService : begin create audit event, param:CreateAuditEventParam(operationEvent=CREATE_OB_CLUSTER, eventType=OB_CLUSTER_MANAGEMENT, methodSignature=com.oceanbase.ocp.server.common.controller.ObClusterController.createObCluster, resourceType=OB_CLUSTER, resources=[CreateAuditEventParam.AuditResourceParam(resourceId=null, resourceName=ocp, parentResource=null)], operatorId=100, operatorName=admin, status=FAILED, failedReason={"errorCode":"COM10015","errorMessage":"could not execute statement; SQL [n/a]; constraint [uk_ob_server_ip_port]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"}, taskId=null, eventInfo={"body":{"attributes":{"DataDiskPath":"/data/1","InstallPath":"/home/admin/oceanbase","LogDiskPath":"/data/log1","SqlPort":2881,"SvrPort":2882},"cgroupEnabled":true,"createExtraTenant":false,"dataDiskPath":"/data/1","fullVersion":"4.2.5.5-105020012025081414","installPath":"/home/admin/oceanbase","loadType":"HTAP","logDiskPath":"/data/log1","name":"ocp","obproxyUserName":"proxyro","password":"******","primaryClusterInfo":{},"saveToCredential":true,"startupParameters":[{"name":"enable_record_trace_log","value":"false"},{"name":"enable_syslog_recycle","value":"1"},{"name":"large_query_threshold","value":"600s"},{"name":"max_syslog_file_count","value":"300"}],"supportObsBackup":false,"type":"PRIMARY","zones":[{"architecture":"x86_64","idcName":"idc","name":"zone1","rootServer":2000001,"rpmName":"oceanbase-4.2.5.5-105020012025081414.el7.x86_64.rpm","servers":[2000001]}]}}, executionType=NEW, requestUrl=http://192.168.2.183:8080/api/v2/ob/clusters, clientIp=192.168.2.3, serverIp=192.168.2.183, startTime=2026-05-19T10:38:17.823+08:00, endTime=2026-05-19T10:38:18.276+08:00, role=null, aliUid=null)
2026-05-19 10:38:18.321 INFO 8 --- [ocp-schedules-28,21c7fc1aba5c10bd,36b4f24128e1c647] .o.o.s.t.b.c.AbstractShardingClusterTask : Check all standby clusters sync delay time executed completed, allCount=5, successCount=5
2026-05-19 10:38:18.349 ERROR 8 --- [http-nio-0.0.0.0-8080-exec-6,ad38d69221df98b2,6647b195020b1337] c.o.o.s.c.trace.RequestTracingAspect : Unexpected API Error: [POST /api/v2/ob/clusters client=192.168.2.3, traceId=ad38d69221df98b2, args=CreateObClusterParam(name=ocp, vpcName=null, vpcId=1, obClusterId=null, fullVersion=4.2.5.5-105020012025081414, packageOperatingSystem=null, rpmName=null, type=PRIMARY, password=xxx saveToCredential=true, primaryZone=null, zones=[ObZoneParam(name=zone1, idcName=idc, servers=[2000001], architecture=x86_64, rpmName=oceanbase-4.2.5.5-105020012025081414.el7.x86_64.rpm, rootServer=2000001)], startupParameters=[ObParameterParam(name=enable_record_trace_log, value=false), ObParameterParam(name=enable_syslog_recycle, value=1), ObParameterParam(name=large_query_threshold, value=600s), ObParameterParam(name=max_syslog_file_count, value=300)], obproxyClusterIds=null, obproxyClusterKeyList=null, obproxyUserName=proxyro, obproxyUserpassword=xxx attributes=ClusterAttributes(installPath=/home/admin/oceanbase, runPath=/home/admin/oceanbase, dataDiskPath=/data/1, logDiskPath=/data/log1, diskPathStyle=null, operatingSystemUser=admin, sqlPort=2881, svrPort=2882), installPath=/home/admin/oceanbase, dataDiskPath=/data/1, logDiskPath=/data/log1, primaryClusterInfo=PrimaryClusterInfo(rootSyspassword=xxx obClusterId=null, vpcId=null, vpcName=null, fullVersion=null, rootserverJson=null), arbitrationServiceId=null, timeZone=null, clientToken=null, oversellingFactor=null, cgroupEnabled=true, createExtraTenant=false, supportObsBackup=false, simplifiedCreateTenantParam=null, loadType=HTAP),, duration=534 ms]
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [uk_ob_server_ip_port]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:276)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:243)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
要在 192.168.2.184:2882 上新建名为 ocp 的集群,但 OCP 元库里 已经存在 该 ip+port (192.168.2.184-2882) 的 OB Server 记录,插入第二条被拒绝。先查 ob_server 表和主机上是否已有 observer,再决定删旧集群、换主机或改端口。
或者在OCP上看下,主机 2000001(192.168.2.184) 是否已关联其它 OB 集群 / 是否显示已有 observer
mysql -hxx.xx.xx.xx -P2883 -uroot@ocp_meta -pxxxx__ -Ac meta_database
-- 查冲突的 server 记录
SELECT s.id, s.ip, s.port, s.sql_port, s.status, s.cluster_id,
c.name AS cluster_name, c.status AS cluster_status
FROM ob_server s
LEFT JOIN ob_cluster c ON s.cluster_id = c.id
WHERE s.ip = '192.168.2.184' AND s.port = 2882;
-- 看该主机在 OCP 里还挂了哪些 server
SELECT s.*, c.name, c.status
FROM ob_server s
JOIN ob_cluster c ON s.cluster_id = c.id
WHERE s.host_id = 2000001;