last day (16 days later) » 

10:06 AM
0
Q: cannot create PostgreSQL server db

doniyorI am trying to creata a new database in remote server. I have installed postgresql using apt-get install postgresql but when I try to create a new db in Paralells, I am getting: Error: Connection to the database server has failed because of network problems: could not connect to server...

 
it seems you have network problem. ping host ip and check that postgresql port(5432) is open
 
@HasanRamezani i did, packets are being transfered fine
 
are you sure that postgres port(5432) is open? maybe firewall block your packet. you can check it by telnet to port 5432.
what command you use to connect to postgresql server?
 
@HasanRamezani i am trying to create db for my django project in paralells. postgres is listening to 5432.
@HasanRamezani if I do: psql, it says: psql: FATAL: role "root" does not exist
 
because postgresql does not have user root. try psql -U username db_name
 
10:07 AM
Hi, i am getting from my djangosite this errormessage:
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
 
djago site is running on the same server with postgresql?
 
yes
 
please try this command on server .
telnet localhost 5432
and paste result for me
 
just inside the ssh shell right?
 
10:14 AM
Trying 127.0.0.1...
Connected to localhost.localdomain.
so the port is fine?
 
exit from telnet shell
yes
when you get error(OperationalError: could not connect to server: No such file or directory )
?
 
look, no i just commented out every change i did inside postgres.conf and pg_hba.conf
now i am only getting:
OperationalError: FATAL: Peer authentication failed for user "bibago_db"
shit
i am not able to creata a db from paralells
 
create db from shell
 
oh thats possible?
 
yes
first change your user to postgres user with command (su postgres or su -postgres)
and create db with command (createdb db_name)
 
10:21 AM
root@server1:/etc/postgresql/9.1/main# su postgres
postgres@server1:/etc/postgresql/9.1/main$ createdb bibago_db
Password:
createdb: could not connect to database postgres: FATAL: password authentication failed for user "postgres"
postgres@server1:/etc/postgresql/9.1/main$
what is the password of postgres? i didnot set any
 
please send your pg_hba.conf for me via email
my email : hasan.r67@gmail.com
or paste it here
 
how can i copy the content of it?
i am in shell
everything inside this file is commented out, only this line is active:

local all postgres peer
may be, i will change peer to trust?
 
yes
chage peer to trust
and reload postgres service
 
what is the password of postgres?
it is still asking for it
 
/etc/init.d/postgresql reload
first reload service
 
10:30 AM
i even restarted it
 
still asking for password?
 
yees
i hate debian
 
:D
can i ssh to your server?
 
this is not my server, i have to ask the owner for it :(
sorry
if i do:
ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432

it says, the file .s.PGSQL.5432 already exists
 
run this
sudo -u postgres psql
and tel me what happend?
if still want password
change trust to peer in pg_hba.conf
and reload service postgres.
and try again command (sudo -u postgres psql)
 
10:51 AM
oh ok
do you know Paralells?
a kind of cpanel
 
no i dont know
i have a little information about postgresql and linux system administration
 
oh you are helping me though
 
what happend when you run above command?
 
command not found
-u
i am already root, i dont need sudo right?
 
yes
chage user to postgres
and run psql
 
11:03 AM
yeah it is still asking for password
what the hell
what is the password of postgres actually?
 
what about it psql template1?
 
what is template1?
 
postgres template db
did you change trust to peer in pg_hba.conf?
 
yeas
i did
it reeaaaaly sucks
 
dont worry we fix int
what happend with psql template1?
 
11:08 AM
look
i changed the password of postgres with "passwd postgres"
yiha
now i try to createdb
bullshit, again:
"createdb: could not connect to database postgres: FATAL: password authentication failed for user "postgres"
"
 
with what command you change postgres user password?
 
passwd postgres
is it dangerous?
 
yes
please try "psql -U postgres template1"
look use(-U)
 
oh ok
 
whats happend?
 
11:17 AM
wait a sec, i think i almost got it.
i need to give:
ln -s /var/run/postgresql/.s.PGSQL.5432 /tmp/.s.PGSQL.5432
 
i dont think this helps you
 
yeah i didnot help
ok i will run your code
asking for postgres password again
 
that is strange!!
please check again
1-
 
man
it worked
honestly, i dont know what i did
but it worked :D
yiha
 
11:31 AM
dude
thank you so much
 
your welcome
 
oh no :((
it was mysql
shit .(((
 
:D
check following
1- are you sure this line exists in pg_hba.cof (local all postgres peer)
 
look. lets locate the problem first.
 
2-if it exists change user to postgres
 
11:35 AM
my paralells is saying, he doesnot have access to postgresql at all
so he can create database.
 
no you must create database
and give access to parallels
 
No, i create db always thru paralells
parallels says: Is the server running on host "xxxx.com" (212.227.214.203) and accepting TCP/IP connections on port 5432?
now i think, that postgres is running on different server? because 212.227.. is not the IP of webserver
 
maybe
do you know this machine ip?
postgres running on machine that you connected to ?
 
i think, this is the point
where the problem lies
the ip of webserver is: 148.251.155.227
 
check parallesl config for database
shit
 
11:41 AM
paralells runs on 148.251.155.227:8443
the same server, right?
 
and where is 212.227.214.203?
 
very great question!!
this is why the whole shit is happening
 
nooww, i looked up this IP, it is on different server :D
bullshit
 
11:44 AM
which means, parallels tries to create db on 212... which is totally different server where postgresql doesnot exist at all
does this make sense?
 
i dont know
check parallels config
 
i am almost sure, that this is the problem well
 
yes , and me too
 
because, if 212... were on the same server or if 212.. were also 148.... which is the same server as webserver, then parallels can also create without any problems, because it has access to postgresql
i am sooo dumb
i spent the whole day on this shit
thank you so much.
just a question: you are from iran?
 
11:47 AM
are you also a tech? or dev?
 
i am a developer
 
cool
 
python & php
 
in what language and what scope?
wow cool
 
and you?
 
11:48 AM
i love python
me too. i am core python and django developer
 
me too :)
 
also django?
 
wow
nice
 
are you use window?
 
11:49 AM
yep, i use mostly windows at work,
 
but i use linux
 
but also linux stuff everyday while deploying and so
oh also at home?
 
yeah every where :)
 
nice.
which version?
14
ubuntu 14
 
no
debian 7
 
11:51 AM
i have
oh cool.
 
:D
and some time arch
 
i dont really use much linux, because i develop in windows
i mean, i always use virtualenv, so i am secure from outer world
:D
 
:D
most of developer in iran user windows
and C#
 
did you jump to django1.7 already?
 
11:53 AM
oh cool.
i am in 1.4 still.
 
i dont know. never dared to switch. i will switch these days to 1.6. not to 1.7
1.7 is a little bit instable
what IDE do you use?
 
i use 1.7 in a new project that i start a few days ago and still work fine
i have no IDE :D
i use vim
 
what? really?
 
linux shell base text editor
 
11:55 AM
:D
 
why? you like typing everything on your own? :D
i use PyCharm, do you know it?
 
no :D
my music player , video player is also shell base
:D
 
what? :D
maaan, you are a real developer
 
and i have no file manager in may computer
:D
 
11:57 AM
whaaat?
how do you use musicplayer in shell?
 
mpd is music pleayer daemon
and ncmpcpp is its client
 
haha, very cool
didnot know that
 
thx dude
do you know awesome?
 
no, what is that?
 
windows manager
 
12:01 PM
oh no,
what do you use it for?
 
it is comfortable for me
give me some desktop
 
oh really
you use this?
 
and i can manage my shell
yes dude
 
wow
is it free ?
 
yeah
completly free
 
12:02 PM
and you can run anything on it?
 
you can customize it with lua scripts
yes
 
it is just a explorer right?
 
my visual things is only my browser
:D
 
haha, this is very cool
why do you like it?
 
it is light
 
12:04 PM
oh yeah?
so good for pc?
 
yeah
it is on demand
first that you install it
it han no battery notifier and so many thinngs :D
 
:D
also eats less battery life?
 
yeah
my laptop boot very very fast
 
wow. look, i am reading about this. it says:
"It is primarly targeted at power users, developers and any people dealing with every day computing tasks and who want to have fine-grained control on theirs graphical environment."
 
exactly
 
12:07 PM
wow, cool stuff. didnot know that
 
in linux you can select your windows manager
and there are many light window manager
 
yeaah you are right.
:D
 
sick
do you also use virtualenv?
 
yeah
and i user docker
do you know docker?
 
12:12 PM
no
also like virtualenv?
 
it is a linux tools
better than virtualenv
 
is it this?
really?
 
yes
it is a tools for any language
 
woow
wow man, you giving me fantastic informations
do you know fabric ?
 
12:15 PM
is it like fabric?
 
it is a deployment tools
no
it is like virtual box
 
oh, fabric is only deployment tool, right?
oh ok. cool
 
it user for both develop and deployment
 
you mean docker?
 
12:17 PM
do you need to push docker as a folder to server, if you want to deploy?
 
docker is like a virtual machine
 
with what os?
 
and you must deploy your machine image for deployment
 
anyone you want?
 
any linux distru
 
12:18 PM
oh ok, i get it.
so which means: you can deploy your djangoproject to an empty server without OS?
because docker has all inside?
 
docker has image repo
 
oh o k
 
so you just pull that repo into server
 
12:20 PM
is it used actively?
by many developers?
 
no
only some open source developer use this
 
oh ok
but i like it
 
we have a comminuty in tehran(capital of iran)
 
it means: i can buy just an empty server to deploy my project, right?
 
12:22 PM
and use docker repo
it can be very cheap option
 
i just need HDD and RAM in empty server
 
and a base os
 
all the other stuff comes from docker
 
12:23 PM
why base os? docker has the os?
 
no
docker use base os kernel
 
oh ok.
 
docker is a virtual machine that use host machine kernel
 
aah ok
now i get it
but cool thing anyway
 
yes
how much is your sallary per month?
 
12:26 PM
i am a fresh graduate student in a company. which means, i dont get much salary. monthly around 2600€.
 
and i get 1000$ per month
 
as a django develloper?
you work fulltime?
 
from 9 to 17
yes in iran this is fulltime
 
you me too
just 8 hours
 
and my sallary is good in iran
 
12:29 PM
1000$ is good enough?
 
better than average
yes
 
nice
 
dollar is very expensive in iran
 
really?
 
12:30 PM
cool
 
with this sallary i can live good as a student and save a lot of mony :D
 
thats nice
2600€ isnot enough here in germany
 
yes
my friends work remotly with germany company
and get 4000$
and it is a good sallary for who live in iran
 
oh yeah
he is also a dev?
 
12:40 PM
Thanks Hasan
i need to go now
 
your welcome
 
wish you good day
 
you too
 
bye
 
nice to meet you
bye
 

  last day (16 days later) »