开发者

mysql日期和时间的间隔计算实例分析

安装环境:

centos6.6-minimal

安装一切都比较顺利,在启动服务时启动失败,检查报错日志如下:

[root@ambariserver yum.repos.d]# ambari-server start

Using python  /usr/bin/python2.6

Starting ambari-server

WARNING: The hostname was not found in the reverse DNS lookup. This may result in incorrect behavior. Please check the DNS setup and fix the issue.

Ambari Server running with administrator privileges.

Running initdb: This may take upto a minute.

About to start PostgreSQL

Organizing resource files at /var/lib/ambari-server/resources...

Server PID at: /var/run/ambari-server/ambari-server.pid

Server out at: /var/log/ambari-server/ambari-server.out

Server log at: /var/log/ambari-server/ambari-server.log

Waiting for server start.........

ERROR: Exiting with exit code -1.

REASON: Ambari Server java process died with exitcode 1. Check /var/log/ambari-server/ambari-server.out for more information.

[root@ambariserver yum.repos.d]# tail -f -n200 /var/log/ambari-server/ambari-server.out

Exception in thread "main" com.google.inject.CreationException: Guice creation errors:

1) Error injecting constructor, java.net.UnknownHostException: ambariserver: ambariserver: 未知的名称或服务

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher.(SNMPDispatcher.java:92)

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher.class(SNMPDispatcher.java:63)

while locating org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher

at org.apache.ambari.server.notifications.DispatchFactory.(DispatchFactory.java:47)

at org.apache.ambari.server.notifications.DispatchFactory.class(DispatchFactory.java:40)

while locating org.apache.ambari.server.notifications.DispatchFactory

for field at org.apache.ambari.server.controller.internal.AlertTargetResourceProvider.dispatchFactory(AlertTargetResourceProvider.java:64)

Caused by: java.net.UnknownHostException: ambariserver: ambariserver: 未知的名称或服务

at java.net.InetAddress.getLocalHost(InetAddress.java:1473)

at org.snmp4j.transport.DefaultUdpTransportMapping.(DefaultUdpTransportMapping.java:61)

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher.(SNMPDispatcher.java:92)

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher$$FastClassByGuice$$3665b322.newInstance()

at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)

at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)

at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)

at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)

at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

at com.google.inject.Scopes$1$1.get(Scopes.java:65)

at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)

at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)

at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)

at org.apache.ambari.server.notifications.DispatchFactory.(DispatchFactory.java:49)

at org.apache.ambari.server.notifications.DispatchFactory$$FastClassByGuice$$6097a8d5.newInstance()

at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)

at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)

at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)

at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)

at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

at com.google.inject.Scopes$1$1.get(Scopes.java:65)

at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)

at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:116)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:110)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)

at com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor.java:110)

at com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:78)

at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:170)

at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)

at com.google.inject.Guice.createInjector(Guice.java:95)

at com.google.inject.Guice.createInjector(Guice.java:72)

at com.google.inject.Guice.createInjector(Guice.java:62)

at org.apache.ambari.server.controller.AmbariServer.main(AmbariServer.java:651)

Caused by: java.net.UnknownHostException: ambariserver: 未知的名称或服务

at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)

at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)

at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)

at java.net.InetAddress.getLocalHost(InetAddress.java:1469)

... 39 more

2) Error injecting constructor, java.net.UnknownHostException: ambariserver: ambariserver: 未知的名称或服务

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher.(SNMPDispatcher.java:92)

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher.class(SNMPDispatcher.java:63)

while locating org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher

at org.apache.ambari.server.notifications.DispatchFactory.(DispatchFactory.java:47)

at org.apache.ambari.server.notifications.DispatchFactory.class(DispatchFactory.java:40)

while locating org.apache.ambari.server.notifications.DispatchFactory

for field at org.apache.ambari.server.state.services.AlertNoticeDispatchService.m_dispatchFactory(AlertNoticeDispatchService.java:101)

at org.apache.ambari.server.controller.ControllerModule.bindByAnnotation(ControllerModule.java:478)

Caused by: java.net.UnknownHostException: ambariserver: ambariserver: 未知的名称或服务

at java.net.InetAddress.getLocalHost(InetAddress.java:1473)

at org.snmp4j.transport.DefaultUdpTransportMapping.(DefaultUdpTransportMapping.java:61)

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher.(SNMPDispatcher.java:92)

at org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher$$FastClassByGuice$$3665b322.newInstance()

at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)

at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)

at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)

at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)

at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

at com.google.inject.Scopes$1$1.get(Scopes.java:65)

at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)

at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)

at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)

at org.apache.ambari.server.notifications.DispatchFactory.(DispatchFactory.java:49)

at org.apache.ambari.server.notifications.DispatchFactory$$FastClassByGuice$$6097a8d5.newInstance()

at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)

at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)

at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)

at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)

at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

at com.google.inject.Scopes$1$1.get(Scopes.java:65)

at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)

at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53)

at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)

at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:75)

at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73)

at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)

at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:73)

at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:147)

at com.google.inject.internal.Initializer.injectAll(Initializer.java:92)

at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:173)

at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)

at com.google.inject.Guice.createInjector(Guice.java:95)

at com.google.inject.Guice.createInjector(Guice.java:72)

at com.google.inject.Guice.createInjector(Guice.java:62)

at org.apache.ambari.server.controller.AmbariServer.main(AmbariServer.java:651)

Caused by: java.net.UnknownHostException: ambariserver: 未知的名称或服务

at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)

at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)

at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)

at java.net.InetAddress.getLocalHost(InetAddress.java:1469)

... 41 more

2 errors

at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)

at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:175)

at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)

at com.google.inject.Guice.createInjector(Guice.java:95)

at com.google.inject.Guice.createInjector(Guice.java:72)

at com.google.inject.Guice.createInjector(Guice.java:62)

at org.apache.ambari.server.controller.AmbariServer.main(AmbariServer.java:651)

解决办法:

解决办法:hosts文件中添加地址和ip的映射

vim /etc/hosts

[root@ambariserver yum.repos.d]# vim /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.199.110   ambariserver

192.168.199.214  ambariagent

保存 再次启动

mysql日期和时间的间隔计算实例分析

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新数据库

数据库排行榜