如何将新主机添加到现有的Apache Ignite实例? [英] How to add a new host to existing Apache Ignite instance?

查看:55
本文介绍了如何将新主机添加到现有的Apache Ignite实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Apache Ignite的一些示例.我正在以这种格式输入Ignite节点的地址

I am trying few examples with Apache Ignite. I am feeding the addresses for my Ignite node in this format

ipFinderTcpIp.setAddresses(memberStrings); // ipFinderTcpIp is of TcpDiscoveryVmIpFinder class
spi.setIpFinder(ipFinderTcpIp); //spi is of TcpDiscoverySpi class 
config.setDiscoverySpi(spi); //config is of IgniteConfiguration class
//memberStrings contains the ipv4 addresses in String format. It is a collection. 

Ignite ignite = Ignition.start(config);

memberStrings的值取自输入文件我想将一个地址动态添加到ignite节点.为了简单起见,让我们说ignite已经在地址A和B中运行,这两个地址都存在于memberStrings中.拓扑快照看起来像

The values for memberStrings are taken from an input file I want to add an address dynamically to the ignite node. For the sake of simplicity let us say ignite is already running in addresses A and B, both of which are present in memberStrings. The topology snapshot looks like

Topology snapshot [ver=1, servers=2, clients=0, CPUs=8, offheap=4.5GB, heap=3.6GB]

假设我在输入文件中添加了一个新地址"C".我有一个正在运行的线程,它可以检测到此更改并在memberStrings中进行更改.如何确保拓扑中也存在C,而无需停止并重新启动ignite实例以再次运行上述代码?

Let's say i add a new address 'C' to the input file. I have a running thread which detects this change and makes the change in memberStrings. How do i make sure C is also present in the topology without stopping and restarting the ignite instance to run the above piece of code again??

推荐答案

基本上,您不需要将此地址'C'添加到第一个节点的配置中.在启动时,节点C将尝试连接到其列表中的所有地址,并且不需要在节点"A"的配置中使用其地址.因此,该节点将毫无问题地加入集群.

Basically, you don't need to add this address 'C' to the configuration of the first node. At the moment of start, node C will try to connect to the all addresses from its list and it doesn't need to have its address in config of the node 'A'. So, the node will join the cluster without any problem.

在某些情况下,使用'shared'标志在所有节点之间共享所有IP地址可能有用: https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.html#setShared-boolean- 也就是说,此标志可用于客户端-重新连接时,它将尝试重新连接到群集中的所有节点.

In some cases may be useful to share all IP addresses between all nodes, using 'shared' flag: https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.html#setShared-boolean- i.e., this flag can be used for clients - at the moment of reconnecting, it will try to reconnect to all nodes in cluster.

此外,如果在启动之前不知道所有地址,则可以使用IpFinder的其他实现:

Additionally, if you don't know all the addresses before start, you can use other implementations of IpFinder: https://apacheignite.readme.io/docs/tcpip-discovery

这篇关于如何将新主机添加到现有的Apache Ignite实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