今天又遇到vsphere无法登入 vcenter服务器,报503的问题,原以为又是磁盘空间满的问题(解决vcenter服务无法启动问题(磁盘空间满)),按照以往的经验,处理好就可以恢复vcenter的正常进入了,那知今天不一样。

第一个问题
按照先前步骤进行处理,但在重启vcenter进入单用户模式时,报/dev/sda3/磁盘错误,将只能使用read only模式,推荐手动运行fsck 命令修复。
在只读模式下面,无法删除占满磁盘的日志文件,所以执行了: fsck -y /dev/sda3进行修复,完成后再重启vcenter到单用户模式,就可以处理删除日志文件了。

第二个问题
原以为上面处理好后,就可以恢复vcenter,那知依然报错。
使用ssh登录进vcenter,准备查看一下vcenter的服务是否正常运行,但第一步进入shell模式就失败了,shell命令返回 Shell is disabled ,网上找到解决方法:shell.set --enabled true 开启shell(参考vcenter 6.0用vsphere client登录不上显示503,服务起不来可以ping通,进不了shell模式,日志文件过大的解决方案)

第三个问题
参考文章:技术人生系列——vCenter重启大法不香了? 和这篇文件写的问题基本一样,下面是该文章的重点摘抄:

进入shell后,发现vmware-eam的服务未启动,尝试启动失败,检查相关日志,通过查看var/log/vmware/eam/wrapper.log,发现在系统启动中存在报错信息:Could
not resolve placeholder 'eam.hostd_restart_timeout
’。

INFO | jvm 1| 2015/02/24 07:55:45 | WrapperSimpleApp Error: Encountered an error running main:
INFO | jvm 1| 2015/02/24 07:55:45 | WrapperSimpleApp Error: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'esxAgentMgr' defined in class path resource [eam-server-beans.xml]: Could not resolve placeholder 'eam.hostd_restart_timeout'
INFO | jvm 1| 2015/02/24 07:55:45 | WrapperSimpleApp Error: at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties (PropertyPlaceholderConfigurer.java:268)
INFO | jvm 1| 2015/02/24 07:55:45 | WrapperSimpleApp Error: at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory (PropertyResourceConfigurer.java:75)

检查eam配置文件 /etc/vmware-eam/eam.properties,配置文件为空,配置文件丢失了,需要恢复:
(1)确认系统ID :cat /etc/vmware/install-defaults/sca.hostid。 The output
should be a string like : 0a12dfe2-b3b7-4eb6-9737-1ec5a8e770ec

(2)确认系统名称hostname -f。

编辑 /etc/vmware-eam/eam.properties配置文件,修改如下标红位置,主要修改主机名,hostdid和
vCenter IP。

vc.proxy.host=localhost
vc.proxy.port=80
eam.host=
eam.int.http.port=15005
eam.ext.port=443
eam.ext.scheme=https
eam.ext.port.deprecated=80
eam.ext.scheme.deprecated=http
eam.support_linked_clone=true
eam.clear_db_on_startup=false
eam.debug_ref_count=false
eam.recent_event_size=20
vum.integration=true
eam.scan_for_unknown_agent_vms=1440
eam.resourcebundle.filename=eam-resourcebundle.jar
tcserver.tmp.dir=/var/tmp/vmware/eam/tomcat
eam.web.root=/usr/lib/vmware-eam/web
eam.keystore.type=VKS
eam.key.alias=vpxd-extension
eam.keystore.storename=vpxd-extension

cm.url=http://localhost:18090/cm/sdk/?hostid=0a12dfe2-b3b7-4eb6-9737-1ec5a8e770ec
cm.wait.attempts=360
cm.wait.intervalSeconds=5
sso.wait.attempts=360
sso.wait.intervalSeconds=5
vc.truststore.type=VKS
vc.truststore.storename=TRUSTED_ROOTS
vc.tunnelSdkUri.template=https://##{VC_HOST_NAME}##:8089/sdk/vimService #<====== Keep this unchanged
vc.tunnelSdkUri=https://<192.168.1.202>:8089/sdk/vimService #<====== Change this to your vCenter FQDN/IP
drs.demandCapacityRatio=100

(3)修改配置文件权限为0644:chmod 0644 eam.properties。
(4)重启eam服务:service-control --start vmware-eam,eam服务启动成功。

不同是按照他的步骤处理好后,还是启动vmware-eam服务失败,一样的错误。

后来找到一个网友提问:VMware Inventory Service dont start - vCenter v6.0 u3

中提到vmware知识库:WARNING: VMware ESX Agent Manager may have failed to start", EAM Service fails to start after vCenter Server reboot (2148582)

在上面下载了脚本文件:Recreate_eam.properties.sh 这个脚本,可以帮助我们自动生成/etc/vmware-eam/eam.properties配置文件。

生成好后,重启重启eam服务:service-control --start vmware-eam 成功了。

总结:
其实这个问题还是因为vcenter磁盘空间占满引起的,在磁盘空间占满后,系统无法生成eam.properties配置文件,导致其丢失,所以最好还是备份一下