【发布时间】:2022-01-27 13:22:30
【问题描述】:
在此处下载示例:https://github.com/apache/ignite/tree/master/modules/platforms/dotnet/examples
调整ServerNode.Program.cs中的代码
namespace Apache.Ignite.Examples.ServerNode
{
public static class Program
{
public static void Main()
{
using (var ignite = Ignition.Start(Utils.GetServerNodeConfiguration()))
{
ignite.GetCluster().SetActive(true); **//add one line code here**
Utils.DeployDefaultServices(ignite);
.....
}
}
}
}
调整Util.cs中的代码
public static IgniteConfiguration GetServerNodeConfiguration()
{
return new IgniteConfiguration
{
Localhost = "127.0.0.1",
.......
PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain,
**//add some code here to enable persistence**
DataStorageConfiguration = new DataStorageConfiguration
{
DefaultDataRegionConfiguration = new DataRegionConfiguration
{
Name = "Default_Region",
PersistenceEnabled = true
}
}
};
}
将destroycache方法添加到Apache.Ignite.Examples.Thin.Sql.LinqThin.Program Main方法中如下:
public static void Main()
{
using (var ignite = Ignition.StartClient(Utils.GetThinClientConfiguration()))
{
Console.WriteLine();
Console.WriteLine(">>> Cache LINQ example started.");
........
var sw = Stopwatch.StartNew();
ignite.DestroyCache(OrganizationCacheName);
sw.Stop();
Console.WriteLine($"DESTROY COST {sw.ElapsedMilliseconds}");
.....
}
....
}
在执行detroyCache方法时,有时会抛出socket timeout异常,或者detroy成功有时会花费很长时间。 但是如果不启用持久性,当destroyCache 时一切正常。
【问题讨论】: