简体   繁体   中英

Orleans Specify SqlServer for Liveness

I am trying to setup a test environment for Orleans that uses SQL Server for liveness. This is my server config file:

<?xml version="1.0" encoding="utf-8" ?>
<OrleansConfiguration xmlns="urn:orleans">
  <Globals>
    <Liveness LivenessType="SqlServer" DeploymentId="42783519-d64e-44c9-9c29-111111111133" DataConnectionString="Data Source=.\\SQLEXPRESS;Initial Catalog=Orleans;Integrated Security=True;" />
    <!--<SeedNode Address="localhost" Port="11111" />-->
  </Globals>
  <Defaults>
    <Networking Address="localhost" Port="11111" />
    <ProxyingGateway Address="localhost" Port="30000" />
    <Tracing DefaultTraceLevel="Info" TraceToConsole="true" TraceToFile="{0}-{1}.log">
      <TraceLevelOverride LogPrefix="Application" TraceLevel="Info" />
    </Tracing>
    <Statistics MetricsTableWriteInterval="30s" PerfCounterWriteInterval="30s" LogWriteInterval="300s" WriteLogStatisticsToTable="true" />
  </Defaults>
  <Override Node="Primary">
    <Networking Address="localhost" Port="11111" />
    <ProxyingGateway Address="localhost" Port="30000" />
  </Override>
</OrleansConfiguration>

When I use this config I get this error when running:

MembershipTableGrain cannot run without Seed node - please check your silo configuration file and make sure it specifies a SeedNode element. Alternatively, you may want to use AzureTable for LivenessType. Parameter name: grain = MembershipTableGrain Exception = System.ArgumentException: MembershipTableGrain cannot run without Seed node - please check your silo configuration file and make sure it specifies a SeedNode element. Alternatively, you may want to use AzureTable for LivenessType.

and further up, the logs say that the Liveness is MembershipTableGrain (which is the default and requires a SeeNode). What am I missing here?

My silo config for SQLServer membership looks like this

<?xml version="1.0" encoding="utf-8"?>
<OrleansConfiguration xmlns="urn:orleans">
    <Globals>
        <SystemStore SystemStoreType="SqlServer" DeploymentId="YYYYY" DataConnectionString="Server=THESERVER;Database=Orleans;User ID=USER;password=PASSWORD;"/>
    </Globals>
    <Defaults>
        <Networking Address="" Port="11111"/>
        <ProxyingGateway Address="" Port="30000"/>
    </Defaults>
</OrleansConfiguration>

No need to specify the liveness type. It figures it out by looking at the SystemStoreType.

The client config does need the gateway specified

<ClientConfiguration xmlns="urn:orleans">

  <SystemStore SystemStoreType ="SqlServer" 
                 DeploymentId="YYY" 
                 DataConnectionString="Server=THESERVER;Database=Orleans;User ID=USER;password=PASSWORD;" />

  <GatewayProvider ProviderType="SqlServer"/>
</ClientConfiguration>

您还可以使用可编程API进行配置,而不是使用XML。

I found the problem. That is not how to change the Liveness type. It should be like this:

<SystemStore SystemStoreType="SqlServer" DeploymentId="42783519-d64e-44c9-9c29-111111111133" DataConnectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Orleans;Integrated Security=True;" />
<Liveness LivenessType="SqlServer" />

Also, you must make sure to ref "Microsoft.Orleans.OrleansSqlUtils" NuGet package and run this SQL Create Script

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM