On 05/04/2016 05:26 AM, john.tiger wrote:
> On 05/03/2016 06:18 PM, Adrian Klaver wrote:
>> On 05/03/2016 05:07 PM, john.tiger wrote:
>>> our model.rb runs fine on a dev machine and a debian server but is
>>> failing on a new centos server - checked the postgres db name and user
>>> name and password - all seem fine
>>
>> The error message is?
>>
>>>
>>> could it be:
>>>
>>> host => "localhost"
>>>
>>> or maybe CORS ?
>>
>> CORS as in:
>>
>> https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
>>
>> or something else?
>>
>> Have you tried connecting using psql with same parameters?
>>
>> Have you looked at the pg_hba.conf files on the different platforms
>> and see if they differ?
>
> yeah, but we couldn't find any log file - not sure on centos where this
> should be - nothing in /var/log or /var/lib/pgsql/9.5/data
I do not use Centos so I am not sure where the logs go. You might get a
hint by logging in using psql and doing:
show log_directory ;
>
> running psql dbname="ourdb" works
> running psql dbname="ourdb" username="ouruser" ==> FATAL peer
That is failing because peer authentication is set up for connecting via
local(per pg_hba.conf below), where local is a socket connection. For
more information see:
http://www.postgresql.org/docs/9.5/interactive/auth-methods.html#AUTH-PEER
Retry the above with -h localhost or -h 127.0.0.1
> authentication failed for user"ouruser"
>
> running \l => shows db
> \du => ouruser {} ? doesn't show login although we specified that
> as when created role - could that be the problem ?? then how to add
> login to user alter role ouruser with login => still shows {}
That is normal. If you could not login you would see something like;
test=# \du test_role
List of roles
Role name | Attributes | Member of
-----------+--------------+-----------
test_role | Cannot login | {}
FYI, {} is for role membership, so something like:
test=# \du aklaver
List of roles
Role name | Attributes | Member of
-----------+------------+---------------------------------
aklaver | | {app_admin,enhanced,production}
>
> both pg_hba show:
> local all all peer
> host all all 127.0.0.1
> host all all ident
Is that all?
In particular is that the full line for the second line above?
Are there any IPv6 address?
>
>
> re cors - all on same linode server with postgres running on std port so
> don't think should be an issue and is not issue on debian server - just
> searching for possible answer
>
> here is our model
> @conn = PG.connect(
> :host => "localhost",
> :dbname => "ourdb",
> :user => "ouruser",
> :password => "ourpassword"
> )
> again, this runs fine on debian and debian dev machine
Is there a chance there is more then one instance of Postgres running on
this machine?
>
>
>
>
>>
>>
>>>
>>>
>>
>>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com