Thread: Connection refused (0x0000274D/10061)

Connection refused (0x0000274D/10061)

From
Sourav Majumdar
Date:

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

When I am trying to run localhost:3000, its giving this error massage, Can you please help me out here?


--
Regards-
Sourav Majumdar
Mob.- 9732354141

Re: Connection refused (0x0000274D/10061)

From
Adrian Klaver
Date:
On 6/9/19 11:51 AM, Sourav Majumdar wrote:
> 
>     could not connect to server: Connection refused (0x0000274D/10061)
>     Is the server running on host "localhost" (::1) and accepting TCP/IP
>     connections on port 5432? could not connect to server: Connection
>     refused (0x0000274D/10061) Is the server running on host "localhost"
>     (127.0.0.1) and accepting TCP/IP connections on port 5432?
> 
>     When I am trying to run localhost:3000, its giving this error
>     massage, Can you please help me out here?

Do you mean in postgresql.conf?:

listen_addresses = localhost
port = 3000

What is the connection string you are using?

OS and version?

How was Postgres installed?

> 
> 
> -- 
> /Regards-/
> /Sourav Majumdar/
> /Mob.- *9732354141*/


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Connection refused (0x0000274D/10061)

From
Ray O'Donnell
Date:
On 09/06/2019 19:51, Sourav Majumdar wrote:
> 
>     could not connect to server: Connection refused (0x0000274D/10061)
>     Is the server running on host "localhost" (::1) and accepting TCP/IP
>     connections on port 5432? could not connect to server: Connection
>     refused (0x0000274D/10061) Is the server running on host "localhost"
>     (127.0.0.1) and accepting TCP/IP connections on port 5432?

Hi there,

 From the above, you have the server listening on port 3000 (you would 
have set this in postgresql.conf - did you?), but the client is trying 
to connect on port 5432 (the default).

You therefore need to tell the client to connect to port 3000 - if you 
are using psql, you need the -p option:

    psql -p 3000 (... etc ...)

HTH,

Ray.

-- 
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie



Re: Connection refused (0x0000274D/10061)

From
Sourav Majumdar
Date:
Hello,
Thanks for your quick response. I am new to pgsql, didnot configured it , can you please give a guidance for that? I will be highly oblised if you can assist me.
I am using windows 8.1, 64 bit. 
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
Rails 5.2.3
Trying to setup ruby on rails on my local host

On Mon, Jun 10, 2019 at 1:13 AM Ray O'Donnell <ray@rodonnell.ie> wrote:
On 09/06/2019 19:51, Sourav Majumdar wrote:
>
>     could not connect to server: Connection refused (0x0000274D/10061)
>     Is the server running on host "localhost" (::1) and accepting TCP/IP
>     connections on port 5432? could not connect to server: Connection
>     refused (0x0000274D/10061) Is the server running on host "localhost"
>     (127.0.0.1) and accepting TCP/IP connections on port 5432?

Hi there,

 From the above, you have the server listening on port 3000 (you would
have set this in postgresql.conf - did you?), but the client is trying
to connect on port 5432 (the default).

You therefore need to tell the client to connect to port 3000 - if you
are using psql, you need the -p option:

    psql -p 3000 (... etc ...)

HTH,

Ray.

--
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie


--
Regards-
Sourav Majumdar
Mob.- 9732354141

Re: Connection refused (0x0000274D/10061)

From
Ray O'Donnell
Date:
On 09/06/2019 20:49, Sourav Majumdar wrote:
> Hello,
> Thanks for your quick response. I am new to pgsql, didnot configured it 
> , can you please give a guidance for that? I will be highly oblised if 
> you can assist me.
> I am using windows 8.1, 64 bit.
> ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
> Rails 5.2.3
> Trying to setup ruby on rails on my local host

Hi,

PostgreSQL's default port is 5432, and if the Postgres instance on your 
computer is the only one there then that's what it'll be listening on.

I don't know anything about Ruby or how you connect to PG from it, but 
you need to tell it to use port 5432.

Alternatively, if you really want to use port 3000, then you need to 
edit postgresql.conf and change the "port" setting there. You'll need to 
restart PG for this to take effect.

Either way, you need to connect to the port on which PG is listening.

Ray.

-- 
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie



Re: Connection refused (0x0000274D/10061)

From
Adrian Klaver
Date:
On 6/9/19 1:46 PM, Ray O'Donnell wrote:
> On 09/06/2019 20:49, Sourav Majumdar wrote:
>> Hello,
>> Thanks for your quick response. I am new to pgsql, didnot configured 
>> it , can you please give a guidance for that? I will be highly oblised 
>> if you can assist me.
>> I am using windows 8.1, 64 bit.
>> ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
>> Rails 5.2.3
>> Trying to setup ruby on rails on my local host

