Apache Ignite:远程节点上的 SQL API @QuerySqlField 注解
Apache Ignite: SQL API @QuerySqlField Annotation on Remote Node
我在尝试使用 Apache Ignite's SQL API @QueryEntity Annotation 时遇到了一些错误 运行。
现在,我通过将 XML 文件传递到脚本 bash ignite.sh
来远程启动集群。然后,我使用 C# 在本地以编程方式启动另一个节点,该节点连接到底层 Oracle 数据库,以便用数据加载缓存。
我的objective是为了能够查询缓存中的数据,其中key是一个Object ID,value是整个Object对象。我所做的唯一步骤是在 Object.cs
中使用 @QuerySqlField 注释对值 class 定义中的字段进行注释,并在 Program.cs
.
中实例化 CacheConfiguration 中的 QueryEntity
XML 文件已传递以启动远程集群
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<list>
<!-- Partitioned cache example configuration (Atomic mode). -->
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="default"/>
<property name="atomicityMode" value="ATOMIC"/>
<property name="backups" value="1"/>
</bean>
</list>
</property>
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>[host1]:47500..47509</value>
<value>[host2]:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean> </beans>
Program.cs
namespace IgniteTest
{
class Program
{
static void Main(string[] args)
{
// Create Connection
OracleConnection con = new OracleConnection();
// Create ConnectionString using Builder
OracleConnectionStringBuilder ocsb = new OracleConnectionStringBuilder();
ocsb.Password = "[Password]";
ocsb.UserID = "[User]";
ocsb.DataSource = "[URL]";
// Connect
con.ConnectionString = ocsb.ConnectionString;
con.Open();
Console.WriteLine();
Console.WriteLine(">>> Connection Established");
// Execute a SQL SELECT
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "COMMAND";
OracleDataReader reader = cmd.ExecuteReader();
// Create node locally; connect with remote cluster
var cfg = new IgniteConfiguration
{
DiscoverySpi = new TcpDiscoverySpi
{
IpFinder = new TcpDiscoveryStaticIpFinder
{
Endpoints = new[] { "[host1]", "[host1]:47500..47509" }
}
},
CacheConfiguration = new[]
{
new CacheConfiguration
{
Name = "default",
Backups = 1,
QueryEntities = new[]
{
new QueryEntity(typeof(int), typeof(Object))
}
}
}
};
IIgnite ignite = Ignition.Start(cfg);
ICache<int, Object> cache = ignite.GetOrCreateCache<int, Object>("default");
while (reader.Read())
{
Object object= new Object
{
ObjectID = reader.IsDBNull(0) ? 0 : reader.GetInt32(0),
LastName = reader.IsDBNull(1) ? ">>> LAST_NAME null" : reader.GetString(1),
FirstName = reader.IsDBNull(2) ? ">>> FIRST_NAME null" : reader.GetString(2),
MiddleName = reader.IsDBNull(3) ? ">>> MIDDLE_NAME null" : reader.GetString(3),
JobTitle = reader.IsDBNull(8) ? ">>> JOB_TITLE null" : reader.GetString(8)
};
if (cache.PutIfAbsent(reader.GetInt32(0), object))
{
Console.WriteLine(">>> Object added to cache");
}
else
{
Console.WriteLine(">>> Object ID: " + cache.Get(reader.GetInt32(0)).ObjectID+ ", Job Title: " + cache.Get(reader.GetInt32(0)).JobTitle);
}
}
// Clean up
reader.Dispose();
cmd.Dispose();
con.Dispose();
}
}
}
Object.cs
namespace IgniteTest
{
class Obje
{
[QuerySqlField(IsIndexed = true)]
public int ObjectID { get; set; }
[QuerySqlField]
public string LastName { get; set; }
[QuerySqlField]
public string FirstName { get; set; }
[QuerySqlField]
public string MiddleName { get; set; }
public string JobTitle { get; set; }
}
}
我在本地控制台上遇到的错误
[11:43:34,607][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery accepted incoming connection [rmtAddr=/[host1], rmtPort=35269]
[11:43:34,617][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery spawning a new thread for connection [rmtAddr=/[host1], rmtPort=35269]
[11:43:34,617][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Started serving remote node connection [rmtAddr=/[host1]:35269, rmtPort=35269]
[11:43:34,622][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Received ping request from the remote node [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:35269, rmtPort=35269]
[11:43:34,623][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Finished writing ping response [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:35269, rmtPort=35269]
[11:43:34,623][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Finished serving remote node connection [rmtAddr=/[host1]:35269, rmtPort=35269
[11:43:34,674][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery accepted incoming connection [rmtAddr=/[host1], rmtPort=51961]
[11:43:34,674][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery spawning a new thread for connection [rmtAddr=/[host1], rmtPort=51961]
[11:43:34,679][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Started serving remote node connection [rmtAddr=/[host1]:51961, rmtPort=51961]
[11:43:34,684][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Received ping request from the remote node [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:51961, rmtPort=51961]
[11:43:34,685][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Finished writing ping response [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:51961, rmtPort=51961]
[11:43:34,686][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Finished serving remote node connection [rmtAddr=/[host1]:51961, rmtPort=51961
[11:43:34,732][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery accepted incoming connection [rmtAddr=/[host1], rmtPort=54361]
[11:43:34,732][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery spawning a new thread for connection [rmtAddr=/[host1], rmtPort=54361]
[11:43:34,737][INFO][tcp-disco-sock-reader-[]-#6-#46][TcpDiscoverySpi] Started serving remote node connection [rmtAddr=/[host1]:54361, rmtPort=54361]
[11:43:34,741][INFO][tcp-disco-sock-reader-[973d6f42 [host1]:54361]-#6-#46][TcpDiscoverySpi] Initialized connection with remote server node [nodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:54361]
[11:43:34,759][SEVERE][main][IgniteKernal] Failed to start manager: GridManagerAdapter [enabled=true, name=o.a.i.i.managers.discovery.GridDiscoveryManager]
class org.apache.ignite.IgniteCheckedException: Failed to start SPI: TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [clsFilter=org.apache.ignite.marshaller.MarshallerUtils@53cdecf6], reconCnt=10, reconDelay=2000, maxAckTimeout=600000, soLinger=5, forceSrvMode=false, clientReconnectDisabled=false, internalLsnr=null, skipAddrsRandomization=false]
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:302)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:967)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1935)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1298)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2046)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1698)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1114)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:612)
at org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:43)
at org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:74)
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to join node to the active cluster (the config of the cache 'default' has to be merged which is impossible on active grid). Deactivate grid and retry node join or clean the joining node.
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:2018)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:1189)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:462)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:2120)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:299)
... 9 more
[11:43:34,767][SEVERE][main][IgniteKernal] Got exception while starting (will rollback startup routine).
class org.apache.ignite.IgniteCheckedException: Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1940)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1298)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2046)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1698)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1114)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:612)
at org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:43)
at org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:74)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to start SPI: TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [clsFilter=org.apache.ignite.marshaller.MarshallerUtils@53cdecf6], reconCnt=10, reconDelay=2000, maxAckTimeout=600000, soLinger=5, forceSrvMode=false, clientReconnectDisabled=false, internalLsnr=null, skipAddrsRandomization=false]
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:302)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:967)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1935)
... 7 more
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to join node to the active cluster (the config of the cache 'default' has to be merged which is impossible on active grid). Deactivate grid and retry node join or clean the joining node.
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:2018)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:1189)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:462)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:2120)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:299)
... 9 more
[11:43:34,772][INFO][main][GridTcpRestProtocol] Command protocol successfully stopped: TCP binary
[11:43:34,774][INFO][tcp-disco-sock-reader-[973d6f42 [host1]:54361]-#6-#46][TcpDiscoverySpi] Finished serving remote node connection [rmtAddr=/[host1]:54361, rmtPort=54361
[11:43:39,781][INFO][main][TcpDiscoverySpi] No verification for local node leave has been received from coordinator (will stop node anyway).
[11:43:39,794][INFO][main][IgniteKernal]
我收到这些错误是因为 XML 文件上的缓存配置与 Program.cs
中 C# 的缓存配置不匹配吗?我还必须在 XML 文件中添加查询实体吗?如果是这样,我该怎么做?
您正在尝试设置两个具有相同名称的不匹配缓存配置。
看看这条消息:
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to join node to the active cluster (the config of the cache 'default' has to be merged which is impossible on active grid). Deactivate grid and retry node join or clean the joining node.
此特定错误表示如果群集已激活,则无法合并配置。据我了解,在您的情况下,从服务器节点的 xml
配置中删除 default
缓存配置就足够了。您正在使用 ignite.GetOrCreateCache
检索缓存代理,这意味着当您调用它时将创建 default
缓存。
我在尝试使用 Apache Ignite's SQL API @QueryEntity Annotation 时遇到了一些错误 运行。
现在,我通过将 XML 文件传递到脚本 bash ignite.sh
来远程启动集群。然后,我使用 C# 在本地以编程方式启动另一个节点,该节点连接到底层 Oracle 数据库,以便用数据加载缓存。
我的objective是为了能够查询缓存中的数据,其中key是一个Object ID,value是整个Object对象。我所做的唯一步骤是在 Object.cs
中使用 @QuerySqlField 注释对值 class 定义中的字段进行注释,并在 Program.cs
.
XML 文件已传递以启动远程集群
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<list>
<!-- Partitioned cache example configuration (Atomic mode). -->
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="default"/>
<property name="atomicityMode" value="ATOMIC"/>
<property name="backups" value="1"/>
</bean>
</list>
</property>
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>[host1]:47500..47509</value>
<value>[host2]:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean> </beans>
Program.cs
namespace IgniteTest
{
class Program
{
static void Main(string[] args)
{
// Create Connection
OracleConnection con = new OracleConnection();
// Create ConnectionString using Builder
OracleConnectionStringBuilder ocsb = new OracleConnectionStringBuilder();
ocsb.Password = "[Password]";
ocsb.UserID = "[User]";
ocsb.DataSource = "[URL]";
// Connect
con.ConnectionString = ocsb.ConnectionString;
con.Open();
Console.WriteLine();
Console.WriteLine(">>> Connection Established");
// Execute a SQL SELECT
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "COMMAND";
OracleDataReader reader = cmd.ExecuteReader();
// Create node locally; connect with remote cluster
var cfg = new IgniteConfiguration
{
DiscoverySpi = new TcpDiscoverySpi
{
IpFinder = new TcpDiscoveryStaticIpFinder
{
Endpoints = new[] { "[host1]", "[host1]:47500..47509" }
}
},
CacheConfiguration = new[]
{
new CacheConfiguration
{
Name = "default",
Backups = 1,
QueryEntities = new[]
{
new QueryEntity(typeof(int), typeof(Object))
}
}
}
};
IIgnite ignite = Ignition.Start(cfg);
ICache<int, Object> cache = ignite.GetOrCreateCache<int, Object>("default");
while (reader.Read())
{
Object object= new Object
{
ObjectID = reader.IsDBNull(0) ? 0 : reader.GetInt32(0),
LastName = reader.IsDBNull(1) ? ">>> LAST_NAME null" : reader.GetString(1),
FirstName = reader.IsDBNull(2) ? ">>> FIRST_NAME null" : reader.GetString(2),
MiddleName = reader.IsDBNull(3) ? ">>> MIDDLE_NAME null" : reader.GetString(3),
JobTitle = reader.IsDBNull(8) ? ">>> JOB_TITLE null" : reader.GetString(8)
};
if (cache.PutIfAbsent(reader.GetInt32(0), object))
{
Console.WriteLine(">>> Object added to cache");
}
else
{
Console.WriteLine(">>> Object ID: " + cache.Get(reader.GetInt32(0)).ObjectID+ ", Job Title: " + cache.Get(reader.GetInt32(0)).JobTitle);
}
}
// Clean up
reader.Dispose();
cmd.Dispose();
con.Dispose();
}
}
}
Object.cs
namespace IgniteTest
{
class Obje
{
[QuerySqlField(IsIndexed = true)]
public int ObjectID { get; set; }
[QuerySqlField]
public string LastName { get; set; }
[QuerySqlField]
public string FirstName { get; set; }
[QuerySqlField]
public string MiddleName { get; set; }
public string JobTitle { get; set; }
}
}
我在本地控制台上遇到的错误
[11:43:34,607][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery accepted incoming connection [rmtAddr=/[host1], rmtPort=35269]
[11:43:34,617][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery spawning a new thread for connection [rmtAddr=/[host1], rmtPort=35269]
[11:43:34,617][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Started serving remote node connection [rmtAddr=/[host1]:35269, rmtPort=35269]
[11:43:34,622][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Received ping request from the remote node [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:35269, rmtPort=35269]
[11:43:34,623][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Finished writing ping response [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:35269, rmtPort=35269]
[11:43:34,623][INFO][tcp-disco-sock-reader-[]-#4-#44][TcpDiscoverySpi] Finished serving remote node connection [rmtAddr=/[host1]:35269, rmtPort=35269
[11:43:34,674][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery accepted incoming connection [rmtAddr=/[host1], rmtPort=51961]
[11:43:34,674][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery spawning a new thread for connection [rmtAddr=/[host1], rmtPort=51961]
[11:43:34,679][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Started serving remote node connection [rmtAddr=/[host1]:51961, rmtPort=51961]
[11:43:34,684][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Received ping request from the remote node [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:51961, rmtPort=51961]
[11:43:34,685][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Finished writing ping response [rmtNodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:51961, rmtPort=51961]
[11:43:34,686][INFO][tcp-disco-sock-reader-[]-#5-#45][TcpDiscoverySpi] Finished serving remote node connection [rmtAddr=/[host1]:51961, rmtPort=51961
[11:43:34,732][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery accepted incoming connection [rmtAddr=/[host1], rmtPort=54361]
[11:43:34,732][INFO][tcp-disco-srvr-[:47500]-#3-#43][TcpDiscoverySpi] TCP discovery spawning a new thread for connection [rmtAddr=/[host1], rmtPort=54361]
[11:43:34,737][INFO][tcp-disco-sock-reader-[]-#6-#46][TcpDiscoverySpi] Started serving remote node connection [rmtAddr=/[host1]:54361, rmtPort=54361]
[11:43:34,741][INFO][tcp-disco-sock-reader-[973d6f42 [host1]:54361]-#6-#46][TcpDiscoverySpi] Initialized connection with remote server node [nodeId=973d6f42-df7c-4a73-b157-c6562ea8f7fe, rmtAddr=/[host1]:54361]
[11:43:34,759][SEVERE][main][IgniteKernal] Failed to start manager: GridManagerAdapter [enabled=true, name=o.a.i.i.managers.discovery.GridDiscoveryManager]
class org.apache.ignite.IgniteCheckedException: Failed to start SPI: TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [clsFilter=org.apache.ignite.marshaller.MarshallerUtils@53cdecf6], reconCnt=10, reconDelay=2000, maxAckTimeout=600000, soLinger=5, forceSrvMode=false, clientReconnectDisabled=false, internalLsnr=null, skipAddrsRandomization=false]
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:302)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:967)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1935)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1298)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2046)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1698)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1114)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:612)
at org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:43)
at org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:74)
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to join node to the active cluster (the config of the cache 'default' has to be merged which is impossible on active grid). Deactivate grid and retry node join or clean the joining node.
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:2018)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:1189)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:462)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:2120)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:299)
... 9 more
[11:43:34,767][SEVERE][main][IgniteKernal] Got exception while starting (will rollback startup routine).
class org.apache.ignite.IgniteCheckedException: Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1940)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1298)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2046)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1698)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1114)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:612)
at org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:43)
at org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:74)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to start SPI: TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [clsFilter=org.apache.ignite.marshaller.MarshallerUtils@53cdecf6], reconCnt=10, reconDelay=2000, maxAckTimeout=600000, soLinger=5, forceSrvMode=false, clientReconnectDisabled=false, internalLsnr=null, skipAddrsRandomization=false]
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:302)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:967)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1935)
... 7 more
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to join node to the active cluster (the config of the cache 'default' has to be merged which is impossible on active grid). Deactivate grid and retry node join or clean the joining node.
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:2018)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:1189)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:462)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:2120)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:299)
... 9 more
[11:43:34,772][INFO][main][GridTcpRestProtocol] Command protocol successfully stopped: TCP binary
[11:43:34,774][INFO][tcp-disco-sock-reader-[973d6f42 [host1]:54361]-#6-#46][TcpDiscoverySpi] Finished serving remote node connection [rmtAddr=/[host1]:54361, rmtPort=54361
[11:43:39,781][INFO][main][TcpDiscoverySpi] No verification for local node leave has been received from coordinator (will stop node anyway).
[11:43:39,794][INFO][main][IgniteKernal]
我收到这些错误是因为 XML 文件上的缓存配置与 Program.cs
中 C# 的缓存配置不匹配吗?我还必须在 XML 文件中添加查询实体吗?如果是这样,我该怎么做?
您正在尝试设置两个具有相同名称的不匹配缓存配置。 看看这条消息:
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to join node to the active cluster (the config of the cache 'default' has to be merged which is impossible on active grid). Deactivate grid and retry node join or clean the joining node.
此特定错误表示如果群集已激活,则无法合并配置。据我了解,在您的情况下,从服务器节点的 xml
配置中删除 default
缓存配置就足够了。您正在使用 ignite.GetOrCreateCache
检索缓存代理,这意味着当您调用它时将创建 default
缓存。