Обсуждение: starting postgres on red hat
I installed Red Hat 5.2 EL. During the install I select postgresql and this versoin was installed: postgresql-8.1.11-1.el5_1.1. 1. I started postgresql as follows: initdb -D /var/lib/pgsql/data 2. I started the database server as follows: /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start 3. I started the postmaster as follows: service postgresql start When I check that it is all running with ps command I get: 324 pts/1 S 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data When I did the same setps in fedora 8 the postmaster was started on a port 1703 ? S 0:01 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data Why is there no -p 5432 on the red hat box? I assume the port is needed. What do I need to do to have the postmaster runningon port 5432 like on the fedora box? Thanks Marc
On Thu, Sep 11, 2008 at 10:57 AM, Marc Fromm <Marc.Fromm@wwu.edu> wrote: > > I installed Red Hat 5.2 EL. During the install I select postgresql and this versoin was installed: postgresql-8.1.11-1.el5_1.1. > > 1. I started postgresql as follows: > initdb -D /var/lib/pgsql/data There's an initidb function built into the /etc/init.d/postgresql script you can use: sudo /etc/init.d/postgresql initdb both work similarly. > 2. I started the database server as follows: > /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start > > 3. I started the postmaster as follows: > service postgresql start These two steps do the same thing. the db server was already started in step2. The preferred way is how you did it in step 3. > When I check that it is all running with ps command I get: > 324 pts/1 S 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data > > When I did the same setps in fedora 8 the postmaster was started on a port > 1703 ? S 0:01 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data > > Why is there no -p 5432 on the red hat box? I assume the port is needed. What do I need to do to have the postmaster runningon port 5432 like on the fedora box? Because pgsql is reading it from the postgresql.conf file. Stick to the /etc/init.d/postgresql way of starting and stopping. To set pgsql to start automatically on bootup, use chkconfig: chkconfig postgresql on chkconfig --list postgresql
Oh yeah, please note that the proper way to start and stop services on RH oses is via the service command: service postgresql start service postgresql initdb etc...
Scott Marlowe wrote: > Oh yeah, please note that the proper way to start and stop services on > RH oses is via the service command: > > service postgresql start > service postgresql initdb > > etc... > Scott, How does the above compare with using postmaster to start PostgreSQL? I tried in the past to use the "service postgresql start" command, but couldn't connect from a java application. I gave up and have been using a script that uses postmaster to append a "-i" to the command line to allow TCP/IP connections from a Java app. Can that be configured in postgresql.conf? Thanks, John
On Thu, Sep 11, 2008 at 11:36 AM, John <lists@johndubchak.com> wrote: > Scott Marlowe wrote: >> >> Oh yeah, please note that the proper way to start and stop services on >> RH oses is via the service command: >> >> service postgresql start >> service postgresql initdb >> >> etc.. > > Scott, > > How does the above compare with using postmaster to start Postgres? > > I tried in the past to use the "service postgresql start" command, but > couldn't connect from a java application and have gotten in the habit of > using a script that uses postmaster to append a "-i" to the command line to > allow TCP/IP connections. Yeah, you can't stop / stop services as anything but root on centos. so unless you were running the receiving end to the java app as root, it wouldn't be able to restart pgsql. On ubuntu the postgres account can restart with /etc/init.d/postgresql, nice feature. > Can that be configured in postgresql.conf? Yes, it's the line where you tell it what host adapters to use, or on older pgsql's also the tcp_connection parameter (I think I spelt it right, been a while)
On Thu, Sep 11, 2008 at 11:35 AM, Marc Fromm <Marc.Fromm@wwu.edu> wrote: > Thanks for your reply. > I was following the instructions a listed in the 8.1 docs at postgresql.org, which worked great on fedora. I'm using the PGDG 8.3.3 rpms on Centos 5.2 mysql. Those do have initdb. On older pgsql init scripts, it would automagically initdb when needed, which was deemed (right so) to be a dangerous way of doing things. I'd highly suggest downloading and installing the pgsql 8.3.3 PGDG rpms, or pointing your server at a repo that has them. > How do I restart the process? > Running "/etc/init.d/postgresql initdb" as root diplays this: > Usage: /etc/init.d/postgresql {start|stop|status|restart|condrestart|condstop|reload|force-reload} yep. older init script / not PGDG one for 8.3.3. that one likely does the automagic initdb for you first time you run it.
On Thu, 2008-09-11 at 11:21 -0600, Scott Marlowe wrote: > There's an initidb function built into the /etc/init.d/postgresql > script you can use: > > sudo /etc/init.d/postgresql initdb It won't work in pre 8.2 releases. Regards, -- Devrim GÜNDÜZ, RHCE devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr http://www.gunduz.org
Вложения
On Thu, 2008-09-11 at 09:57 -0700, Marc Fromm wrote: > When I check that it is all running with ps command I get: > 324 pts/1 S 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data > > When I did the same setps in fedora 8 the postmaster was started on a > port > 1703 ? S 0:01 /usr/bin/postmaster -p 5432 > -D /var/lib/pgsql/data > > Why is there no -p 5432 on the red hat box? I may be wrong, but IIRC PostgreSQL started listening to localhost:5432 by default as of 8.2 . Fedora 8 ships with 8.2, that may be the reason that you see -p 5432 there. Regards, -- Devrim GÜNDÜZ, RHCE devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr http://www.gunduz.org