Installing PostgreSQL is creating empty data folder - postgresql

I'm trying to install PostgreSQL form ToolShed on my windows machine.
Everytime I run the intaller as admin it fails with errors.
Failed to load SQL modules into the database cluster.
Problem running post-install step. Installation may not complete correctly
Error reading file C:/Program Files/PostgreSQL/11/data/postgresql.conf
I see the C:/Program Files/PostgreSQL/11/data folder is empty.
So I execute initdb, which is loading data folder with some files
and try to start server using
pg_ctl -D C:/Program Files/PostgreSQL/11/data -l logfile start
I get below error.
waiting for server to start....Access is denied.
stopped waiting
pg_ctl: could not start server
Tried v11/13/15 same issue with all of them.
Thanks

Related

Unable to connect to server postgresql error

I am not able to connect to postgresql server. The connection was working fine till yesterday, but since today morning I am having this issue. I installed postgres using homebrew, and have already uninstalled and reinstalled it. Below is the screenshot from pgAdmin 4:
I am not able to find postgresql.conf and pg_hba.conf as multiple solutions suggested to change listen_addresses. I see that postgresql is installed, this is the location: /opt/homebrew/Cellar/postgresql#14. I have tried solutions from:
How can I start PostgreSQL server on Mac OS X?
but almost for all commands I am getting the error:
WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.
If I try to change the location in command(https://stackoverflow.com/questions/7975556/how-can-i-start-postgresql-server-on-mac-os-x#:~:text=I%20start%20the-,PostgreSQL,-server%3F) to start the server, I get the error: pg_ctl: directory "/opt/homebrew/postgres_db_cluster" does not exist.
The worst part is that it was working all good till yesterday.
Any help is appreciated.
Edit 1: As suggested in comments , I followed the steps from https://wiki.postgresql.org/wiki/Homebrew, but still getting the error.
Step 1: brew services restart postgresql#14
==> Successfully stopped postgresql#14 (label: homebrew.mxcl.postgresql#14)
==> Successfully started postgresql#14 (label: homebrew.mxcl.postgresql#14)
Step 2: psql postgrespsql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Edit 2:
I tried the first step from this solution: https://stackoverflow.com/questions/7975556/how-can-i-start-postgresql-server-on-mac-os-x?rq=1#:~:text=on%20port%205432%3F-,Update,-3%3A
below is the result:
abhinash.kumar# ~ % pg_ctl -D /usr/local/var/postgres status
pg_ctl: directory "/usr/local/var/postgres" is not a database cluster directory.
also, the link mentions a file pg_hba.conf.sample, but I cannot find that in my system.
Edit 3: Starting postgres server using homebrew
abhinash.kumar# ~ % brew services start postgresql#14
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/abhinash.kumar/Library/LaunchAgents/homebrew.mxcl.postgresql#14.plist` exited with 5.
continues to throw errors.
Thanks to https://stackoverflow.com/users/7070613/adrian-klaver, the problem is now fixed.
I uninstalled postgres, and reinstalled using homebrew. In addition, I ran this command:
initdb -D /usr/local/var/postgres/.
and this fixed the issue, and I am able to create the db connection using pgAdmin 4.

PostgreSQL installation "Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed"

I recently uninstalled PostgreSQL 14.2 from my windows 10 computer. When I attempted to reinstall I run into the error: Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed.
On the install log I find this error:
Executing batch file 'rad27DAB.bat'...
initdb: error: The program "postgres" was found by "C:/Program Files/PostgreSQL/14/bin/initdb.exe"
but was not the same version as initdb.
Check your installation.
Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb
However checking initdb.exe -V and postgres -V both return 14.2.
Before uninstalling postgres I had messed around with the console code page and from what I can find this could be an error, but I am not sure if there is an easy fix.
I believe this error prevents postgresql from being added to my services so it cannot run.

Macbook M1 - Postgres Installation - "/tmp/.s.PGSQL.5432" - Failure while executing; `/bin/launchctl bootstrap

I just got a new Macbook Pro M1 and have been trying to install Postgres with homebrew. After trying a bunch of different approaches from installing different versions of Postgres to trying rm /usr/local/var/postgres/postmaster.pid I've had no luck. I am at the point now where I can't even successfully install Postgres without an error message. When I uninstall and then reinstall use brew install postgres I get:
➜ ~ brew install postgres
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/manifests/14.1_1
Already downloaded: /Users/landonlapensee/Library/Caches/Homebrew/downloads/34e850b9c47867f84334b48fe844f7a171369d777b5c118a4119297f7c215147--postgresql-14.1_1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/blobs/sha256:027c8b48406c3d732241426e0f5d2caf9f48cb4d2d38610b8f5d46f0adf7a89f
Already downloaded: /Users/landonlapensee/Library/Caches/Homebrew/downloads/b74d7a88df70e29d3cd5714896c2dd5b16a1e8c01188164026a4b5762f18234b--postgresql--14.1_1.monterey.bottle.tar.gz
==> Pouring postgresql--14.1_1.monterey.bottle.tar.gz
==> /usr/local/Cellar/postgresql/14.1_1/bin/initdb --locale=C -E UTF-8 /usr/local/var/postgres
Last 15 lines from /Users/landonlapensee/Library/Logs/Homebrew/postgresql/post_install.01.initdb:
Data page checksums are disabled.
fixing permissions on existing directory /usr/local/var/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... America/Vancouver
creating configuration files ... ok
running bootstrap script ... 2021-12-07 10:07:39.032 PST [52558] FATAL: could not create shared memory segment: Cannot allocate memory
2021-12-07 10:07:39.032 PST [52558] DETAIL: Failed system call was shmget(key=1895806, size=56, 03600).
2021-12-07 10:07:39.032 PST [52558] HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMALL parameter. You might need to reconfigure the kernel with larger SHMALL.
The PostgreSQL documentation contains more information about shared memory configuration.
child process exited with exit code 1
initdb: removing contents of data directory "/usr/local/var/postgres"
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall postgresql
==> Caveats
To migrate existing data from a previous major version of PostgreSQL run:
brew postgresql-upgrade-database
This formula has created a default database cluster with:
initdb --locale=C -E UTF-8 /usr/local/var/postgres
For more details, read:
https://www.postgresql.org/docs/14/app-initdb.html
To restart postgresql after an upgrade:
brew services restart postgresql
Or, if you don't want/need a background service you can just run:
/usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres
==> Summary
🍺 /usr/local/Cellar/postgresql/14.1_1: 3,304 files, 43.9MB
==> Running `brew cleanup postgresql`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Then if I run brew services start postgres I get:
➜ ~ brew services start postgres
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/landonlapensee/Library/LaunchAgents/homebrew.mxcl.postgresql.plist` exited with 5
If I run psql I get:
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/landonlapensee/Library/LaunchAgents/homebrew.mxcl.postgresql.plist` exited with 5.
➜ ~ psql
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
And if I run ➜ ~ rm /usr/local/var/postgres/postmaster.pid I get:
rm: /usr/local/var/postgres/postmaster.pid: No such file or directory
I am so lost on this issue. I am trying to set this up to use for a ruby on rails environment. Does anybody know what could be causing this issue? (I tried so many different threads/commands that I think I have created root files that are causing conflicts)
Or does anybody of any suggestions of any paid services that could walk me through fixing this?
BIG THANKS!
I had the same problem. Apparently it did not start the server after reinstalling because there was another server, postgresql#13 (the previous version before updating) still running. I killed the process and then it started the updated server.

Citus 10.2 not starting an instance of PostgreSQL

I'm using RHEL 8.4 and I followed the installation instruction at Set up a single-node Citus cluster on your own Linux machine from RPM packages..
Step 1 and 2 (Install PostgreSQL 14 and the Citus extension and Initialize the Cluster) went through without any issues.
But When I tried (Step 3: Start the database server)
pg_ctl -D citus -o "-p 9700" -l citus_logfile start
I got the following error in terminal
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
The log output
FATAL: could not access file "citus": No such file or directory
LOG: database system is shut down
I do have a directory 'citus' in postgres user's home directory with all required files in it along with postgresql.conf
Kindly help.
It appears you ran into one of 2 issues:
Possible issue #1:
You did not successfully install citus package and the citus.so file is missing.
Can you see the file /usr/pgsql-14/lib/citus.so that should be installed via the package citus102_14?
If that is not the case, you should figure out why the package is not installed.
Possible issue #2
You do not run pg_ctl command in the home directory of postgres user.
I was getting the same error. I am using the Postgres compiled from the source file. Thus, instead of
sudo apt-get -y install postgresql-14-citus-10.2
I compiled the source of the Citus from Github and specified the path to location of my Postgres while configuring as:
git clone https://github.com/citusdata/citus.git
cd citus
./configure --prefix=/usr/local/pgsql/
make
sudo make install
I do not get an error during pg_ctl start and I can load extension as CREATE EXTENSION citus;.

`Invalid format for configuration file` when trying to connect to a local orientdb database

I'm running Ubuntu 16.04 and have all the orientdb relevant files in /opt/orientdb.
So, first I open a console and run sudo bash /opt/orientdb/bin/server.sh, which works fine.
Then i open a separate console and try to sudo bash /opt/orientdb/bin/console.sh, which works fine as well.
And then from the console I try to connect plocal:/opt/orientdb/databases/VehicleHistoryGraph user password and get an error:
Error: com.orientechnologies.orient.core.exception.ODatabaseException: Cannot open database 'VehicleHistoryGraph'
Error: com.orientechnologies.orient.core.exception.OStorageException: Invalid format for configuration file /opt/orientdb/bin/../databases/VehicleHistoryGraph/database.ocf for storageVehicleHistoryGraph
Is there a way for me to fix the configuration file?
ETA: downloading and unzipping a public database over the version that I had didn't fix the issue.
ETA: GratefulDeadConcerts and Tolkien-Arda work just fine.