Where are you doing?:

"When I am trying to run localhost:3000 ..."

Or is the above the port the Rails Web server is running on?

More below.

> 
> Hi,
> 
> PostgreSQL's default port is 5432, and if the Postgres instance on your 
> computer is the only one there then that's what it'll be listening o >
> I don't know anything about Ruby or how you connect to PG from it, but 
> you need to tell it to use port 5432.

https://guides.rubyonrails.org/configuring.html#configuring-a-database

 From a Redmine install of mine(running against standard port(5432)):

# PostgreSQL configuration example
production:
   adapter: postgresql
   database: redmine
   host: localhost
   port: 5432
   username: redmine
   password: ********


> 
> Alternatively, if you really want to use port 3000, then you need to 
> edit postgresql.conf and change the "port" setting there. You'll need to 
> restart PG for this to take effect.
> 
> Either way, you need to connect to the port on which PG is listening.
> 
> Ray.
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Connection refused (0x0000274D/10061)

From
Adrian Klaver
Date:
On 6/9/19 1:46 PM, Ray O'Donnell wrote:
> On 09/06/2019 20:49, Sourav Majumdar wrote:
>> Hello,
>> Thanks for your quick response. I am new to pgsql, didnot configured 
>> it , can you please give a guidance for that? I will be highly oblised 
>> if you can assist me.
>> I am using windows 8.1, 64 bit.
>> ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
>> Rails 5.2.3
>> Trying to setup ruby on rails on my local host

Alright the penny just dropped, maybe:

1) You have started the Rails Web server on port 3000

2) You tried to do something that accessed the Postgres server.

3) You got connection refused error.

If the above is correct then the error message:

": Connection refused (0x0000274D/10061) Is the server running on host 
"localhost" (::1) and accepting TCP/IP connections on port 5432?"

means either:

1) The server is not running. Check that the Postgres service is running 
in Windows.

2) The server is running but not listening on port 5432. Check the 
Postgres config file(postgresql.conf) to see what the settings I 
mentioned earlier are.

> 
> Hi,
> 
> PostgreSQL's default port is 5432, and if the Postgres instance on your 
> computer is the only one there then that's what it'll be listening on.
> 
> I don't know anything about Ruby or how you connect to PG from it, but 
> you need to tell it to use port 5432.
> 
> Alternatively, if you really want to use port 3000, then you need to 
> edit postgresql.conf and change the "port" setting there. You'll need to 
> restart PG for this to take effect.
> 
> Either way, you need to connect to the port on which PG is listening.
> 
> Ray.
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Connection refused (0x0000274D/10061)

From
Sourav Majumdar
Date:
Hi,
I have tried many time for setup postgreSQL for my local host. Hence I have tried to reInstall the one click app from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads -  Windows x86-64  -  PostgreSQL Version 11.3. When installing using default port 5432, Its giving an error "Database Cluster Installation Failed". Please advice how to resolve the issue. I am struggling to setup this POSTGRESQL from more than a week. 

The error screenshot is attached. PFA

On Mon, Jun 10, 2019 at 2:39 AM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/9/19 1:46 PM, Ray O'Donnell wrote:
> On 09/06/2019 20:49, Sourav Majumdar wrote:
>> Hello,
>> Thanks for your quick response. I am new to pgsql, didnot configured
>> it , can you please give a guidance for that? I will be highly oblised
>> if you can assist me.
>> I am using windows 8.1, 64 bit.
>> ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
>> Rails 5.2.3
>> Trying to setup ruby on rails on my local host

Alright the penny just dropped, maybe:

1) You have started the Rails Web server on port 3000

2) You tried to do something that accessed the Postgres server.

3) You got connection refused error.

If the above is correct then the error message:

": Connection refused (0x0000274D/10061) Is the server running on host
"localhost" (::1) and accepting TCP/IP connections on port 5432?"

means either:

1) The server is not running. Check that the Postgres service is running
in Windows.

2) The server is running but not listening on port 5432. Check the
Postgres config file(postgresql.conf) to see what the settings I
mentioned earlier are.

>
> Hi,
>
> PostgreSQL's default port is 5432, and if the Postgres instance on your
> computer is the only one there then that's what it'll be listening on.
>
> I don't know anything about Ruby or how you connect to PG from it, but
> you need to tell it to use port 5432.
>
> Alternatively, if you really want to use port 3000, then you need to
> edit postgresql.conf and change the "port" setting there. You'll need to
> restart PG for this to take effect.
>
> Either way, you need to connect to the port on which PG is listening.
>
> Ray.
>


