Thread: Starting a cluster as a service

Starting a cluster as a service

From
Léa Massiot
Date:
Hello and thank you for reading my post.

My problem is that I do not manage to start a PostgreSQL cluster as a
Windows service.
The OS is WinXP.

- I've created a PostgreSQL cluster "a_pgcluster" with the associated port
5433.
- Running "cmd.exe" under Windows as "a_user", I can start and stop it
manually in command line using the following commands:

- The cluster data directory is "a_pgcluster". Its (filesystem) owner is
"a_user" with this user having "full control" on it.

- Now, I would like it to be run automatically at machine startup as a
service.
- So I registered the cluster using the following command:

- When I go to "Control Panel" -> Administrative Tools" -> "Services" and
try to start the service, I get the following message:

- I also tried the following commands in command-line:


Can you help me try to figure out what's wrong?
Best regards.
--
OS: WinXP Pro SP3
DBMS: PostgreSQL v.9.1

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Starting-a-cluster-as-a-service-tp5712728.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Starting a cluster as a service

From
Thomas Boussekey
Date:
Hello Léa,

Command line, message and commands are missing.
Difficult to help you!

Regards,
Thomas

2012/6/15 Léa Massiot <lmhelp1@orange.fr>
Hello and thank you for reading my post.

My problem is that I do not manage to start a PostgreSQL cluster as a
Windows service.
The OS is WinXP.

- I've created a PostgreSQL cluster "a_pgcluster" with the associated port
5433.
- Running "cmd.exe" under Windows as "a_user", I can start and stop it
manually in command line using the following commands:

- The cluster data directory is "a_pgcluster". Its (filesystem) owner is
"a_user" with this user having "full control" on it.

- Now, I would like it to be run automatically at machine startup as a
service.
- So I registered the cluster using the following command:

- When I go to "Control Panel" -> Administrative Tools" -> "Services" and
try to start the service, I get the following message:

- I also tried the following commands in command-line:


Can you help me try to figure out what's wrong?
Best regards.
--
OS: WinXP Pro SP3
DBMS: PostgreSQL v.9.1

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Starting-a-cluster-as-a-service-tp5712728.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: Starting a cluster as a service

From
Léa Massiot
Date:
Hello Thomas,
Contrary to what you say, I provided command lines and messages (in case of
failure).
What is missing according to you?
Thank you and best regards.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Starting-a-cluster-as-a-service-tp5712728p5713039.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Starting a cluster as a service

From
Léa Massiot
Date:
Hi again,

It looks like the problem comes from the "-l" option I'm trying to set when
I register the service.

1) If I register the cluster as a service in the following way:

It works: the service is automatically started properly.

2) If I add the following option:

and then try to start the service (via "Control Panel" -> "Administrative
Tools" -> "Services"), it fails with the message:


Is this not the right way to set the cluster log file?
Or maybe this should be set in the cluster "postgresql.conf" configuration
file instead?

Thanks for helping.
Best regards.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Starting-a-cluster-as-a-service-tp5712728p5713066.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Starting a cluster as a service

From
Alban Hertroys
Date:
On 18 June 2012 09:46, Léa Massiot <lmhelp1@orange.fr> wrote:
> Hello Thomas,
> Contrary to what you say, I provided command lines and messages (in case of
> failure).
> What is missing according to you?

The command lines. If you did indeed post them, they did not make it
to the list.

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

Re: Starting a cluster as a service

From
Léa Massiot
Date:
Sorry. I added some "< raw >" tags so maybe this is the reason why you
couldn't see half of my message.



Hi again,

It looks like the problem comes from the "-l" option I'm trying to set when
I register the service.

1) If I register the cluster as a service in the following way:

-------------------------------------------------------------------------------------------
dos ; a_user> pg_ctl.exe register -N a_pgcluster_srv -U a_user -P a_password
-D "a_pgcluster" -S auto -w -t 60
-------------------------------------------------------------------------------------------

It works: the service is automatically started properly.

2) If I add the following option:

-------------------------------------------------------------------------------------------
-o "-l '<path_to_the_cluster_log_file>/a_pgcluster.log'"
-------------------------------------------------------------------------------------------

