[postgis-users] Mapserver and Postgis
Ezequias Rodrigues da Rocha
ezequias at recife.pe.gov.br
Wed Mar 29 04:53:17 PST 2006
The webserver and postgis server is the same. They are on the network 192.
I just think, too , there is a firewall between the two networks.
I can connect to postggis via ssh but not via mapserver (script cgi). I
really don't know who is trying to connect to PostGIS when we run a URL
via browser to mapserver.
Obe, Regina DND\MIS escreveu:
> The lines below got a bit scramled so let me restate my understanding
> 1) You were able to connect to the database via your webserver with psql
> and it was successful e.g. you saw the psql prompt and can run a select
> statement.
> 2) Your local pc is on network 10. , your database server is on 192
> (I'm assuming if this is correct you've got some sort of routing going
> on between your 10 and 192 networks)
> 3) What network is your webserver on 10?
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net]
> Sent: Wednesday, March 29, 2006 7:24 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Mapserver and Postgis
>
>
>
>
> Obe, Regina DND\MIS escreveu:
>
>> Were you able to try psql from the webserver?
>>
>>
> here network 10 (with -h parameter) and in the webserver machine
>
>> What network is your webserver on?
>>
>>
> network 192
>
>> What network is your database server on?
>>
>>
>
>
>> What network is your local pc on?
>>
>>
> network 10
>
>> I just want to rule out the issue of your database server and
>> workstation is on a private network (192.168....) so they can see
>> each other, but your webserver is on a public network 200..... Etc.
>> Because that definitely will not work. A Private ip can never be
>> accessed except by a computer on that same private network. I know
>> its obvious but just wanted to state the obvious.
>>
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net]
>> Sent: Wednesday, March 29, 2006 6:53 AM
>> To: PostGIS Users Discussion
>> Subject: Re: [postgis-users] Mapserver and Postgis
>>
>>
>>
>>
>> Obe, Regina DND\MIS escreveu:
>>
>>
>>> Is that machine your workstation or the webserver? If its not the
>>> webserver, then are you able to do the same test when logged in on
>>>
> the
>
>>>
>>>
>>
>>
>>> webserver?
>>>
>>>
>>>
>> This is my machine. I am using the -h option to connect to a
>> webserver.
>>
>>
>>> What does your pg_hba.conf on your postgresql server look like?
>>> This
>>>
>>>
>>
>>
>>> by default is in the data directory of your postgresql server. As
>>> Gregory mentioned this controls what computers are allowed to connect
>>>
>
>
>>> to the postgresql daemon.
>>>
>>>
>>>
>> My pg_hba.conf
>>
>> # TYPE DATABASE USER CIDR-ADDRESS METHOD
>>
>> # "local" is for Unix domain socket connections only
>> local all all trust
>> # IPv4 local connections:
>> host all all 10.0.0.0 255.0.0.0 password
>> host all all 172.0.0.0 255.0.0.0 password
>> host all all 192.168.0.0 255.0.0.0 password
>> host all all 127.0.0.1/32 trust
>> host all all 200.249.133.135 255.255.255.255
>> password
>> # IPv6 local connections:
>> host all all ::1/128 trust
>> host all all 192.168.0.0 255.255.0 0 password
>>
>> That's it.
>>
>>
>>> -----Original Message-----
>>> From: postgis-users-bounces at postgis.refractions.net
>>> [mailto:postgis-users-bounces at postgis.refractions.net]
>>> Sent: Tuesday, March 28, 2006 11:50 AM
>>> To: PostGIS Users Discussion
>>> Subject: Re: [postgis-users] Mapserver and Postgis
>>>
>>>
>>> Obe,
>>>
>>> Fortunately I have psql here in my machine and I tryed to connect
>>> using it.
>>>
>>> The connection was ok with your parameters psql -U postgres
>>> machine.domainmachine db
>>>
>>> Have you any suggestion ?
>>>
>>> Ezequias
>>>
>>> Obe, Regina DND\MIS escreveu:
>>>
>>>
>>>
>>>> Ezequias,
>>>>
>>>> Then I guess one thing to try would be connect into your webserver
>>>> via ssh or some other means and then do a ping on your postgresql
>>>>
>>>>
>> server.
>>
>>
>>>> That may not work depending on whether pinging is blocked or not.
>>>>
>>>> If you had a psql client on the webserver or can easily put one on,
>>>> then you can do more indepth analysis. With something like below
>>>>
>>>> psql -h myserver.mydomain.com mydb
>>>>
>>>> Also you said you logged in using ssh from your local computer to
>>>> the postgresql server. Did you try connecting to the postgresql
>>>> server via the psql client from your local pc. Just because you can
>>>>
>
>
>>>> ssh
>>>>
>>>>
>> into
>>
>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>> the postgresql server doesn't necessarily mean postgres daemon is
>>>> listening on a TCP/IP port.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: postgis-users-bounces at postgis.refractions.net
>>>> [mailto:postgis-users-bounces at postgis.refractions.net]
>>>> Sent: Tuesday, March 28, 2006 8:37 AM
>>>> To: PostGIS Users Discussion
>>>> Subject: Re: [postgis-users] Mapserver and Postgis
>>>>
>>>>
>>>> Yes, I have a root account on webserver.
>>>>
>>>> Best regards...
>>>> Ezequias
>>>>
>>>> Obe, Regina DND\MIS escreveu:
>>>>
>>>>
>>>>
>>>>
>>>>> It could be that your webserver doesn't allow outbound connections
>>>>> on 5432 because it has a firewall in front blocking. As Greg
>>>>> mentioned it sounds like you aren't connecting at all.
>>>>>
>>>>> Do you have root access to your webserver?
>>>>>
>>>>> -----Original Message-----
>>>>> From: postgis-users-bounces at postgis.refractions.net
>>>>> [mailto:postgis-users-bounces at postgis.refractions.net]
>>>>> Sent: Tuesday, March 28, 2006 8:02 AM
>>>>> To: PostGIS Users Discussion
>>>>> Subject: Re: [postgis-users] Mapserver and Postgis
>>>>>
>>>>>
>>>>> Gregory,
>>>>> Many thanks but there is notthing on the postgresql-Tue.log :-( .
>>>>>
>>>>> I can start and stop the postgresql without problem. I use
>>>>> postmaster -D
>>>>>
>>>>> way.
>>>>>
>>>>> Another thing. How can I ping using mapserver ?
>>>>> Another thing2:I can log to postgis using ssh connection (as root
>>>>> and
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>>> after as postgres user). Another thing3:There is no password to
>>>>> postgis ( linux )user. The postgis (database) user has yes a
>>>>>
>>>>>
>> password
>>
>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>>> (and I used on the map
>>>>>
>>>>>
>>>>>
>>>>>
>>>> file)
>>>>
>>>>
>>>>
>>>>
>>>>> I hope you could understand my enviroment.
>>>>>
>>>>> Ezequias
>>>>>
>>>>> Gregory S. Williamson escreveu:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Ezequias --
>>>>>>
>>>>>> What does the postgres log say ? That's a good place to start
>>>>>> debugging this.
>>>>>>
>>>>>> The text that you quoted has several very good suggestions;
>>>>>> assuming
>>>>>>
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>>>> that the connection string seems rational to you, i.e. user,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> password,
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> server and database are all sane, I would suggest making sure that
>>>>>> you
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> can can ping the postgres server from the mapserver ... if so
>>>>>>
>>>>>> Check the postgres log and see if it is refusing the connection.
>>>>>> if
>>>>>>
>>>>>>
>>
>>
>>>>>> it
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> is you need to add the postgres user (not a great idea to exposte
>>>>>> the DBA account as a working account, but that's another issue)
>>>>>> and
>>>>>>
>>>>>>
>>
>>
>>>>>> the
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> IP
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> address to the .hba file on the postres server. That file controls
>>>>>> who
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> can connect and can't; it is in the root of the directory the
>>>>>> postgres
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> database was created in.
>>>>>>
>>>>>> If there is nothing in the log I'd suspect the TCP issue, or some
>>>>>> routing issue since postgres will write a useful message if an
>>>>>> un-authorized user tries to connect. Presumably the postgres user
>>>>>> has
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>> permissions to connect to the database and access the tables.
>>>>>>
>>>>>> It is possible the postgres instance was not started with the
>>>>>> proper
>>>>>>
>>>>>>
>>>>>>
>>>
>>>
>>>
>>>>>> to allow TCP/IP connections; that is controlled by the script that
>>>>>>
>
>
>>>>>> starts the postgres database. I'm not sure if the error log would
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> show
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> anything in this case.
>>>>>>
>>>>>> HTH, post back your results and maybe others can help more.
>>>>>>
>>>>>> Greg Williamson
>>>>>> DBA
>>>>>> GlobeXplorer LLC
>>>>>> -----Original Message-----
>>>>>> From: postgis-users-bounces at postgis.refractions.net on behalf
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> of
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Ezequias Rodrigues da Rocha
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Sent: Tue 3/28/2006 4:35 AM
>>>>>> To: PostGIS Users Discussion
>>>>>> Cc:
>>>>>> Subject: [postgis-users] Mapserver and Postgis
>>>>>>
>>>>>> Hi list,
>>>>>>
>>>>>> I don't know if this is a off-topic, but as nobody from mapserver
>>>>>> could solve my problem I will report to you now.
>>>>>>
>>>>>> I am trying to connect my mapserver project to PostGIS but my
>>>>>> browser
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>> always report the folowing error:
>>>>>> msDrawMap(): Image handling error. Failed to draw layer named
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> 'bairros'.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> msPOSTGISLayerOpen(): Query error. couldnt make connection to DB
>>>>>> with connect string 'user=postgres password=***** dbname=db
>>>>>> host=xxx.xxx port=5432'. Error reported was 'could not create
>>>>>> socket: Permission denied '. This error occured when trying to
>>>>>> make
>>>>>>
>>>>>>
>>
>>
>>>>>> a connection to the specified postgresql server.
>>>>>> Most commonly this is caused by
>>>>>> (1) incorrect connection string
>>>>>> (2) you didnt specify a 'user=...' in your connection string
>>>>>> (3) the postmaster (postgresql server) isnt running
>>>>>> (4) you are not allowing TCP/IP connection to the postmaster
>>>>>> (5) your postmaster is not running on the correct port - if its
>>>>>> not
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> on
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> 5432 you must specify a 'port=...'
>>>>>> (6) the security on your system does not allow the webserver
>>>>>> (usually user 'nobody') to make socket connections to the
>>>>>>
>>>>>>
>> postmaster
>>
>>
>>>>>> (7) you forgot to specify a 'host=...' if the postmaster is on a
>>>>>> different machine
>>>>>> (8) you made a typo
>>>>>>
>>>>>> Could someone help me. As simple as possible would be very glad.
>>>>>>
>>>>>> Sincerely...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
--
Ezequias Rodrigues da Rocha
http://ezequiasrocha.blogspot.com
msn:ezequias at hotmail.com
"the worst of democracies is still better than the best of dictatorship"
More information about the postgis-users
mailing list