Connection to server fails after rebooting even though can log into it












1














I have been having problem with the electricity going off often for 3 hours and more at a time and the UPS i have is not enough. When the UPS runs out then the servers switch off. When the electricity goes back on things boot up and all servers and VM's go on automatically (running XenServer with a few VM's). The issue I am having is that when the servers switch back on all the VM's go on as normal but there is two webservers that rely on the database and the other 5 don't. The ones that are relying on the database (all the content housed on a FreeNas) both have this error on the live site.



**Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "192.168.xx.xx" and accepting TCP/IP connections on port 5432?'**


The first and second time i saw this error i just restarted the freeNas and then it worked as normal however now this error is back because the server switched off again because of electricity going off (and yes got better UPS so wont go off again unless the electricity is off for 5 hours).



My question is where do i start to try to fix the problem. I restarted everything one by one and then searched the error that comes up and saw a post off someone saying i should try this with no reason at all setsebool -P httpd_can_network_connect on










share|improve this question
























  • This might be a problem with the order in which the computers or processes start, so a client may be starting before the server is accepting connections. Try to postpone the startup of the process that gives that error.
    – harrymc
    Dec 6 at 16:09










  • Log in to 192.168.xx.xx. Find the postgresql logs. Read the last entries to see why the autostart failed to start.
    – Daniel Vérité
    Dec 17 at 12:52
















1














I have been having problem with the electricity going off often for 3 hours and more at a time and the UPS i have is not enough. When the UPS runs out then the servers switch off. When the electricity goes back on things boot up and all servers and VM's go on automatically (running XenServer with a few VM's). The issue I am having is that when the servers switch back on all the VM's go on as normal but there is two webservers that rely on the database and the other 5 don't. The ones that are relying on the database (all the content housed on a FreeNas) both have this error on the live site.



**Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "192.168.xx.xx" and accepting TCP/IP connections on port 5432?'**


The first and second time i saw this error i just restarted the freeNas and then it worked as normal however now this error is back because the server switched off again because of electricity going off (and yes got better UPS so wont go off again unless the electricity is off for 5 hours).



My question is where do i start to try to fix the problem. I restarted everything one by one and then searched the error that comes up and saw a post off someone saying i should try this with no reason at all setsebool -P httpd_can_network_connect on










share|improve this question
























  • This might be a problem with the order in which the computers or processes start, so a client may be starting before the server is accepting connections. Try to postpone the startup of the process that gives that error.
    – harrymc
    Dec 6 at 16:09










  • Log in to 192.168.xx.xx. Find the postgresql logs. Read the last entries to see why the autostart failed to start.
    – Daniel Vérité
    Dec 17 at 12:52














1












1








1







I have been having problem with the electricity going off often for 3 hours and more at a time and the UPS i have is not enough. When the UPS runs out then the servers switch off. When the electricity goes back on things boot up and all servers and VM's go on automatically (running XenServer with a few VM's). The issue I am having is that when the servers switch back on all the VM's go on as normal but there is two webservers that rely on the database and the other 5 don't. The ones that are relying on the database (all the content housed on a FreeNas) both have this error on the live site.



**Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "192.168.xx.xx" and accepting TCP/IP connections on port 5432?'**


The first and second time i saw this error i just restarted the freeNas and then it worked as normal however now this error is back because the server switched off again because of electricity going off (and yes got better UPS so wont go off again unless the electricity is off for 5 hours).



My question is where do i start to try to fix the problem. I restarted everything one by one and then searched the error that comes up and saw a post off someone saying i should try this with no reason at all setsebool -P httpd_can_network_connect on










share|improve this question















I have been having problem with the electricity going off often for 3 hours and more at a time and the UPS i have is not enough. When the UPS runs out then the servers switch off. When the electricity goes back on things boot up and all servers and VM's go on automatically (running XenServer with a few VM's). The issue I am having is that when the servers switch back on all the VM's go on as normal but there is two webservers that rely on the database and the other 5 don't. The ones that are relying on the database (all the content housed on a FreeNas) both have this error on the live site.



**Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "192.168.xx.xx" and accepting TCP/IP connections on port 5432?'**


The first and second time i saw this error i just restarted the freeNas and then it worked as normal however now this error is back because the server switched off again because of electricity going off (and yes got better UPS so wont go off again unless the electricity is off for 5 hours).



My question is where do i start to try to fix the problem. I restarted everything one by one and then searched the error that comes up and saw a post off someone saying i should try this with no reason at all setsebool -P httpd_can_network_connect on







postgresql freenas






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 6 at 16:00









davidbaumann

1,842722




1,842722










asked Dec 6 at 14:34









Deez Nutz

62




62












  • This might be a problem with the order in which the computers or processes start, so a client may be starting before the server is accepting connections. Try to postpone the startup of the process that gives that error.
    – harrymc
    Dec 6 at 16:09










  • Log in to 192.168.xx.xx. Find the postgresql logs. Read the last entries to see why the autostart failed to start.
    – Daniel Vérité
    Dec 17 at 12:52


















  • This might be a problem with the order in which the computers or processes start, so a client may be starting before the server is accepting connections. Try to postpone the startup of the process that gives that error.
    – harrymc
    Dec 6 at 16:09










  • Log in to 192.168.xx.xx. Find the postgresql logs. Read the last entries to see why the autostart failed to start.
    – Daniel Vérité
    Dec 17 at 12:52
















This might be a problem with the order in which the computers or processes start, so a client may be starting before the server is accepting connections. Try to postpone the startup of the process that gives that error.
– harrymc
Dec 6 at 16:09




This might be a problem with the order in which the computers or processes start, so a client may be starting before the server is accepting connections. Try to postpone the startup of the process that gives that error.
– harrymc
Dec 6 at 16:09












Log in to 192.168.xx.xx. Find the postgresql logs. Read the last entries to see why the autostart failed to start.
– Daniel Vérité
Dec 17 at 12:52




Log in to 192.168.xx.xx. Find the postgresql logs. Read the last entries to see why the autostart failed to start.
– Daniel Vérité
Dec 17 at 12:52















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1381365%2fconnection-to-server-fails-after-rebooting-even-though-can-log-into-it%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1381365%2fconnection-to-server-fails-after-rebooting-even-though-can-log-into-it%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...