我正在尝试使用 Atomix,并且对我做错了什么有一些疑问。我曾尝试使用https://atomix.io/docs/latest/getting-started/详细信息,但那里的代码示例似乎没有与列出的 POM 依赖项一起编译。所以我必须遗漏一些东西,因为我无法让它正常工作。
我现在的主要问题是我能够通过以下方式运行集群:
@Bean(destroyMethod = "shutdown")
public AtomixReplica atomix() {
return AtomixReplica.builder(new Address("localhost", 8770))
.withTransport(new NettyTransport())
.withStorage(Storage.builder()
.withStorageLevel(StorageLevel.MEMORY)
.build())
.build()
.bootstrap()
.join();
}
Dependency:
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-all</artifactId>
<version>1.0.8</version>
</dependency>
我确实看到了在 AtomixReplica 中使用“ServerAddress”的方法,但似乎我必须做与 JavaDocs 显示的相反的事情:例如:AtomixReplica.builder(ServerIP, HostIP) 而不是 AtomixReplica.builder(HostIP, ServerIP)。首先使用主机给我一个“无法绑定到地址”
我已经尝试过独立客户端(bin/atomix-agent --config atomix.conf),但我仍然无法让它们与另一个集群通信。
我们希望在多台服务器上进行此设置以实现容错,并寻找一个示例,让我设置两台服务器来执行所述集群。
现在我该如何在一台以上的服务器上运行它并让它们正确地相互通信?它更喜欢在 Java 中使用它,但不是针对独立客户端。