local usage was: Re: using pgsql on my comp only without tcp

From: <ghaverla(at)freenet(dot)edmonton(dot)ab(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Cc: stm23 <STM23(at)student(dot)canterbury(dot)ac(dot)nz>
Subject: local usage was: Re: using pgsql on my comp only without tcp
Date: 2004-03-10 12:17:26
Message-ID: Pine.A41.3.95.1040310050119.20242C-100000@fn2.freenet.edmonton.ab.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, 9 Mar 2004, Bruno Wolff III wrote:
> On Wed, Mar 10, 2004 at 12:47:16 +1300,
> stm23 <STM23(at)student(dot)canterbury(dot)ac(dot)nz> wrote:

>> hi, i am unable to setup my modem on my redhat 8.0 OS, so i
>> don't think i can get TCP access. is it possible to use pgsql
>> entirely on my local computer (i.e creating my own databases &
>> manipulating them on my comp)?
>
> You don't need a modem for tcp access on the same machine that is running
> postgres. There is a loopback interface that is part of the OS that takes
> care of that. You also have (the better) option of using domain sockets
> for connecting to the database from the same host.

Just getting a little more wordy here.

I suppose it is possible to set up Linux such that the "localhost"
doesn't exist, but in general if you have networking installed
this thing called localhost will exist. It is also known as the
loopback interface, and is called 'lo' in some instances
(ifconfig).

A long time ago, people realised that in networking it was always
handy to be able to get to "here". If for no other reason, than
to test network capable software. Most programs happen to know
what $CWD is (Current Working Directory), well localhost is a
similar idea applied to a network. In terms of an IP address,
localhost is 127.0.0.1.

An example is to telnet to 127.0.0.1. This just lets you login to
your own computer, but instead of the computer thinking you are
logged in at the console, you are logged in over a network
connection.

So, to use postgres over a local networking connection, we will
have some program establish a connection to 127.0.0.1 on the port
that the PostgreSQL postmaster is listening to (on my machine,
that's 5432). If I later decided to move my database to a
different machine, or move the program to a different machine, all
I need to do is to change the address (and possibly port number),
I don't need to change how the program operates.

We'll leave sockets and what domain they are in to a different
message. :-)

Hopefully this is a little "better" description, in the case you
didn't understand the more concise explanation offered earlier.

Gord

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message ghaverla 2004-03-10 12:27:43 Re: find close (duplicate) points + create index
Previous Message Costin Manda 2004-03-10 11:34:08 Problems with 'make'ing PostgreSQL with --with-perl