前提
EhCache (使ってる人そんなにいないのかな)でキャッシュのレプリケーション設定する時の話
例えば、設定で
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=localhost, port=40001,
socketTimeoutMillis=2000"/>
Ehcache | Documentation | RMI Replicated Caching - http://goo.gl/MurBem
こんな風にするという例があって、 'hostname=localhost' は良くないから、指定しないで
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="port=40001,
socketTimeoutMillis=2000"/>
のようにした場合、削除した hostname 部分は、内部的に 'InetAddress.getLocalHost().getHostAddress()' が使用されるというのが EhCache の仕様
ところが、OSによってはこの値が '127.0.0.1' になることがあるらしく(CentOS 6.7 のデフォルトではそう)、それだとよろしくない
解決方法
例えば、 '192.168.1.5' にしたい場合
hosts ファイルを変更
hostname
の設定を確認
$ hostname
amaterasu
/etc/hosts
ファイルを編集して以下を追加
192.168.1.5 amaterasu