我正在尝试使用 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 中使用它,但不反对独立客户端。