postgresql无法正常启动的原因追查

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了postgresql无法正常启动的原因追查相关的知识,希望对你有一定的参考价值。

参考技术A 仔细分析,无非几个原因:

1、log目录的权限问题,比如log文件指定的目录postgres用户无权写入,因此没有产生任何log文件。检查了/var/lib/postgresql/11/main的目录,没有发现问题。
2、配置文件的权限问题,检查了/etc/postgresql/11/main目录,也没有发现任何问题,postgres用户是有权限读取配置文件的。

3、配置文件有错误导致无法正常启动postgresql。排除了上面的两个原因,这个应该是最大的原因了。但是,错误在哪里呢?没有给出提示啊!

 尝试了service postgresql start, pg_ctrcluster, pg_ctl均无法给出任何提示,后来才想明白,这几个都是对postmaster的脚本封装啊,也许这些封装忽略了什么重要的信息!应该直接运行postmaster才能得到直接的出错提示的!果然,执行/usr/lib/postgresql/11/bin/下的postmaster给出了提示,执行语句:

 看到这里立刻明白了:我将postgresql.conf中的lc_messages改为了 en_US.UTF-8,可是没有产生en_US.UTF-8的locale文件啊!于是修改/etc/locales.gen文件添加en_US.UTF-8,执行locales.gen,再次启动postgresql,成功!

tomcat无法正常启动的一个原因

 简要报错信息:

java.lang.IllegalArgumentException: Document base E:\\apache-tomcat-7.0.65\\webapps\\springmvc01 does not exist or is not a readable directory

 如果遇到这种莫名其妙的问题,根据报错信息可以看到应该是当前的tomcat某个配置文件里有springmvc01这个工程项目的信息,我们一个一个地来排查,发现是

E:\\tomcat\\apache-tomcat-7.0.65_nm\\conf\\server.xml中多了

这行配置信息,我们只要把这段信息删除,然后重启tomcat就能够重新启动。

报错截图:

具体的报错信息:

2016-12-3 20:32:57 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property \'source\' to \'org.eclipse.jst.jee.server:springmvc01\' did not find a matching property.
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/7.0.65
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Oct 9 2015 08:36:58 UTC
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 7.0.65.0
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows Vista
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 6.2
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\\Users\\Wei\\MyEclipse\\Common\\binary\\com.sun.java.jdk.win32.x86_64_1.6.0.013\\jre
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.6.0_13-b03
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Sun Microsystems Inc.
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: E:\\tomcat\\apache-tomcat-7.0.65_nm
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: E:\\tomcat\\apache-tomcat-7.0.65_nm
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:58693
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=E:\\tomcat\\apache-tomcat-7.0.65_nm
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=E:\\tomcat\\apache-tomcat-7.0.65_nm
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=E:\\tomcat\\apache-tomcat-7.0.65_nm/common/endorsed
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=E:\\tomcat\\apache-tomcat-7.0.65_nm\\temp
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.library.path=C:\\Users\\Wei\\MyEclipse\\Common\\binary\\com.sun.java.jdk.win32.x86_64_1.6.0.013\\bin;E:\\tomcat\\apache-tomcat-7.0.65_nm\\bin
2016-12-3 20:32:57 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dsun.io.useCanonCaches=false
2016-12-3 20:32:57 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
2016-12-3 20:32:57 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2016-12-3 20:32:58 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.1m 19 Mar 2015)
2016-12-3 20:32:58 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
2016-12-3 20:32:58 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
2016-12-3 20:32:58 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2221 ms
2016-12-3 20:32:58 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2016-12-3 20:32:58 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.65
2016-12-3 20:32:58 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base E:\\apache-tomcat-7.0.65\\webapps\\springmvc01 does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:136)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5132)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5319)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
2016-12-3 20:32:58 org.apache.catalina.core.ContainerBase startInternal
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/springmvc01]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1122)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/springmvc01]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Error in resourceStart()
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
2016-12-3 20:32:58 org.apache.catalina.core.ContainerBase startInternal
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1122)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1130)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
2016-12-3 20:32:58 org.apache.catalina.startup.Catalina start
严重: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1130)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
2016-12-3 20:32:58 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["http-apr-8080"]
2016-12-3 20:32:58 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["ajp-apr-8009"]
2016-12-3 20:32:58 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service Catalina
2016-12-3 20:32:58 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["http-apr-8080"]
2016-12-3 20:32:58 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["ajp-apr-8009"]

 

 解决的具体截图:

 

以上是关于postgresql无法正常启动的原因追查的主要内容,如果未能解决你的问题,请参考以下文章

Docker日志查看

使用postgresql数据库时uwsgi下的django应用程序无法启动

无法从 EC2 连接到 PostgreSQL RDS 但从 localhost 可以正常工作

tomcat无法正常启动的一个原因

追查Spring“不符合自动代理条件”的原因

确定 Cordova 无法在 iOs 9 中启动但在 iOs 10 中正常工作的原因