I am trying to run MongoDB by running brew services start mongodb-community#4.2 but I am getting the error that you see below:
jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community#4.2
==> Tapping homebrew/services
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 27 (delta 0), reused 16 (delta 0), pack-reused 0
Unpacking objects: 100% (27/27), done.
Checking connectivity... done.
Tapped 0 formulae (63 files, 276K)
Error: Unknown command: services
jaimes-mbp:SMR jaimemontoya$
Isn't brew the command, and services only a parameter? I am not understanding why the error says that services is an unknown command. Thank you.
UPDATE 1: I see two warnings when I try to run brew install mongodb-community#4.2 again. Maybe that has something to do with the problem?:
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community#4.2
Warning: mongodb/brew/mongodb-community-4.2.3 already installed
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
UPDATE 2: When I use mongo, it is doing something:
jaimes-mbp:SMR jaimemontoya$ mongo
MongoDB shell version v4.2.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-03-13T06:41:22.073-0600 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2020-03-13T06:41:22.076-0600 F - [main] exception: connect failed
2020-03-13T06:41:22.076-0600 E - [main] exiting with code 1
jaimes-mbp:SMR jaimemontoya$
Maybe I do not need to use brew services start mongodb-community#4.2? I thought it was necessary to run MongoDB Community Edition.
UPDATE 3: I run ps aux | grep -v grep | grep mongod and it returns nothing. I am trying to verify that MongoDB is running, so I am searching for mongod in my running processes but it returns nothing, meaning that MongoDB is not running I guess.
UPDATE 4: See what happens when I run brew doctor --verbose:
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.
Warning: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
When I run sudo chown -R $(whoami):admin /usr/local, I get this:
jaimes-mbp:SMR jaimemontoya$ sudo chown -R $(whoami):admin /usr/local
Password:
chown: /usr/local: Operation not permitted
jaimes-mbp:SMR jaimemontoya$
brew update is not working:
jaimes-mbp:SMR jaimemontoya$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
jaimes-mbp:SMR jaimemontoya$
Seems like you are facing issue with brew.
Run brew doctor --verbose to check if the brew is working fine.
And then brew update to update the brew version.
After this run, brew services list to display all the services in the brew.
If you see mongodb-community#4.2 there in the list, then run brew services start mongodb-community#4.2
It should work.
I followed the advice MikeMcQuaid provided at https://github.com/Homebrew/brew/issues/3665:
You need to uninstall and install Homebrew using
https://github.com/Homebrew/install
As explained at https://github.com/Homebrew/install, I first ran /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)". After that I ran /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)".
Then I ran this:
jaimes-mbp:SMR jaimemontoya$ brew tap mongodb/brew
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Tapping mongodb/brew
Cloning into '/usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew'...
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 145 (delta 41), reused 21 (delta 10), pack-reused 59
Receiving objects: 100% (145/145), 30.18 KiB | 2.16 MiB/s, done.
Resolving deltas: 100% (68/68), done.
Tapped 6 formulae (33 files, 83.0KB).
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community#4.2
==> Installing mongodb-community from mongodb/brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.3.tgz
######################################################################## 100.0%
==> Caveats
To have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
πΊ /usr/local/Cellar/mongodb-community/4.2.3: 21 files, 304.3MB, built in 1 minute 54 seconds
jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community#4.2
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 691 (delta 31), reused 69 (delta 25), pack-reused 603
Receiving objects: 100% (691/691), 192.79 KiB | 1.68 MiB/s, done.
Resolving deltas: 100% (270/270), done.
Tapped 1 command (39 files, 266.3KB).
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
jaimes-mbp:SMR jaimemontoya$ ps aux | grep -v grep | grep mongod
jaimemontoya 17763 0.1 0.2 5544164 38300 ?? S 8:11AM 0:00.65 /usr/local/opt/mongodb-community/bin/mongod --config /usr/local/etc/mongod.conf
jaimes-mbp:SMR jaimemontoya$
It works!
Related
I installed Minikube on my Debian 10, but when I try to start it, I
get these errors:
$ minikube start
* minikube v1.25.2 on Debian 10.1
* Unable to pick a default driver. Here is what was considered, in preference order:
- docker: Not healthy: "docker version --format {{.Server.Os}}-{{.Server.Version}}" exit status 1: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/version: dial unix /var/run/docker.sock: connect: permission denied
- docker: Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker' <https://docs.docker.com/engine/install/linux-postinstall/>
- kvm2: Not healthy: /usr/bin/virsh domcapabilities --virttype kvm failed:
error: failed to get emulator capabilities
error: invalid argument: KVM is not supported by '/usr/bin/qemu-system-x86_64' on this host
exit status 1
- kvm2: Suggestion: Follow your Linux distribution instructions for configuring KVM <https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/>
* Alternatively you could install one of these drivers:
- podman: Not installed: exec: "podman": executable file not found in $PATH
- vmware: Not installed: exec: "docker-machine-driver-vmware": executable file not found in $PATH
- virtualbox: Not installed: unable to find VBoxManage in $PATH
I added my user to the docker group using:
sudo usermod -aG docker $USER
and I insalled kvm without any apparent problems as far as I understand:
kvm --version
QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-8~deb10u1)
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers
$ lsmod | grep kvm
kvm 729088 0
irqbypass 16384 1 kvm
$ sudo virsh list --all
Id Name State
-----------------------------
1 debian10-MK running
What could be the problem and solution then?
Thanks,
Tamar
I have the following shell script which I am running in UserData section of a CloudFormation template:
#!/bin/sh
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt-get update
apt-get install -y mongodb-org
apt install mongodb-clients
systemctl start mongod
systemctl status mongod
systemctl enable mongod
echo "ABOUT TO ENTER WHILE LOOP"
while :
do
echo "waiting to RUN MONGO COMMANDS"
echo "$(systemctl show -p ActiveState --value mongod)"
if [ "$(systemctl show -p ActiveState --value mongod)" = "active" ]
then
echo "RUNNING MONGO COMMANDS"
mongo crawler --eval "db.websites.insertOne({ customerId: '1', url: 'https://dootli.com' })"
mongo crawler --eval "db.createUser({ user: 'username', pwd: 'password', roles: 'clusterAdmin' })"
break
fi
done
As far I can tell the script is valid, how I'm getting the this output (and error) when it is run during the initialization of the EC2 instance:
Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
mongodb-database-tools
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
libboost-filesystem1.71.0 libboost-iostreams1.71.0
libboost-program-options1.71.0 libgoogle-perftools4 libpcrecpp0v5
libsnappy1v5 libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools
The following packages will be REMOVED:
mongodb-org mongodb-org-database-tools-extra mongodb-org-mongos
mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
libboost-filesystem1.71.0 libboost-iostreams1.71.0
libboost-program-options1.71.0 libgoogle-perftools4 libpcrecpp0v5
libsnappy1v5 libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb-clients
0 upgraded, 10 newly installed, 6 to remove and 87 not upgraded.
Need to get 35.2 MB of archives.
After this operation, 44.4 MB disk space will be freed.
Do you want to continue? [Y/n] Abort.
β mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2021-02-06 20:38:12 UTC; 15ms ago
Docs: https://docs.mongodb.org/manual
Main PID: 2738 (mongod)
Memory: 288.0K
CGroup: /system.slice/mongod.service
ββ2738 /usr/bin/mongod --config /etc/mongod.conf
Feb 06 20:38:12 ip-172-31-64-168 systemd[1]: Started MongoDB Database Server.
Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service β /lib/systemd/system/mongod.service.
ABOUT TO ENTER WHILE LOOP
waiting to RUN MONGO COMMANDS
RUNNING MONGO COMMANDS
MongoDB shell version v4.4.3
connecting to: mongodb://127.0.0.1:27017/crawler?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
MongoDB shell version v4.4.3
connecting to: mongodb://127.0.0.1:27017/crawler?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
Cloud-init v. 20.3-2-g371b392c-0ubuntu1~20.04.1 running 'modules:final' at Sat, 06 Feb 2021 20:37:42 +0000. Up 27.35 seconds.
ci-info: no authorized SSH keys fingerprints found for user ubuntu.
Cloud-init v. 20.3-2-g371b392c-0ubuntu1~20.04.1 finished at Sat, 06 Feb 2021 20:38:12 +0000. Datasource DataSourceEc2Local. Up 56.97 seconds
I modified the code to work. I identified that the main issue is mongodb-clients which causes failures of monogdb. Also your command db.createUser is invalid and will lead to failure as well. I did not fix that, as its not related to your issue about connection refused. You can make new question why your db.createUser is incorrect (I don't know how to fix that, its mongodb specific).
#!/bin/sh
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt update
apt install -y mongodb-org
systemctl enable mongod
systemctl start mongod
echo "ABOUT TO ENTER WHILE LOOP"
while :
do
echo "waiting to RUN MONGO COMMANDS"
sleep 5
echo "$(systemctl show -p ActiveState --value mongod)"
if [ "$(systemctl show -p ActiveState --value mongod)" = "active" ]
then
echo "RUNNING MONGO COMMANDS"
mongo crawler --eval "db.websites.insertOne({ customerId: '1', url: 'https://dootli.com' })"
[ $? != 0 ] && continue
echo "db.websites.insertOne command successful"
break
fi
done
I've just sit down to my work, forgetting that I've upgraded brew in the 2020 β so of course I have a postgresql problem.
The last version I had was 12.x. Now I have 13.1 installed:
$ brew info postgres
Warning: Treating postgres as a formula. For the cask, use homebrew/cask/postgres
postgresql: stable 13.1 (bottled), HEAD
Object-relational database system
https://www.postgresql.org/
/usr/local/Cellar/postgresql/13.1 (3,217 files, 42.6MB) *
Poured from bottle on 2020-12-26 at 14:36:54
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/postgresql.rb
License: PostgreSQL
==> Dependencies
Build: pkg-config β
Required: icu4c β, krb5 β, openssl#1.1 β, readline β
==> Options
--HEAD
Install HEAD version
==> 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/13/app-initdb.html
To have launchd start postgresql now and restart at login:
brew services start postgresql
Or, if you don't want/need a background service you can just run:
pg_ctl -D /usr/local/var/postgres start
==> Analytics
install: 181,394 (30 days), 574,628 (90 days), 1,984,700 (365 days)
install-on-request: 176,623 (30 days), 554,629 (90 days), 1,910,250 (365 days)
build-error: 0 (30 days)
Following the output, I'm trying to run brew postgresql-upgrade-database, but it does not work βΒ here is the output:
$ brew postgresql-upgrade-database --debug --verbose
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/postgresql.rb
==> Upgrading postgresql data from 12 to 13...
/usr/local/Cellar/postgresql#12/12.5/bin/pg_ctl -w -D /usr/local/var/postgres start
waiting for server to start....2021-01-04 17:37:33.282 CET [8190] FATAL: database files are incompatible with server
2021-01-04 17:37:33.282 CET [8190] DETAIL: The database cluster was initialized with PG_CONTROL_VERSION 1300, but the server was compiled with PG_CONTROL_VERSION 1201.
2021-01-04 17:37:33.282 CET [8190] HINT: It looks like you need to initdb.
2021-01-04 17:37:33.282 CET [8190] LOG: database system is shut down
stopped waiting
pg_ctl: could not start server
Examine the log output.
==> Moving postgresql data from /usr/local/var/postgres to /usr/local/var/postgres.old...
==> Creating database...
/usr/local/opt/postgresql/bin/initdb /usr/local/var/postgres
The files belonging to this database system will be owned by user "nyc".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
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 ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Europe/Warsaw
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/local/opt/postgresql/bin/pg_ctl -D /usr/local/var/postgres -l logfile start
==> Migrating and upgrading data...
/usr/local/opt/postgresql/bin/pg_upgrade -r -b /usr/local/Cellar/postgresql#12/12.5/bin -B /usr/local/opt/postgresql/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres -j 4
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
The source cluster was not shut down cleanly.
Failure, exiting
Error: Upgrading postgresql data from 12 to 13 failed!
==> Removing empty postgresql initdb database...
==> Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/var/postgres...
Error: Failure while executing; `/usr/local/opt/postgresql/bin/pg_upgrade -r -b /usr/local/Cellar/postgresql#12/12.5/bin -B /usr/local/opt/postgresql/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres -j 4` exited with 1.
/usr/local/Homebrew/Library/Homebrew/utils.rb:303:in `safe_system'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/postgresql-upgrade-database.rb:126:in `block in postgresql_upgrade_database'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:318:in `block in cd'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:318:in `chdir'
/usr/local/Homebrew/Library/Homebrew/extend/pathname.rb:318:in `cd'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/postgresql-upgrade-database.rb:125:in `postgresql_upgrade_database'
/usr/local/Homebrew/Library/Homebrew/brew.rb:124:in `<main>'
How can I fix this?
When I run vagrant ssh and login successfully then try the ~$psql command, I get this error: Error: You must install at least one postgresql-client-<version> package.
I saw a similar question here and I ran this command:
~$ sudo apt-get install postgresql-client
The output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libpq5 postgresql-client-9.1
Suggested packages:
postgresql-9.1 postgresql-doc-9.1
The following NEW packages will be installed:
libpq5 postgresql-client postgresql-client-9.1
0 upgraded, 3 newly installed, 0 to remove and 66 not upgraded.
Need to get 1,057 kB/1,063 kB of archives.
After this operation, 3,448 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libpq5 amd64 9.1.5-0ubuntu12.04
404 Not Found [IP: 91.189.91.23 80]
Err http://security.ubuntu.com/ubuntu/ precise-security/main libpq5 amd64 9.1.5-0ubuntu12.04
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com/ubuntu/ precise-security/main postgresql-client-9.1 amd64 9.1.5-0ubuntu12.04
404 Not Found [IP: 91.189.88.149 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/postgresql-9.1/libpq5_9.1.5-0ubuntu12.04_amd64.deb 404 Not Found [IP: 91.189.88.149 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/postgresql-9.1/postgresql-client-9.1_9.1.5-0ubuntu12.04_amd64.deb 404 Not Found [IP: 91.189.88.149 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I tried the suggested fix missing too but didn't work.
How can I install a postgresql package successfully? And mainly how can I get the $psql command to give me the desired output showed in the picture?
(Edit) I tried the first answer's suggestion:
vagrant#precise64:~$ apt-get update
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Then tried the solutions mentioned here :
vagrant#precise64:~$ ps aux | grep apt
vagrant 1144 0.0 0.2 11676 948 pts/0 S+ 18:59 0:00 grep --color=auto apt
I don't understand so I don't know what's next.
looks like you had some trouble installing several packages 404 Not Found.
Do sudo apt-get update and then retry the install.
I'm trying to upgrade postgres locally so I don't get a version mismatch error. This is what i do:
echo "http://dl-5.alpinelinux.org/alpine/v3.5/main" >> /etc/apk/repositories;
apk update
bash-4.3# apk add postgresql-dev
(1/4) Installing libressl2.4-libtls (2.4.4-r0)
(2/4) Installing libressl-dev (2.4.4-r0)
(3/4) Installing postgresql-libs (9.6.5-r0)
(4/4) Installing postgresql-dev (9.6.5-r0)
Executing busybox-1.24.2-r13.trigger
OK: 353 MiB in 108 packages
bash-4.3# pg_dump
bash: /usr/bin/pg_dump: No such file or directory
I'm at a loss - any idea what the problem is please?
Just a guess but I guess you've not installed postgresql. In order to use the pg_dump you must have installed this, or if you do have it already and I'm wrong try reinstalling it like so:
bash-4.3# apk del postgresql
(1/4) Purging postgresql (9.6.5-r0)
(2/4) Purging postgresql-client (9.6.5-r0)
(3/4) Purging libedit (20170329.3.1-r2)
(4/4) Purging libxml2 (2.9.4-r4)
Executing busybox-1.26.2-r5.trigger
OK: 37 MiB in 25 packages
bash-4.3# apk add postgresql
(1/4) Installing libedit (20170329.3.1-r2)
(2/4) Installing postgresql-client (9.6.5-r0)
(3/4) Installing libxml2 (2.9.4-r4)
(4/4) Installing postgresql (9.6.5-r0)
Executing busybox-1.26.2-r5.trigger
OK: 53 MiB in 29 packages
bash-4.3# pg_dump
pg_dump: [archiver (db)] connection to database "root" failed: 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"?
bash-4.3#
As you can see from above pg_dump is working because it is in the postgresql package even though as listed on alpine packages site it should be within the postgresql-client package as shown here but it doesn't work unless postgres is installed. If you can't have a full postgres installation, I recommend this workaround which is a bit unclean, install postgres, backup the pg_dump binary, uninstall postgres then restore pg_dump like so:
bash-4.3# apk add postgresql
(1/2) Installing libxml2 (2.9.4-r4)
(2/2) Installing postgresql (9.6.5-r0)
Executing busybox-1.26.2-r5.trigger
OK: 53 MiB in 29 packages
bash-4.3# cp /usr/bin/pg_dump /usr/bin/pg_dump
pg_dump pg_dumpall
bash-4.3# cp /usr/bin/pg_dump /usr/bin/pg_dump.back
bash-4.3# cp /usr/bin/pg_dumpall /usr/bin/pg_dumpall.back
bash-4.3# apk del postgresql
(1/2) Purging postgresql (9.6.5-r0)
(2/2) Purging libxml2 (2.9.4-r4)
Executing busybox-1.26.2-r5.trigger
OK: 38 MiB in 27 packages
bash-4.3# mv /usr/bin/pg_dump.back /usr/bin/pg_dump
bash-4.3# mv /usr/bin/pg_dumpall.back /usr/bin/pg_dumpall
bash-4.3# pg_dump
pg_dump: [archiver (db)] connection to database "root" failed: 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"?
bash-4.3#
It is not ideal but it has worked for me in the past