0

On a Linux system, I need to deploy Java processes that have hostnames for external data and web server names hard-coded into the app, e.g. "mailserver" and "ftpserver". When deploying on different hosts, we can of course use /etc/hosts to allow each deploy of this app use a different remote server for its "mailserver" or "ftpserver".

Now, we'd like to consolidate several application deployments onto one host. However, each deployment still needs to point to it's own "mailserver" or "ftpserver", and this consolidated host's /etc/hosts cannot be used as it is shared by all the instances of the apps.

Is there a way to specify within a process' context a mapping of name-to-IP without using /etc/hosts or even DNS - since these are system-wide and shared by all processes?

I understand chroot would do the trick but am only willing to use that as a last resort.

Cheers, Dog

4

1 回答 1

0

您可以轻松地将配置信息存储在特定于部署的文件中,并在运行时使用Properties加载它。

于 2012-03-27T21:07:33.327 回答