--
Adrian Klaver
adrian.klaver@aklaver.com


--
Regards-
Sourav Majumdar
Mob.- 9732354141
Attachment

Re: Connection refused (0x0000274D/10061)

From
Adrian Klaver
Date:
On 6/13/19 9:56 AM, Sourav Majumdar wrote:
> Hi,
> I have tried many time for setup postgreSQL for my local host. Hence I 
> have tried to reInstall the one click app from 
> https://www.enterprisedb.com/downloads/postgres-postgresql-downloads -  Windows 
> x86-64  -  PostgreSQL Version 11.3. When installing using default port 
> 5432, Its giving an error "Database Cluster Installation Failed". Please 
> advice how to resolve the issue. I am struggling to setup this 
> POSTGRESQL from more than a week.
> 
> The error screenshot is attached. PFA
> 

Sounds like a permissions problem to me.

See:

https://www.enterprisedb.com/docs/en/11.0/PG_Inst_Guide_v11/PostgreSQL_Installation_Guide.1.13.html#

to find the log of the install process. It will probably have more 
information.


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Connection refused (0x0000274D/10061)

From
Sourav Majumdar
Date:
Hii, I have checked the logged file. I am attaching it with this mail. PFA

On Fri, Jun 14, 2019 at 1:58 AM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/13/19 9:56 AM, Sourav Majumdar wrote:
> Hi,
> I have tried many time for setup postgreSQL for my local host. Hence I
> have tried to reInstall the one click app from
> https://www.enterprisedb.com/downloads/postgres-postgresql-downloads -  Windows
> x86-64  -  PostgreSQL Version 11.3. When installing using default port
> 5432, Its giving an error "Database Cluster Installation Failed". Please
> advice how to resolve the issue. I am struggling to setup this
> POSTGRESQL from more than a week.
>
> The error screenshot is attached. PFA
>

Sounds like a permissions problem to me.

See:

https://www.enterprisedb.com/docs/en/11.0/PG_Inst_Guide_v11/PostgreSQL_Installation_Guide.1.13.html#

to find the log of the install process. It will probably have more
information.


--
Adrian Klaver
adrian.klaver@aklaver.com


--
Regards-
Sourav Majumdar
Mob.- 9732354141
Attachment

Re: Connection refused (0x0000274D/10061)

From
Adrian Klaver
Date:
On 6/18/19 1:06 AM, Sourav Majumdar wrote:
> Hii, I have checked the logged file. I am attaching it with this mail. PFA

In future please do not attach a 1.4MB file. Most of it was Unpacking 
info. The relevant part was at the end:

"
fixing permissions on existing directory C:/PostgreSQL/data ... initdb: 
could not change permissions of directory "C:/PostgreSQL/data": 
Permission denied

Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb

Script stderr:
  Program ended with an error exit code

Error running cscript //NoLogo 
"C:\PostgreSQL/installer/server/initcluster.vbs" "NT 
AUTHORITY\NetworkService" "postgres" "****" "C:\PostgreSQL" 
"C:\PostgreSQL\data" 5432 "DEFAULT" 0: Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
  The database cluster initialisation failed.
[23:30:13] Delete the temporary scripts directory...
Creating menu shortcuts...
Executing cscript //NoLogo 
"C:\PostgreSQL\installer\server\createshortcuts_clt.vbs" "PostgreSQL 11" 
"C:\PostgreSQL"
Script exit code: 0"


Did you follow the instructions here?:

https://www.enterprisedb.com/docs/en/11.0/PG_Inst_Guide_v11/PostgreSQL_Installation_Guide.1.08.html#

In particular the part about:

"To perform an installation using the graphical installation wizard, you 
must have superuser or administrator privileges. To start the 
installation wizard, assume sufficient privileges and double-click the 
installer icon; if prompted, provide a password.
Note that in some versions of Windows, you can invoke the installer with 
Administrator privileges by right clicking on the installer icon and 
selecting Run as Administrator from the context menu."



