如何 attach/connect 到现有的 Ignite 节点

How to attach/connect to exising Ignite node

尝试连接时出现“无法获取默认 Ignite 实例:没有实例启动。”(使用 Ignition.GetIgnite() ).

更多信息:

我正在尝试使用 Apache Ignite 作为我的内存数据库。 我的计划是在服务器中启动 Ignite 实例,然后让应用程序连接到该实例。 我使用默认配置从命令行启动 apache ignite

    ignite.bat   

然后,从我的 .NET 应用程序中,我尝试使用 GetIgnite,这样它将 connect/attach 现有的点燃节点,因为它们都在我的本地机器上。

    var ignite = Ignition.GetIgnite();

这是我在web.config

中的配置
    <configSections>
<section name="igniteConfiguration" type="Apache.Ignite.Core.IgniteConfigurationSection, Apache.Ignite.Core" />
 </configSections>
 <igniteConfiguration xmlns="http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection"
                    localhost="127.0.0.1" peerAssemblyLoadingMode="CurrentAppDomain">
   <atomicConfiguration atomicSequenceReserveSize="10" />
 </igniteConfiguration>

工作版本: 我可以从应用程序内部启动 "Ignite" 并执行内存数据库操作,例如使用不同的 ICache 缓存数据,然后加入以检索数据。但是这个版本将无法扩展。

     //for some reason I have to set the environment variable like this
     Environment.SetEnvironmentVariable("IGNITE_HOME", "C:\test\app\packages\Apache.Ignite.2.4.0\");
     // Start Ignite and retrieve cache
     _ignite = Ignition.StartFromApplicationConfiguration();

     CacheConfiguration config = new CacheConfiguration("MyProduct", typeof(MyProduct));
     config.CacheMode = CacheMode.Local;
     ICache productList = _ignite.GetOrCreateCache<string, MyProduct>
                                    (config);

您应该在您的进程中启动一个 Ignite Client 节点以便能够连接到 Ignite 集群,即使 "cluster" 是同一台机器上的一个节点。

复制配置,设置clientMode为true,用Ignition.start()启动。