这可能是一个愚蠢的问题,但我无法找到答案。如果我的集群中有 3 个节点,那么在创建传输客户端时是否需要提供每个节点的 IP 和端口,以便我可以与每个节点进行通信?
new PreBuiltTransportClient(settings, AuthenticationPlugin.class).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"),
Integer.parseInt("9300")))
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"),
Integer.parseInt("9301")))
InetSocketTransportAddress(InetAddress.getByName("localhost"),
Integer.parseInt("9302")));;
Run Code Online (Sandbox Code Playgroud)
有什么方法可以让我不需要提供每个节点的IP和端口吗?请帮忙