在阿里云的专有网络上启动akka节点时,因为没有公网网卡,直接配置公网Ip+port无法启动serverSocket,
此时可以
1:配置/etc/hosts
0.0.0.0 serverName
服务节点的akkaCluster的配置文件配置:
remote {
artery {
canonical.hostname = “offline”,
canonical.port = 42768
}
}
cluster {
allow-weakly-up-members=off
seed-nodes = [
“akka://binlogSyncSystem@offline:42767”,
“akka://binlogSyncSystem@offline:42768”
]
}
2.客户端服务配置动态DNS设置
maven pom:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dns-cache-manipulator</artifactId>
<version>1.5.1</version>
</dependency>
资源路径下添加 dns-cache.properties 文件
offline=127.0.0.1
machine1=192.168.0.6
程序入口处初始设置DNS映射
DnsCacheManipulator.loadDnsCacheConfig();
客户端连接seeds配置:
remote {
artery {
canonical.port = 42702
}
}
cluster {
allow-weakly-up-members=off
seed-nodes = [
“akka://binlogSyncSystem@offline:42767”,
“akka://binlogSyncSystem@offline:42768”
]
}