> 
> On Fri, Jun 14, 2019 at 1:58 AM Adrian Klaver <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.com>> wrote:
> 
>     On 6/13/19 9:56 AM, Sourav Majumdar wrote:
>      > Hi,
>      > I have tried many time for setup postgreSQL for my local host.
>     Hence I
>      > have tried to reInstall the one click app from
>      >
>     https://www.enterprisedb.com/downloads/postgres-postgresql-downloads -  Windows
> 
>      > x86-64  -  PostgreSQL Version 11.3. When installing using default
>     port
>      > 5432, Its giving an error "Database Cluster Installation Failed".
>     Please
>      > advice how to resolve the issue. I am struggling to setup this
>      > POSTGRESQL from more than a week.
>      >
>      > The error screenshot is attached. PFA
>      >
> 
>     Sounds like a permissions problem to me.
> 
>     See:
> 
>     https://www.enterprisedb.com/docs/en/11.0/PG_Inst_Guide_v11/PostgreSQL_Installation_Guide.1.13.html#
> 
>     to find the log of the install process. It will probably have more
>     information.
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 
> 
> -- 
> /Regards-/
> /Sourav Majumdar/
> /Mob.- *9732354141*/


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Connection refused (0x0000274D/10061)

From
Moreno Andreo
Date:
Il 18/06/19 15:57, Adrian Klaver ha scritto:
> On 6/18/19 1:06 AM, Sourav Majumdar wrote:
>> Hii, I have checked the logged file. I am attaching it with this 
>> mail. PFA
>
> In future please do not attach a 1.4MB file. Most of it was Unpacking 
> info. The relevant part was at the end:
>
> "
> fixing permissions on existing directory C:/PostgreSQL/data ... 
> initdb: could not change permissions of directory 
> "C:/PostgreSQL/data": Permission denied
>
> [...]
>
> Did you follow the instructions here?:
>
> https://www.enterprisedb.com/docs/en/11.0/PG_Inst_Guide_v11/PostgreSQL_Installation_Guide.1.08.html# 
>
>
> In particular the part about:
>
> "To perform an installation using the graphical installation wizard, 
> you must have superuser or administrator privileges. To start the 
> installation wizard, assume sufficient privileges and double-click the 
> installer icon; if prompted, provide a password.
> Note that in some versions of Windows, you can invoke the installer 
> with Administrator privileges by right clicking on the installer icon 
> and selecting Run as Administrator from the context menu."


We had this issue in the past, and noted that re-issuing initdb from an 
Administrator Command Prompt (not doing anything else) from the Bin 
directory worked perfectly.

This was applied for 9.5, 9.6 and 10.x. Still not using 11 in 
production, so I have no cases to test at the moment.

My 2 cent

Moreno.-






RE: Connection refused (0x0000274D/10061)

From
Igor Neyman
Date:

 

From: Sourav Majumdar [mailto:souravmajumdar2002@gmail.com]
Sent: Tuesday, June 18, 2019 4:06 AM
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Ray O'Donnell <ray@rodonnell.ie>; pgsql-general@postgresql.org
Subject: Re: Connection refused (0x0000274D/10061)

 

Hii, I have checked the logged file. I am attaching it with this mail. PFA

 

On Fri, Jun 14, 2019 at 1:58 AM Adrian Klaver <adrian.klaver@aklaver.com> wrote:

On 6/13/19 9:56 AM, Sourav Majumdar wrote:
> Hi,
> I have tried many time for setup postgreSQL for my local host. Hence I
> have tried to reInstall the one click app from
> https://www.enterprisedb.com/downloads/postgres-postgresql-downloads -  Windows
> x86-64  -  PostgreSQL Version 11.3. When installing using default port
> 5432, Its giving an error "Database Cluster Installation Failed". Please
> advice how to resolve the issue. I am struggling to setup this
> POSTGRESQL from more than a week.
>
> The error screenshot is attached. PFA
>

Sounds like a permissions problem to me.

See:

https://www.enterprisedb.com/docs/en/11.0/PG_Inst_Guide_v11/PostgreSQL_Installation_Guide.1.13.html#

to find the log of the install process. It will probably have more
information.


--
Adrian Klaver
adrian.klaver@aklaver.com


_________________________________________________________________________________________________________

 

From the log that you attached:

 

Failed to remove inherited ACLs on (C:\PostgreSQL\data)

WScript.Network initialized...

strParentOfDataDirC:\PostgreSQL

logged in userMajumdar\Its Majumdar

Called AclCheck(C:\PostgreSQL\data)

Called IsVistaOrNewer()...

    'winmgmts' object initialized...

    Version:6.3

    MajorVersion:6

Executing icacls to ensure the Majumdar\Its Majumdar account can read the path C:\PostgreSQL\data

    Executing batch file 'rad3A6BD.bat'...

    'icacls' is not recognized as an internal or external command,

operable program or batch file.

 

 

Installation script doesn’t find on your machine ICACLS, Windows utility that is being used by installation script to grant proper permissions.

Something’s wrong with your Windows OS.

 

Regards,

Igor Neyman