How to setup service for PostgreSql server?
Hi all.
I'm newbie in Freebsd so forgive me if I ask on something obvious. I
install FreeBsd 6.1 (with PostgreSql), instalation create user for
PostgreSql. I start server something like that:
postmaster -D /usr/local/pgsql/data
and everything goes well. But after restart PosgreSql doesn't respond
and I must start it again. How can I configure PostgreSql to be a demon
and what and where I have to modify to start PostgreSql when my Server
starts?
Gregor
Thank for any
help
Re: How to setup service for PostgreSql server?
GvaderTh wrote:[color=blue]
> Hi all.
> I'm newbie in Freebsd so forgive me if I ask on something obvious. I
> install FreeBsd 6.1 (with PostgreSql), instalation create user for
> PostgreSql. I start server something like that:
> postmaster -D /usr/local/pgsql/data
> and everything goes well. But after restart PosgreSql doesn't respond
> and I must start it again. How can I configure PostgreSql to be a demon
> and what and where I have to modify to start PostgreSql when my Server
> starts?[/color]
I believe what you are missing is the rc.conf line to automatically start
the database on system startup. If everything else is configured correctly
then this is the only thing you need.
Add the following line to the end of your /etc/rc.conf file!
postgresql_enable="YES"
I remember I also had to learn this when I started to use PostgreSQL on
FreeBSD some years ago.
If you build postgresql from ports, then you will have a message at the
end of the build process which reminds you to this rc.conf line. But if
you did not pay attention to the messages at the end of the compilation,
or even better if you installed postgres from a package then you will not
know about it. So it is easy to miss, until you learn about it! :-)
I remember I had to read quite a lot to finally find that I need this, and
I broke out laughing the first time when I noticed the reminder at the end
of the source building.
Good luck!
Keve
--
if you need to reply directly:
keve(at)mail(dot)poliod(dot)hu
Re: How to setup service for PostgreSql server?
Keve Nagy wrote:
[color=blue]
> Add the following line to the end of your /etc/rc.conf file!
> postgresql_enable="YES"[/color]
It was so trivial to me that I forgot to mention that it only will
automatically start your database upon your next system restart and on
every system start after that. So when you add this line to rc.conf, you
will still need to manually start the server, for that last one time. :-)
Regards,
Keve
--
if you need to reply directly:
keve(at)mail(dot)poliod(dot)hu
Re: How to setup service for PostgreSql server?
Thanks for the tip but unfortunatelly I had that line in /etc/rc.conf
file. Now /etc/rc.conf looks like this:
postgresql_enable="YES"
postgresql_data="/usr/local/pgsql/data/"
but still after reboot PosgreSql is not running!
I find that I have script called postgres in
/usr/local/etc/rc.d/
when I executed after reboot server (PostgreSql is not running)
$ /usr/local/etc/rc.d/postgresql start - I get
The program "postmaster" was found by "/usr/local/bin/pg_ctl"
but was not the same version as pg_ctl.
Check your installation.
What I have to do?
Keve Nagy napisał(a):[color=blue]
> Keve Nagy wrote:
>[color=green]
>> Add the following line to the end of your /etc/rc.conf file!
>> postgresql_enable="YES"[/color]
>
> It was so trivial to me that I forgot to mention that it only will
> automatically start your database upon your next system restart and on
> every system start after that. So when you add this line to rc.conf, you
> will still need to manually start the server, for that last one time. :-)
>
> Regards,
> Keve
>[/color]
Re: How to setup service for PostgreSql server?
GvaderTh wrote:
[color=blue]
> Thanks for the tip but unfortunatelly I had that line in /etc/rc.conf
> file. Now /etc/rc.conf looks like this:
> postgresql_enable="YES"
> postgresql_data="/usr/local/pgsql/data/"
> but still after reboot PosgreSql is not running!
>
> I find that I have script called postgres in
> /usr/local/etc/rc.d/[/color]
Actually, the rc script in /usr/local/etc/rc.d/ is run at boot time thanks
to the /etc/rc.conf entry. It can also be used to start|stop|restart
postgresql manually.
[color=blue]
> $ /usr/local/etc/rc.d/postgresql start - I get
> The program "postmaster" was found by "/usr/local/bin/pg_ctl"
> but was not the same version as pg_ctl.
> Check your installation.
> What I have to do?[/color]
You have to do what you have been told in cited error message -- check your
installation. Type:
#pkg_info |grep postregsql
and see if there is any version mismatch like, e.g. postgresql-server-7.4.14
with postgresql-client-7.3.16[1]. Upgrade whichever port requires upgrading
and carefully read instructions.
[1] Just guessing. I don't use PostgreSQL so I dunno which ports are
required to run it.
PS. Please do not top-post.
PPS. Please do not cross-post.
--
Cezary Morga
Re: How to setup service for PostgreSql server?
Cezary Morga wrote:
[color=blue]
> GvaderTh wrote:
>[color=green]
>> Thanks for the tip but unfortunatelly I had that line in /etc/rc.conf
>> file. Now /etc/rc.conf looks like this:
>> postgresql_enable="YES"
>> postgresql_data="/usr/local/pgsql/data/"
>> but still after reboot PosgreSql is not running!
>>
>> I find that I have script called postgres in
>> /usr/local/etc/rc.d/[/color]
>
> Actually, the rc script in /usr/local/etc/rc.d/ is run at boot time thanks
> to the /etc/rc.conf entry. It can also be used to start|stop|restart
> postgresql manually.
>[/color]
The automatic start at boot relies on the /ports/sysutils/rc_subr port. More
than likely you already have it as it should have installed as a
dependency.
[snip]
-Jason