0

My Oracle 11.2 database schema has a scheduled job that queries a webpage on my website every few minutes. The database and web servers are two physical Linux machines that sit next to each other and have local IP addresses 192.168.0.11 (database) and 192.168.0.12 (web server). There is a RJ-45 cable cross-connect that directly links the two servers on the same subnet.

If I enter the web address http://xxx.xxx.xxx.xxx/path/to/webpage where xxx.xxx.xxx.xxx is the external IP address, things work fine. Things also work well if I replace xxx.xxx.xxx.xxx with www.mydomain.com.

However, I'm thinking it should be much more efficient if I could re-write xxx.xxx.xxx.xxx as 192.168.0.12 thinking that this would avoid having the request go out on the internet and come back, but rather stay on the same subnet to get to the webpage (thus saving time and resources).

req := UTL_HTTP.BEGIN_REQUEST('http://192.168.0.12/path/to/webpage');

When I try that, I get a 404 error, which makes me think it didn't get to the right webpage.

Can I keep the query on the same subnet by modifying the hosts file or some other way?

My current hosts file already contains an alias for the email server, that is:

192.168.0.12 mail.mydomain.com

If I also include the web address such as

192.168.0.12 mail.mydomain.com www.mydomain.com

would that keep the database on the same subnet when accessing the website? Or will it still leave the subnet to get there? Also, will it confuse things now that I've got two aliases (e.g. one for the database to send emails and one for the database to access webpages)?

user46688
  • 693
  • 3
  • 7
  • 24

1 Answers1

1

I am not sure I would add "192.169.0.12 mail.mydomain.com www.mydomain.com" if that is not the proper IP for the host. That might only make things more confusing.

Assuming that you can ping 192.168.0.12 from the DB server, make sure that your Web Server is listening on the 192.168.0.12 address as well. It could be listening only on the external IP address, in which case, it will return HTTP 404 to every request on the 192.168.0.12 IP/interface.

On Apache, the httpd.conf file would have

listen xxx.xxx.xxx.xxx:80

which would make it listen on the external IP only.

Please note that if the purpose of your HTTP requests is to test the web server availability, you may be better of leaving things as they are. The external test is much more compreheensive than a local one could ever be.

Gui
  • 296
  • 1
  • 7