pgAdmin4 - postgresql application server could not be contacted - postgresql

I know this question may be marked as repeated, but keep in mind that I have searched for numerous posted solutions and my error has not been fixed.
When starting postgres, I get the following error:
postgresql application server could not be contacted.
When running as administrator the error is "solved", but the application opens in another port - sometimes it opens in 50142, 51120 and others in 50859 -. And when it opens on another port (like the ones previously said), it asks for the password to connect to the server and I get this error:
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
Infos:
Windows 10 64Bits
Postgresql 10
pgAdmin 4.1
Port 5432 (appears even in PostgreSQL\10\data\postgres.conf)
Solutions already tried:
Run in administrator mode
Modify the postgres.conf file
Clear the contents of the folder AppData\Roaming\pgAdmin
I would like to know how to avoid this error when starting the application and always opening on a specific port.

Simply locate AppData\Roaming\pgAdmin, delete the pgAdmin folder and try to start pgAdmin again... It should work

I finally got the right solution after 3 days of tries, this was insane, some answers above was correct at least not in my case but if you running to the same problem I had, I suggested following these steps even though some answers was very clear and helpful regarding deleting the folders inside the pgAdmin folder but not all the time and it depends.
So here are the steps to follow:
I installed the PostgreSQL and the pgAdmin4 comes with but the pgAdmin4 wasn't working and it was giving me the error (couldn't connect to the server).
To fix the problem, go to
This PC > local Disk(C:) > Users > (your folder's name)
in this folder you need to show the hidden folders.
on top left click on view > options > change folder and search option > view > (mark
show hidden files, folders and drives > then click ok.
now you will see the AppData folder click on it then roaming > pgadmin > (here you will see folders and files) delete them all and then go to the recycle ben and delete them from there too.
now go to pgadmin4 website and download the latest version, follow the steps to finish it .
now go to windows symbol in the bottom left of the screen where is says start, and run the latest version of the pgAdmin4 that you just installed, you will see it there separately from the one that, it comes inside the PostgreSQL.
(RUN THE NEW VERSION YOU JUST INSTALLED, IT WILL WORK, DO NOT RUN THE VERSION THAT IT COMES WITH POSTGRESQL BECAUSE IT WON'T WORK)

This error is happening because you haven't started the ppgadmin server.
For pgadmin3 we don't need to do this thing because pgadmin3 was an application but for pgadmin4 they have build web interface in a specific port.
So before starting pgadmin4 in browser you have to start the server.
In python we just download the pgadmin4 package and after activating the venv we run the pgadmin server file.
I would suggest you to try for the same.

Here is how I fixed this issue on window 10
Delete all files and folders within App Data folder found in C:\Users\%USERNAME%\AppData\Roaming\pgAdmin (please note AppData is a hidden folder, to find it ,go to C:\Users%USERNAME%, go to View tab on top panel of file explorer > Click Options > click change folder and search options > View tab >in Advance options click show hidden files, folders and drives, click OK, this will display the AppData folder)
Add to Path Variables C:\Program Files\PostgreSQL\9.6\bin (To access environment variables: Control Panel > System and security > System or right click on PC, then > Advance system settings > Environment variables > System variables > Path > New > add the copied path)
Go to start menu of windows search PgAdmin > Right click and start as admin.

Related

VS Code Remote-SSH won't reconnect to one specific working directory on remote Ubuntu host

I'm using VSCode 1.72.2 with Remote-SSH v0.90.1 on Windows to develop against an AWS EC2 VM running Ubuntu 22.04 LTS. A couple days ago, I was working in my project source folder in /opt/t4/ on the target host. When I was finished, I stopped the VM from the AWS console, forgetting that VS Code was still SSHed in.
When I brought the VM back up, I can reconnect VS Code/Remote-SSH to the host as before, except that I can no longer connect using /opt/t4/ as my working directory. I can use any directory except the one I was using when I disconnected.
I can navigate down to it and work in it if I use /opt/ as my working directory. I can navigate to it by manually SSHing to the remote host. I can create a subfolder in a remote shell at /opt/t4/test/, and then connect VS Code using that subfolder as my working directory. I can see and select /opt/t4/ in the Open Folder dialog in VS Code. But when I try to connect using that working directory, the connection times out with a not-particularly-useful error message:
[00:05:49.867] SSH Resolver called for "ssh-remote+my.remote.host", attempt 2, (Reconnection)
[00:05:49.868] SSH Resolver called for host: my.remote.host
[00:05:49.868] Setting up SSH remote "my.remote.host"
[00:05:49.870] Using commit id "d045a5eda657f4d7b676dedbfa7aab8207f8a075" and quality "stable" for server
[00:05:49.872] Install and start server if needed
[00:05:49.874] Using SSH config file "C:\Users\me\.ssh\config"
[00:05:49.874] Running script with connection command: ssh -T -D 1518 -F "C:\Users\me\.ssh\config" "my.remote.host" bash
[00:05:49.875] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[00:06:06.876] Resolver error: Error: Connecting with SSH timed out
at g.Timeout (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:585348)
at Timeout._onTimeout (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:679743)
at listOnTimeout (node:internal/timers:559:17)
at process.processTimers (node:internal/timers:502:7)
[00:06:06.877] ------
I tried Remote-SSH: Uninstall VS Code Server from Host from VS Code.
I tried deleting ~/.vscode-server on the Linux host from an SSH session.
I tried Remote-SSH: Kill VS Code Server on Host from VS Code.
I tried Remote-SSH: Kill Local Connection Server for Host from VS Code.
I tried deleting and recreating the host connection details in the local config file from SSH-Remote.
I tried rebooting both local and target hosts.
I tried setting /opt/ as my working dir, then deleting and recreating /opt/t4. I was able to do this, but as soon as I try reconnecting using /opt/t4 as the working dir, VS Code still fails to connect.
I'm... stumped. My suspicion is that there is something corrupt cached Windows-side, but I don't know where to look for that.
Microsoft is aware and working on a fix. There are a variety of workarounds in this thread: https://github.com/microsoft/vscode-remote-release/issues/7324
Thanks to the link from #Mike Barry, I managed to find the local workspace for that target folder and delete it to force it to reinitialize, which cleared the issue.
Deleted C:\Users\me\AppData\Roaming\Code\User\workspaceStorage\[guid]\ and reconnected with no problem.

Manage to connect through the terminal, but not through the remote explorer

I am coming from notepad, and am learning how to work with VS Code.
I am now trying to access my online repertory on the webserver.
I followed up the guide here: https://code.visualstudio.com/docs/remote/ssh
I did manage to access my server through the terminal window.
(ssh user#domain + password).
When connecting, this shows in the log:
"Linux infong-eu27 4.4.246-icpu-061 #2 SMP Thu Nov 26 10:58:41 UTC 2020 x86_64"
This tells me that it is working on Linux.
If I type "Ls", I can see my folders and navigate among them.
So far, so good!
Second phase: Connecting through the remote explorer.
Step 1:
I configured the ssh with the same credentials I used with the terminal.
Step 2:
I am opening the remote explorer, I can see my server's name. I right click on it and select "connect".
Step 3:
I am then asking to choose the system. I am picking Linux as shown earlier when connecting through the terminal.
Step 4: I am entering the same password I used before to connect in the terminal.
Step 5: Infinite loading, or a very long one till I get 2 notifications / errors:
Could not fetch remote environment
Failed to connect to the remote extension host (error time limit..)
That being said, it also says in the bottom left corner, in the "remote window", that I am connected. This does not seems right.
Any chance someone could help?
I am frustrated because it connects in 1s using the terminal, but not in the remote explorer.
UPDATE:
I found this article on medium that paraphrases the official documentation.
https://medium.com/#sujaypillai/connect-to-your-remote-servers-from-visual-studio-code-eb5a5875e348
I managed, through Git bash, to create a ssh pair key, and managed to copy one on my server.
I then followed the instructions on how to set it up on VS Code successfully!
Now, when I try to connect, I am asked for my key pass:
But, when I do: super long loading, and the same error message.
When I looked on my server with a sftp software, I see that VS did manage to connect as files were installed in a VS folder it created:
This is reported in issue 4415 (no answer) and issue 4204
The last one includes:
This might be caused by our new automatic port forwarding feature which scans the remote OS for available ports in order to forward them locally (microsoft/vscode#112843)
This is fixed by PR 113342, for the next 1.54 Feb. 2021 release. That bug is about setting remote.autoForwardPorts to false and... still seeing VSCode auto-forward ports!
Check on your server (while VSCode attempts to connect) if:
the CPU is high
if there are any services running on public port on said server
I solved a similar issue by following the error logs from the remote ssh extension. I had to install libatomic1 on the remote server with
sudo apt-get install libatomic1

How to set a remote connection to a Vagrant container using "Visual Studio Code Remote - SSH"?

I'm exploring the new set extensions called VSCode Remote Pack and I want to connect to a Vagrant container using the Remote Container extension. Using a Windows 10 OS, how could I do that?
I tried the extension but it requests me to have Docker installed, what I suppose from that is that it only works for Docker containers. But I wonder if somebody have already managed to connect to a Vagrant box.
This are the docs from the extension: https://code.visualstudio.com/docs/remote/containers
VS Code Remote containers currently only support Docker (its implementation executes docker commands). Please open a feature request if you would like to see other tools supported.
As an alternative, you could try using Remote SSH to connect to vagrant containers. That should work but will require some extra container setup
Sorry for updating this so late.
The solution was pretty simple, as #MnZrk commented, what it needs to be done for setting up the connection is the following:
Run vagrant ssh-config > some-file.txt. This will generate a file with the configuration to run using SSH. Here an example of that file:
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile C:/Users/User/project/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
ForwardX11 yes
Notice that the host name is default, you could rename it to whatever you want so you could identify it more easily.
Copy the content of some-file.txt inside your SSH configuration file. This file could be edit directly from vscode by pressing F1 and writing Remote-SSH: Open Configuration File..., then you select the file you use for ssh configuration. After that file opens, just copy the content of some-file.txt there.
Finally, just press again F1 and type Remote-SSH: Connect to Host..., choose the connection with the host name default or the want you wrote in the first step, and that's all.

Netbeans IDE8 Glassfish 4, GlassFish Server: Administrator port is occupied by null

I just downloaded Netbeans IDE7 with the Glassfish 4.
I just made a project to test it out and see how it goes, and I got this error right from the start:
Could not start GlassFish Server: DAS port is occupied while server is not running
[location]: Deployment error: Could not start GlassFish Server: DAS port is occupied while server is not running
See the server log for details.
BUILD FAILED (total time: 1 second)
I have reinstalled it three times, with the Glassfish and without and then later add it to Netbeans, i changed the domain.xml name="admin-listener" port="4848" to something different
i did this cmd code netstat -aon | find ":80" | find "LISTENING" and closed the programm.
i ran as administrator i think i did almost everyting but it wont simply run, and it keeps returning to the same error
usually i would have given up but this software is required for a school project.
i will try everything.
i hope someone can help me.
Thx in advance
You have to find the process that has taken the port you need. You can try finding it by running the terminal with the command:
netstat -aon | find ":80" | find "LISTENING"
Find the information you need and than kill the process with specific PID in Task Manager.
I hope you find this useful,
Thanks.
A few points:
Why not download NetBeans 8 that also includes GlassFish 4?
Assuming that you have successfully figured out that no other process is listening on port 4848, then Which version of the JDK are you using? Can you try JDK 7 if you are using JDK 8?
Looks like you are not alone - see NetBeans bug 237477.
Note that this isn't the only problem. I run on a Mac and can use the asadmin start command successfully on the remote server. IF I try to start it from NetBeans, it gives me this message.
One hint might be that the domain.xml file is set so that the listening port is 9090, the properties screen for the remote server, which I entered 9090 for, tells me the HTTP port is 23043. I can't edit it. Everytime I try to create that remote server it sets it to this value. The server will run fine if I start it by hand on the remote server, but NetBeans doesn't think it is running.
This occurs because I had to select domain2 because NetBeans says domain1 is already registered on my local machine. I wanted to have a local domain1 and a remote domain1 that are identical so I can test locally, and then deploy remotely.
This error message could be misleading, because it is the same when IP adress of glassfish server in netbeans settings is wrong (not port).
By my experience with this over win 8.1 + Netbeans 8.0 + Glassfish 4.0
The problem resides in permission of folder in windows that block the server execution
I solve the problem changing the permission of the glassfish/domain/domain1 folder for xxxx/user to totalcontrol
If this not solve your problem, try launch the server over console:
asadmin start-domain --verbose
And read the exceptions to try solve the problem.
-EDIT:
Reading other post to try help:
like this: Glassfish server started failed in netbeans 6.9
Or check your firewall:
allow >> C:\Program
Files\glassfish-X.X\glassfish\modules\glassfish.jar
In my case when using the command
netstat -aon | find ":4848" | find "LISTENING"
I noticed that one process was occupying this port. When checked what it was I noticed it was VMWare NAT controller, because I previously had configured a network adapter to listen to this port.
Just stopped all VMWare related services (in my case I didn't need them for development purposes), and solved the problem.
Go to Task Manager -> Services -> Stop Process whose PID IS 3136,2268,2468 ,23.... and near Range in PID. All processes near to the web server's PID.
It works for me on Windows 8.1 pro & Windows 7.
I had the same error message.
Turned out it was caused because my firewall blocked port 4848
May be late but I solved this issue by deleting the app server from the Netbeans and by adding it again. In my case Netbeans 8.2 and Payara 4.1 instead of Glassfish.
If you changed the host of Glassfish server then set it to localhost it should work.

Connect Eclipse RSE with remote Linux server using public key attained from Amazon ec2

I want a easy way to save, copy and edit files on a remote server. I'm using Eclipse as an IDE, what could be better for these tasks than RSE(Remote System Exlporer) plugin for Eclipse. The thing is that I dont know how to make a connection using a public key. I have file that I downloaded from my Amazon account, *.pem. But I don't see any forms or inputs for this, when I try to connect to my remote Linux server. It is just User-id and password. I also tried to open the public key using the system's text editor and copy everything to my password field, but it didn't worked. Pls help me
this was baking my noodle for a while too. you put the keys in a folder not in the RSE config but in the whole of eclipse
check this: http://siteadmin.gforge.inria.fr/eclipse-ssh.html
Not mentioned (at least in explicitly) is the fact that RSE (and for what I've seen, Eclipse in general) only seems to work with 1024 bit keys https://bugs.eclipse.org/bugs/show_bug.cgi?id=404714
I also had issues, because my privatekey was 2048, but I added a new key to authorized hosts and then I could connect.
I added my local computer's ~/.ssh/id_rsa.pub to the remote /home/ec2-user/.ssh/authorized_keys.
Then just set the user to connect in RSE to ec2-user when connecting.
Someone asked for root login. It works too: update /root/.ssh/authorized_keys, and edit /etc/ssh/sshd_config to allow root login:
#PermitRootLogin forced-commands-only
PubkeyAuthentication yes
Then reload the sshd daemon: service sshd restart