patternsqlMinor
finding the path to start postgres
Viewed 0 times
paththepostgresfindingstart
Problem
On my local machine, when I want to start the postgres server (postgres was installed via Homebrew), I do this
I just installed postgres on a ubuntu vps (without Homebrew and not on OSX obviously) and the files are obviously set up a little differently, however, based on what I did on the local machine to start pg, I tried to find the path to postgres folder on the vps. From my
Inside
Based on how I start pg on my local machine, I'm assuming pg_ctl.conf is the file I'm looking for. I tried to start pg this way
but I get the response
I'm assuming that I have to start the server once before launch of the app and then let it run, but I can't get it started.
Update
Once I finished installing postgres, I ran this command
I'm not sure if that starts postgres once and I never need to start it again (hence this question is moot), or if that was just something I do at install and then start it everytime I use it as I do on my local machine.
pg_ctl -D /usr/local/var/postgres -l logfile startI just installed postgres on a ubuntu vps (without Homebrew and not on OSX obviously) and the files are obviously set up a little differently, however, based on what I did on the local machine to start pg, I tried to find the path to postgres folder on the vps. From my
home/michael directory, I backed up two levels cd ../../ to a folder which contains these foldersbin etc lib mnt root selinux tmp vmlinuz
boot home lost+found opt run srv usr
dev initrd.img media proc sbin sys varInside
etc, there's a postgresql inside of which there's a 9.1 folder, inside of which is main that has all these filesenvironment pg_hba.conf postgresql.conf
pg_ctl.conf pg_ident.conf start.confBased on how I start pg on my local machine, I'm assuming pg_ctl.conf is the file I'm looking for. I tried to start pg this way
pg_ctl -D /etc/postgresql/9.1/main -l logfile startbut I get the response
-bash: pg_ctl: command not foundI'm assuming that I have to start the server once before launch of the app and then let it run, but I can't get it started.
Update
Once I finished installing postgres, I ran this command
sudo service postgresql restartI'm not sure if that starts postgres once and I never need to start it again (hence this question is moot), or if that was just something I do at install and then start it everytime I use it as I do on my local machine.
Solution
When you install a program in Linux it is most often configured to just work. So you would do
You may need to set it up that it will start automatically on boot. How to do this depends on your system version, so you may need to Google it. On my system it is
If you want to find where is data directory of a running postgres then you can use
service postgresql start to start it, service postgresql stop to stop, and service postgresql status to check if it's working etc.You may need to set it up that it will start automatically on boot. How to do this depends on your system version, so you may need to Google it. On my system it is
chkconfig postgresql on to enable, and chkconfig postgresql off to disable.If you want to find where is data directory of a running postgres then you can use
sudo su postgres -c "psql -c 'show data_directory'". You can find Postgres configuration files, logs and data there.Context
StackExchange Database Administrators Q#44125, answer score: 3
Revisions (0)
No revisions yet.