Thread: connection refused problem
I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from ports, using defaults. I copied the sample versions of pg_hba.conf and postgresql.conf to new files, removing the .sample part. This command works fine: psql -U pgsql database but if I specify a hostname: psql -U pgsql -h localhost cn I get: psql: connectDBStart() -- connect() failed: Connection refused Is the postmaster running (with -i) at 'localhost' and accepting connections on TCP/IP port 5432? I have local hosts defined in /etc/hosts, and in /tmp I see: srwxrwxrwx 1 pgsql wheel 0 May 30 10:15 .s.PGSQL.5432= -rw------- 1 pgsql wheel 28 May 30 10:15 .s.PGSQL.5432.lock Sorry for such an obviously dumb question, I didn't see anything in the FAQ other than "add the -i flag to postmaster", but I didn't see how to do that. The core line in my startup script is: '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog'
> I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from > ports, using defaults. I copied the sample versions of pg_hba.conf and > postgresql.conf to new files, removing the .sample part. > > This command works fine: > psql -U pgsql database > > but if I specify a hostname: > psql -U pgsql -h localhost cn > > I get: > psql: connectDBStart() -- connect() failed: Connection refused > Is the postmaster running (with -i) at 'localhost' postmaster -i ?? -i -----> enable TCP/IP connections > ..... Best regard! mpls
Modify the pg_ctl script and it should run the postmaster. What you do is add the -i flag there. Alternatively you can add to pg_hba.conf file i think it is TCP = yes. I am not sure but you can check the documentation about that one but the -i flag on postmaster definately works HTH Darren Ferguson On Thu, 30 May 2002, Phil Glatz wrote: > I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from > ports, using defaults. I copied the sample versions of pg_hba.conf and > postgresql.conf to new files, removing the .sample part. > > This command works fine: > psql -U pgsql database > > but if I specify a hostname: > psql -U pgsql -h localhost cn > > I get: > psql: connectDBStart() -- connect() failed: Connection refused > Is the postmaster running (with -i) at 'localhost' > and accepting connections on TCP/IP port 5432? > > > I have local hosts defined in /etc/hosts, and in /tmp I see: > srwxrwxrwx 1 pgsql wheel 0 May 30 10:15 .s.PGSQL.5432= > -rw------- 1 pgsql wheel 28 May 30 10:15 .s.PGSQL.5432.lock > > > Sorry for such an obviously dumb question, I didn't see anything in the FAQ > other than "add the -i flag to postmaster", but I didn't see how to do > that. The core line in my startup script is: > > '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog' > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
If you don't want to modify the pg_ctl script (say you only want network connections some of the time), you can put the -i on the command line, preceded by a -o to tell pg_ctl to pass the option through to the postmaster: pc_ctl -o -i start Dan Weston On Thu, 30 May 2002, Darren Ferguson wrote: > Modify the pg_ctl script and it should run the postmaster. > What you do is add the -i flag there. Alternatively you can add > to pg_hba.conf file i think it is TCP = yes. I am not sure but you can > check the documentation about that one but the -i flag on postmaster > definately works > > HTH > > Darren Ferguson > > On Thu, 30 May 2002, Phil Glatz wrote: > > > I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from > > ports, using defaults. I copied the sample versions of pg_hba.conf and > > postgresql.conf to new files, removing the .sample part. > > > > This command works fine: > > psql -U pgsql database > > > > but if I specify a hostname: > > psql -U pgsql -h localhost cn > > > > I get: > > psql: connectDBStart() -- connect() failed: Connection refused > > Is the postmaster running (with -i) at 'localhost' > > and accepting connections on TCP/IP port 5432? > > > > > > I have local hosts defined in /etc/hosts, and in /tmp I see: > > srwxrwxrwx 1 pgsql wheel 0 May 30 10:15 .s.PGSQL.5432= > > -rw------- 1 pgsql wheel 28 May 30 10:15 .s.PGSQL.5432.lock > > > > > > Sorry for such an obviously dumb question, I didn't see anything in the FAQ > > other than "add the -i flag to postmaster", but I didn't see how to do > > that. The core line in my startup script is: > > > > '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog' > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
HOLD ON guys! The right way is to edit $PGDATA/postgresql.conf and change the line that says: tcpip_socket = false so that is says: tcpip_socket = true And restart the postmaster with pg_ctl restart On Thu, 30 May 2002, Dan Weston wrote: > If you don't want to modify the pg_ctl script (say you only want network > connections some of the time), you can put the -i on the command line, > preceded by a -o to tell pg_ctl to pass the option through to the > postmaster: > > pc_ctl -o -i start > > Dan Weston > > > On Thu, 30 May 2002, Darren Ferguson wrote: > > > Modify the pg_ctl script and it should run the postmaster. > > What you do is add the -i flag there. Alternatively you can add > > to pg_hba.conf file i think it is TCP = yes. I am not sure but you can > > check the documentation about that one but the -i flag on postmaster > > definately works > > > > HTH > > > > Darren Ferguson > > > > On Thu, 30 May 2002, Phil Glatz wrote: > > > > > I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from > > > ports, using defaults. I copied the sample versions of pg_hba.conf and > > > postgresql.conf to new files, removing the .sample part. > > > > > > This command works fine: > > > psql -U pgsql database > > > > > > but if I specify a hostname: > > > psql -U pgsql -h localhost cn > > > > > > I get: > > > psql: connectDBStart() -- connect() failed: Connection refused > > > Is the postmaster running (with -i) at 'localhost' > > > and accepting connections on TCP/IP port 5432? > > > > > > > > > I have local hosts defined in /etc/hosts, and in /tmp I see: > > > srwxrwxrwx 1 pgsql wheel 0 May 30 10:15 .s.PGSQL.5432= > > > -rw------- 1 pgsql wheel 28 May 30 10:15 .s.PGSQL.5432.lock > > > > > > > > > Sorry for such an obviously dumb question, I didn't see anything in the FAQ > > > other than "add the -i flag to postmaster", but I didn't see how to do > > > that. The core line in my startup script is: > > > > > > '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog' > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 5: Have you checked our extensive FAQ? > > > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >
There is no right way they both work. Also in my mail i did say you could edit the conf file adding support i had just forgot the actual syntax and offered a lookup of the documentation to find the correct syntax. Both -i and tcpip_socket = true will achieve the same result. TCP/IP connections to the database Darren Ferguson On Thu, 30 May 2002, Scott Marlowe wrote: > HOLD ON guys! The right way is to edit $PGDATA/postgresql.conf and > change the line that says: > > tcpip_socket = false > > so that is says: > > tcpip_socket = true > > And restart the postmaster with > > pg_ctl restart > > On Thu, 30 May 2002, Dan Weston wrote: > > > If you don't want to modify the pg_ctl script (say you only want network > > connections some of the time), you can put the -i on the command line, > > preceded by a -o to tell pg_ctl to pass the option through to the > > postmaster: > > > > pc_ctl -o -i start > > > > Dan Weston > > > > > > On Thu, 30 May 2002, Darren Ferguson wrote: > > > > > Modify the pg_ctl script and it should run the postmaster. > > > What you do is add the -i flag there. Alternatively you can add > > > to pg_hba.conf file i think it is TCP = yes. I am not sure but you can > > > check the documentation about that one but the -i flag on postmaster > > > definately works > > > > > > HTH > > > > > > Darren Ferguson > > > > > > On Thu, 30 May 2002, Phil Glatz wrote: > > > > > > > I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from > > > > ports, using defaults. I copied the sample versions of pg_hba.conf and > > > > postgresql.conf to new files, removing the .sample part. > > > > > > > > This command works fine: > > > > psql -U pgsql database > > > > > > > > but if I specify a hostname: > > > > psql -U pgsql -h localhost cn > > > > > > > > I get: > > > > psql: connectDBStart() -- connect() failed: Connection refused > > > > Is the postmaster running (with -i) at 'localhost' > > > > and accepting connections on TCP/IP port 5432? > > > > > > > > > > > > I have local hosts defined in /etc/hosts, and in /tmp I see: > > > > srwxrwxrwx 1 pgsql wheel 0 May 30 10:15 .s.PGSQL.5432= > > > > -rw------- 1 pgsql wheel 28 May 30 10:15 .s.PGSQL.5432.lock > > > > > > > > > > > > Sorry for such an obviously dumb question, I didn't see anything in the FAQ > > > > other than "add the -i flag to postmaster", but I didn't see how to do > > > > that. The core line in my startup script is: > > > > > > > > '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog' > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 4: Don't 'kill -9' the postmaster > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >
I thought I specifically said "say you only want network connections some of the time". I offered the -i option for infrequent use. The main point is, if you want to pass postmaster options via pg_ctl, you need the -o option first. As for "right way", there wouldn't be command line options if they weren't supposed to be used. Dan Weston On Thu, 30 May 2002, Darren Ferguson wrote: > There is no right way they both work. Also in my mail i did say you could > edit the conf file adding support i had just forgot the actual syntax and > offered a lookup of the documentation to find the correct syntax. > > Both -i and tcpip_socket = true will achieve the same result. TCP/IP > connections to the database > > Darren Ferguson > > On Thu, 30 May 2002, Scott Marlowe wrote: > > > HOLD ON guys! The right way is to edit $PGDATA/postgresql.conf and > > change the line that says: > > > > tcpip_socket = false > > > > so that is says: > > > > tcpip_socket = true > > > > And restart the postmaster with > > > > pg_ctl restart > > > > On Thu, 30 May 2002, Dan Weston wrote: > > > > > If you don't want to modify the pg_ctl script (say you only want network > > > connections some of the time), you can put the -i on the command line, > > > preceded by a -o to tell pg_ctl to pass the option through to the > > > postmaster: > > > > > > pc_ctl -o -i start > > > > > > Dan Weston > > > > > > > > > On Thu, 30 May 2002, Darren Ferguson wrote: > > > > > > > Modify the pg_ctl script and it should run the postmaster. > > > > What you do is add the -i flag there. Alternatively you can add > > > > to pg_hba.conf file i think it is TCP = yes. I am not sure but you can > > > > check the documentation about that one but the -i flag on postmaster > > > > definately works > > > > > > > > HTH > > > > > > > > Darren Ferguson > > > > > > > > On Thu, 30 May 2002, Phil Glatz wrote: > > > > > > > > > I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from > > > > > ports, using defaults. I copied the sample versions of pg_hba.conf and > > > > > postgresql.conf to new files, removing the .sample part. > > > > > > > > > > This command works fine: > > > > > psql -U pgsql database > > > > > > > > > > but if I specify a hostname: > > > > > psql -U pgsql -h localhost cn > > > > > > > > > > I get: > > > > > psql: connectDBStart() -- connect() failed: Connection refused > > > > > Is the postmaster running (with -i) at 'localhost' > > > > > and accepting connections on TCP/IP port 5432? > > > > > > > > > > > > > > > I have local hosts defined in /etc/hosts, and in /tmp I see: > > > > > srwxrwxrwx 1 pgsql wheel 0 May 30 10:15 .s.PGSQL.5432= > > > > > -rw------- 1 pgsql wheel 28 May 30 10:15 .s.PGSQL.5432.lock > > > > > > > > > > > > > > > Sorry for such an obviously dumb question, I didn't see anything in the FAQ > > > > > other than "add the -i flag to postmaster", but I didn't see how to do > > > > > that. The core line in my startup script is: > > > > > > > > > > '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog' > > > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > > TIP 4: Don't 'kill -9' the postmaster > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 6: Have you searched our list archives? > > > > > > http://archives.postgresql.org > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
Sure, and editing the source files to make it work differently will work too. But if you want a machine that anyone who knows postgresql can maintain, it would be a good idea to make your changes in postgresql.conf... I get ornery about it because as often as this question comes up, there's someone who says to edit pg_ctl or to just run the postmaster by hand each time, when the folks who wrote pg_ctl / postgresql.conf went to all the trouble of making it easy to configure postgres, and editing pg_ctl or starting postmaster just makes it harder. Nothing personal... On Thu, 30 May 2002, Darren Ferguson wrote: > There is no right way they both work. Also in my mail i did say you could > edit the conf file adding support i had just forgot the actual syntax and > offered a lookup of the documentation to find the correct syntax. > > Both -i and tcpip_socket = true will achieve the same result. TCP/IP > connections to the database > > Darren Ferguson > > On Thu, 30 May 2002, Scott Marlowe wrote: > > > HOLD ON guys! The right way is to edit $PGDATA/postgresql.conf and > > change the line that says: > > > > tcpip_socket = false > > > > so that is says: > > > > tcpip_socket = true > > > > And restart the postmaster with > > > > pg_ctl restart > > > > On Thu, 30 May 2002, Dan Weston wrote: > > > > > If you don't want to modify the pg_ctl script (say you only want network > > > connections some of the time), you can put the -i on the command line, > > > preceded by a -o to tell pg_ctl to pass the option through to the > > > postmaster: > > > > > > pc_ctl -o -i start > > > > > > Dan Weston > > > > > > > > > On Thu, 30 May 2002, Darren Ferguson wrote: > > > > > > > Modify the pg_ctl script and it should run the postmaster. > > > > What you do is add the -i flag there. Alternatively you can add > > > > to pg_hba.conf file i think it is TCP = yes. I am not sure but you can > > > > check the documentation about that one but the -i flag on postmaster > > > > definately works > > > > > > > > HTH > > > > > > > > Darren Ferguson > > > > > > > > On Thu, 30 May 2002, Phil Glatz wrote: > > > > > > > > > I bringing up PostgreSQL 7.1.3 on a Free BSD 4.5 system, installed from > > > > > ports, using defaults. I copied the sample versions of pg_hba.conf and > > > > > postgresql.conf to new files, removing the .sample part. > > > > > > > > > > This command works fine: > > > > > psql -U pgsql database > > > > > > > > > > but if I specify a hostname: > > > > > psql -U pgsql -h localhost cn > > > > > > > > > > I get: > > > > > psql: connectDBStart() -- connect() failed: Connection refused > > > > > Is the postmaster running (with -i) at 'localhost' > > > > > and accepting connections on TCP/IP port 5432? > > > > > > > > > > > > > > > I have local hosts defined in /etc/hosts, and in /tmp I see: > > > > > srwxrwxrwx 1 pgsql wheel 0 May 30 10:15 .s.PGSQL.5432= > > > > > -rw------- 1 pgsql wheel 28 May 30 10:15 .s.PGSQL.5432.lock > > > > > > > > > > > > > > > Sorry for such an obviously dumb question, I didn't see anything in the FAQ > > > > > other than "add the -i flag to postmaster", but I didn't see how to do > > > > > that. The core line in my startup script is: > > > > > > > > > > '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog' > > > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > > TIP 4: Don't 'kill -9' the postmaster > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 6: Have you searched our list archives? > > > > > > http://archives.postgresql.org > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >