Thread: Getting started
Hey Group; I am new with Postgres. I am running openSuSE 11.3 Milestone 4 and their version of Postgresql-8.4 rpm -qa | grep postg postgresql-libs-8.4.2-4.1.i586 postgresql-8.4.2-4.1.i586 postgresql-server-8.4.2-4.1.i586 postgresql-contrib-8.4.2-4.1.i586 /etc/init.d/postresql start <-fails Where do I start? I was looking at a Postgres Docs and got this error. # sudo -u postgres psql psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? ps -ax agrees with it not running -- 73 de Donn Washburn 307 Savoy Street Email:" n5xwb@comcast.net " Sugar Land, TX 77478 LL# 1.281.242.3256 Ham Callsign N5XWB HAMs : " n5xwb@arrl.net " VoIP via Gizmo: bmw_87kbike / via Skype: n5xwbg BMW MOA #: 4146 - Ambassador " http://counter.li.org " #279316
Donn Washburn <n5xwb@comcast.net> writes: > I am new with Postgres. I am running openSuSE 11.3 Milestone 4 and > their version of Postgresql-8.4 > rpm -qa | grep postg > postgresql-libs-8.4.2-4.1.i586 > postgresql-8.4.2-4.1.i586 > postgresql-server-8.4.2-4.1.i586 > postgresql-contrib-8.4.2-4.1.i586 > /etc/init.d/postresql start <-fails Fails how, exactly? (I assume you typed the script name correctly, not as quoted above.) I'm not familiar with openSUSE's packaging, but in a lot of PG start scripts you'd need to do "/etc/init.d/postgresql initdb" before you could issue "start" the first time. I'd have expected the script to tell you so pretty clearly if that were needed, though. Another possibility is that you are trying to run the start script without being root, but hopefully that would give a clear permissions error. Really we can't do much more than guess without seeing the exact failure message. regards, tom lane
This script is started by the boot process. Therefore, I would say that no permission issues would be the problem. Yes the script has under "start" /usr/bin/initdb # /usr/bin/initdb -D /var/lib/pgsql/data/ Works! but complains about root (su) or user donn -> Permission denied So it is a permission problem. On 03/25/2010 10:00 PM, Tom Lane wrote: > Donn Washburn<n5xwb@comcast.net> writes: >> I am new with Postgres. I am running openSuSE 11.3 Milestone 4 and >> their version of Postgresql-8.4 > >> rpm -qa | grep postg >> postgresql-libs-8.4.2-4.1.i586 >> postgresql-8.4.2-4.1.i586 >> postgresql-server-8.4.2-4.1.i586 >> postgresql-contrib-8.4.2-4.1.i586 > >> /etc/init.d/postresql start<-fails > > Fails how, exactly? (I assume you typed the script name correctly, > not as quoted above.) > > I'm not familiar with openSUSE's packaging, but in a lot of PG start > scripts you'd need to do "/etc/init.d/postgresql initdb" before you > could issue "start" the first time. I'd have expected the script to > tell you so pretty clearly if that were needed, though. > > Another possibility is that you are trying to run the start script > without being root, but hopefully that would give a clear permissions > error. > > Really we can't do much more than guess without seeing the exact > failure message. > > regards, tom lane > -- 73 de Donn Washburn 307 Savoy Street Email:" n5xwb@comcast.net " Sugar Land, TX 77478 LL# 1.281.242.3256 Ham Callsign N5XWB HAMs : " n5xwb@arrl.net " VoIP via Gizmo: bmw_87kbike / via Skype: n5xwbg BMW MOA #: 4146 - Ambassador " http://counter.li.org " #279316
Donn Washburn <n5xwb@comcast.net> writes: > Works! but complains about root (su) or user donn -> Permission denied > So it is a permission problem. So try it as sudo /etc/init.d/postgresql initdb sudo /etc/init.d/postgresql start Generally, init.d scripts are expected to be run as root. regards, tom lane
After looking at /etc/init.d/postgresql there is no mention to initdb other than under start) /usr/bin/initdb. The script is a openSuSE script that only has things like start), stop) and status) which are recognized. It is not the one that likely comes with postgres. As root -> /etc/init.d/postgresql start normally. It is rather short so if you would like a copy I could send it to you. On 03/25/2010 10:40 PM, Tom Lane wrote: > Donn Washburn<n5xwb@comcast.net> writes: >> Works! but complains about root (su) or user donn -> Permission denied >> So it is a permission problem. > > So try it as > sudo /etc/init.d/postgresql initdb > sudo /etc/init.d/postgresql start > > Generally, init.d scripts are expected to be run as root. > > regards, tom lane > -- 73 de Donn Washburn 307 Savoy Street Email:" n5xwb@comcast.net " Sugar Land, TX 77478 LL# 1.281.242.3256 Ham Callsign N5XWB HAMs : " n5xwb@arrl.net " VoIP via Gizmo: bmw_87kbike / via Skype: n5xwbg BMW MOA #: 4146 - Ambassador " http://counter.li.org " #279316
Donn Washburn <n5xwb@comcast.net> writes: > After looking at /etc/init.d/postgresql there is no mention to initdb > other than under start) /usr/bin/initdb. The script is a openSuSE > script that only has things like start), stop) and status) which are > recognized. Mph. So what you've got is one of the ones that automatically fires off initdb if it doesn't see something that looks like a Postgres data directory in the right place at "start" time. This is nice in that it saves one step for newbies, but I think most distros are migrating to a separate "initdb" action for that. There have been a couple of well-publicized catastrophes wherein somebody's database got trashed by a start script mistakenly firing up initdb, so people are now taking the view that auto-initdb is more risk than it's worth. I'd counsel against using an auto-initdb start script if you have the database on any sort of external storage (particularly NFS/SAN), but if it's on the same drive as the OS then it's probably safe enough. Just FYI. > It is not the one that likely comes with postgres. There isn't really a "standard" init script for Postgres; every distro rolls their own. regards, tom lane
Tom, speaking of the init scripts, I really like Ubuntu variety which also includes the version. I am scratching my head what to do with a Red Hat 8.3.8 version and how to migrate it to 8.4, because setting up 2 homes and using a migrator is a pain. I would recommend emulating Ubuntu structure from the scratch on Red Hat and split everything into /var/lib/postgres/8.x and /etc/postgres/8.x, with the init scripts reflecting that. Tom Lane wrote: > Donn Washburn <n5xwb@comcast.net> writes: > >> After looking at /etc/init.d/postgresql there is no mention to initdb >> other than under start) /usr/bin/initdb. The script is a openSuSE >> script that only has things like start), stop) and status) which are >> recognized. >> > > Mph. So what you've got is one of the ones that automatically fires off > initdb if it doesn't see something that looks like a Postgres data > directory in the right place at "start" time. This is nice in that > it saves one step for newbies, but I think most distros are migrating > to a separate "initdb" action for that. There have been a couple of > well-publicized catastrophes wherein somebody's database got trashed by > a start script mistakenly firing up initdb, so people are now taking the > view that auto-initdb is more risk than it's worth. I'd counsel against > using an auto-initdb start script if you have the database on any sort > of external storage (particularly NFS/SAN), but if it's on the same > drive as the OS then it's probably safe enough. Just FYI. > > >> It is not the one that likely comes with postgres. >> > > There isn't really a "standard" init script for Postgres; every distro > rolls their own. > > regards, tom lane > > -- Mladen Gogala Sr. Oracle DBA 1500 Broadway New York, NY 10036 (212) 329-5251 http://www.vmsinfo.com The Leader in Integrated Media Intelligence Solutions
It appears SuSE's init.d/postgresql has the directories screwed up. What are the correct directories that postgres uses. Is it pgsql or postgresql /var/lib/mysql is where it stores it's data. On 03/26/2010 02:29 PM, Tom Lane wrote: > Donn Washburn<n5xwb@comcast.net> writes: >> After looking at /etc/init.d/postgresql there is no mention to initdb >> other than under start) /usr/bin/initdb. The script is a openSuSE >> script that only has things like start), stop) and status) which are >> recognized. -- 73 de Donn Washburn 307 Savoy Street Email:" n5xwb@comcast.net " Sugar Land, TX 77478 LL# 1.281.242.3256 Ham Callsign N5XWB HAMs : " n5xwb@arrl.net " VoIP via Gizmo: bmw_87kbike / via Skype: n5xwbg BMW MOA #: 4146 - Ambassador " http://counter.li.org " #279316