解读-Ambari3.0.0重启失败问题
在大多数情况下,如果服务启动顺利,日志输出到如下阶段,基本意味着 Ambari 系统已经完成初始化:
但在 Rocky 8.10 环境下重启 Ambari 3.0.0 时,实际遇到了 “服务始终无法启动,页面无法访问” 的典型异常:
提示
遇到服务假死时,首要手段就是日志排查!需要结合系统输出,定位实际卡死点。
# 日志体系与初步排查
首先,所有相关日志文件集中在 /var/log/ambari-server
目录:
-rw-r--r-- 1 root root 0 Jun 14 14:17 ambari-alerts.log
-rw-r--r-- 1 root root 0 Jun 14 14:17 ambari-audit.log
-rw-r--r-- 1 root root 0 Jun 14 14:17 ambari-config-changes.log
-rw-r--r-- 1 root root 0 Jun 14 14:17 ambari-eclipselink.log
-rw-r--r-- 1 root root 0 Jun 14 14:17 ambari-server-check-database.log
-rw-r--r-- 1 root root 16436 Jun 14 23:14 ambari-server-command.log
-rw-r--r-- 1 root root 0 Jun 14 14:17 ambari-server.log
-rw-r--r-- 1 root root 1204174 Jun 14 23:13 ambari-server.out
[root@hadoop1 ambari-server]# pwd
/var/log/ambari-server
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
很明显,ambari-server.out
文件有大量输出,是分析重点。
查看关键日志,发现服务一直卡在如下阶段,迟迟没有后续动作:
23:13:10.870 [main] INFO org.apache.ambari.server.orm.dao.HostRoleCommandDAO -- Host role command status summary cache enabled !
23:13:10.874 [main] INFO org.apache.ambari.annotations.TransactionalLock$LockArea -- LockArea HRC_STATUS_CACHE is enabled
23:13:10.945 [main] INFO org.apache.ambari.server.configuration.AmbariServerConfigurationProvider -- Registered org.apache.ambari.server.ldap.service.AmbariLdapConfigurationProvider in event publisher
log4j:WARN No such property [fileNamePattern] in org.apache.log4j.RollingFileAppender.
23:13:11.165 [main] INFO org.apache.ambari.server.logging.LockFactory -- Lock profiling is disabled
23:13:11.170 [main] INFO org.apache.ambari.server.controller.AmbariServer -- Getting the controller
23:13:11.170 [main] DEBUG org.apache.ambari.server.controller.AmbariServer -- Proxy authentication not specified
23:13:11.665 [main] WARN eclipselink -- [EL Warning]: 2025-06-14 23:13:11.66--ServerSession(1136705850)-- You have specified multiple ids for the entity class [org.apache.ambari.server.orm.entities.KerberosKeytabServiceMappingEntity] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use EntityManager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.
23:13:11.703 [main] WARN eclipselink -- [EL Warning]: 2025-06-14 23:13:11.703--ServerSession(1136705850)-- The reference column name [resource_type_id] mapped on the element [field permissions] does not correspond to a valid id or basic field/column on the mapping reference. Will use referenced column name as provided.
23:13:11.938 [main] INFO org.apache.ambari.server.checks.DatabaseConsistencyCheckHelper -- Checking DB store version
23:13:11.938 [pool-2-thread-1] INFO org.apache.ambari.server.configuration.AmbariServerConfigurationProvider -- JPA initialized event received: JpaInitializedEvent{eventType=JPA_INITIALIZED}
23:13:11.938 [pool-2-thread-1] INFO org.apache.ambari.server.configuration.AmbariServerConfigurationProvider -- Loading ldap-configuration configuration data
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
此时线程再无输出,Ambari 启动流程就此阻塞。
注意
注意!遇到长时间卡在初始化配置阶段,很大概率是阻塞或死循环,尤其涉及 LDAP、数据库连接、配置加载等流程。
# 关键类排查与日志锚点注入
结合日志和实际经验,聚焦到 AmbariServerConfigurationProvider
相关类,怀疑卡死点可能出现在 LDAP 配置加载。
此时最佳实践是插入定向日志锚点,精准溯源。
你可以参考 源代码改造—追加日志锚点 实用跳转 ,获得更细致的操作步骤和具体代码片段。
提示
日志锚点法不仅适合定位启动卡死,对于各种疑难大体量服务都非常有效。建议实际排查过程中配合多点锚桩、定向输出组合使用,效率极高。
# 重新编译与产物替换
完成日志锚点插桩后,直接在 IDEA 里执行下述命令进行快速构建:
mvn install -Drat.skip=true \
-Dmaven.test.skip=true \
-Dcheckstyle.skip=true \
-Dspotbugs.skip=true
1
2
3
4
2
3
4
编译成功后产物如下,确认输出 jar 包无误:
将新 jar 包拷贝到 /usr/lib/ambari-server
,覆盖原有实现(操作建议见下图):
警告
⚠️ 核心 jar 包替换务必提前备份!避免新包不兼容或后续验证需要回退。
# 服务重启与验证
替换完毕后,使用如下命令重启服务:
ambari-server restart
1
- 01
- bigtop-select 打包缺 compat 报错修复 deb07-16
- 02
- bigtop-select 打包缺 control 文件报错修复 deb07-16
- 03
- 首次编译-环境初始化 必装07-16