and then try to start the service (via "Control Panel" -> "Administrative
Tools" -> "Services"), it fails with the message:

-------------------------------------------------------------------------------------------
"The a_pgcluster_srv service on Local Computer started and then stopped.
Some services stop automatically if they have no work to do, for example,
the Performance Logs and Alerts service."
-------------------------------------------------------------------------------------------


Is this not the right way to set the cluster log file?
Or maybe this should be set in the cluster "postgresql.conf" configuration
file instead?

Thanks for helping.
Best regards.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Starting-a-cluster-as-a-service-tp5712728p5713070.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Starting a cluster as a service

From
Léa Massiot
Date:
Hi again,

I'm running "PostgreSQL 9.1" under "Windows XP".
I'm still trying to set a proper logging system for a PostgreSQL cluster
"a_pg_cluster".

In the cluster "postgresql.conf" configuration file, I uncommented
"logging_connector = on".
When I stopped + started the service, I could see a "pg_log" directory had
been created with a log file inside.

Now, I would like:
1) to store the cluster log files somewhere else say, for example:
"C:\postgresql\logs\a_pg_cluster\"
2) to have several small log files instead of a big one and log rotation.

Yet, when I set the "log_directory" parameter in the following way:
"log_directory = 'C:\postgresql\logs\a_pg_cluster\'"
and stop + start the service, it fails with always the same unusable
message:
"The a_pgcluster_srv service on Local Computer started and then stopped.
Some services stop automatically if they have no work to do, for example,
the Performance Logs and Alerts service."

In the manual, one can read:
"When logging_collector is enabled, this parameter determines the directory
in which log files will be created. It can be specified as an absolute path,
or relative to the cluster data directory. This parameter can only be set in
the postgresql.conf file or on the server command line."

So, what's wrong with it?

I would be happy with the following configuration:

logging_collector = on
log_directory = "C:\postgresql\logs\a_pg_cluster\"
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_size = 10MB
log_min_messages = PANIC
log_error_verbosity = VERBOSE

except, it doesn't work... and I'm not sure about the levels "PANIC" and
"VERBOSE".

Can you help?

Thank you and best regards.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Starting-a-cluster-as-a-service-tp5712728p5713888.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: Starting a cluster as a service

From
Raghavendra
Date:

On Fri, Jun 22, 2012 at 5:36 PM, Léa Massiot <lmhelp1@orange.fr> wrote:
Hi again,

I'm running "PostgreSQL 9.1" under "Windows XP".
I'm still trying to set a proper logging system for a PostgreSQL cluster
"a_pg_cluster".

In the cluster "postgresql.conf" configuration file, I uncommented
"logging_connector = on".
When I stopped + started the service, I could see a "pg_log" directory had
been created with a log file inside.

Now, I would like:
1) to store the cluster log files somewhere else say, for example:
"C:\postgresql\logs\a_pg_cluster\"
2) to have several small log files instead of a big one and log rotation.

Yet, when I set the "log_directory" parameter in the following way:
"log_directory = 'C:\postgresql\logs\a_pg_cluster\'" 
and stop + start the service, it fails with always the same unusable
message:
"The a_pgcluster_srv service on Local Computer started and then stopped.
Some services stop automatically if they have no work to do, for example,
the Performance Logs and Alerts service."

In the manual, one can read:
"When logging_collector is enabled, this parameter determines the directory
in which log files will be created. It can be specified as an absolute path,
or relative to the cluster data directory. This parameter can only be set in
the postgresql.conf file or on the server command line."

So, what's wrong with it?

I would be happy with the following configuration:

logging_collector = on
log_directory = "C:\postgresql\logs\a_pg_cluster\"
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_size = 10MB
log_min_messages = PANIC
log_error_verbosity = VERBOSE

except, it doesn't work... and I'm not sure about the levels "PANIC" and
"VERBOSE".

Can you help?

Here two thing's, One you should have full access on the directory for Postgres User. 
Second, you need to give directory name as below.
 
log_directory = 'C:\\postgresql\\logs\\a_pg_cluster'


---
Regards,
Raghavendra
EnterpriseDB Corporation

Re: Starting a cluster as a service

From
Léa Massiot
Date:
Hello Raghavendra,
Sorry for the late answer, I couldn't test this properly before.
That indeed solves the problem.
Thank you and best regards.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Starting-a-cluster-as-a-service-tp5712728p5714759.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.