As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
My Postgresql does not start. Help me my command was as below
[root@erms /]# /d02/postgresql/scripts/ctl.sh startwaiting for server to start.... stopped waitingpg_ctl.bin: could not start serverExamine the log output./d02/postgresql/scripts/ctl.sh : postgresql could not be started[root@erms /]#
#!/bin/sh HOSTNAME=`hostname` POSTGRESQL_PIDFILE=/d02/alf_data/postgresql/postmaster.pid POSTGRESQL_START="/d02/postgresql/bin/pg_ctl start -w -D /d02/alf_data/postgresql" POSTGRESQL_STOP="/d02/postgresql/bin/pg_ctl stop -D /d02/alf_data/postgresql" PGPORT=5430 POSTGRESQL_STATUS="" POSTGRESQL_PID="" PID="" ERROR=0 get_pid() { PID="" PIDFILE=$1 # check for pidfile if [ -f "$PIDFILE" ] ; then PID=`head -1 $PIDFILE` fi } get_postgresql_pid() { get_pid $POSTGRESQL_PIDFILE if [ ! "$PID" ]; then return fi if [ "$PID" -gt 0 ]; then POSTGRESQL_PID=$PID fi } is_service_running() { PID=$1 if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then RUNNING=1 else RUNNING=0 fi return $RUNNING } is_postgresql_running() { get_postgresql_pid is_service_running $POSTGRESQL_PID RUNNING=$? if [ $RUNNING -eq 0 ]; then POSTGRESQL_STATUS="postgresql not running" else POSTGRESQL_STATUS="postgresql already running" fi return $RUNNING } start_postgresql() { is_postgresql_running RUNNING=$? if [ $RUNNING -eq 1 ]; then echo "$0 $ARG: postgresql (pid $POSTGRESQL_PID) already running" exit fi if [ `id|sed -e s/uid=//g -e s/\(.*//g` -eq 0 ]; then su postgres -c "$POSTGRESQL_START" else $POSTGRESQL_START fi sleep 3 is_postgresql_running RUNNING=$? if [ $RUNNING -eq 0 ]; then ERROR=1 fi if [ $ERROR -eq 0 ]; then echo "$0 $ARG: postgresql started at port 5430" sleep 2 else echo "$0 $ARG: postgresql could not be started" ERROR=3 fi } stop_postgresql() { NO_EXIT_ON_ERROR=$1 is_postgresql_running RUNNING=$? if [ $RUNNING -eq 0 ]; then echo "$0 $ARG: $POSTGRESQL_STATUS" if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then exit else return fi fi if [ `id|sed -e s/uid=//g -e s/\(.*//g` -eq 0 ]; then su postgres -c "$POSTGRESQL_STOP" else $POSTGRESQL_STOP fi sleep 5 is_postgresql_running RUNNING=$? if [ $RUNNING -eq 0 ]; then echo "$0 $ARG: postgresql stopped" else echo "$0 $ARG: postgresql could not be stopped. Trying to perform a \"fast\" shutdown." if [ `id|sed -e s/uid=//g -e s/\(.*//g` -eq 0 ]; then su postgres -c "$POSTGRESQL_STOP -m fast" else $POSTGRESQL_STOP -m fast fi sleep 5 is_postgresql_running RUNNING=$? if [ $RUNNING -eq 0 ]; then echo "$0 $ARG: postgresql stopped" else echo "$0 $ARG: postgresql could not be stopped." ERROR=4 fi fi } cleanpid() { rm -f $POSTGRESQL_PIDFILE } if [ "x$1" = "xstart" ]; then start_postgresql elif [ "x$1" = "xstop" ]; then stop_postgresql elif [ "x$1" = "xstatus" ]; then is_postgresql_running echo "$POSTGRESQL_STATUS" elif [ "x$1" = "xcleanpid" ]; then cleanpid fi exit $ERROR
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5430 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262)at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:52)at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:216)at org.postgresql.Driver.makeConnection(Driver.java:404)at org.postgresql.Driver.connect(Driver.java:272)at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)