Overrides in Orleans Configuration
If you look at the standard OrleansConfiguration.xml
configuration file you get with Orleans, it looks something like this:
<?xml version="1.0" encoding="utf-8"?> <OrleansConfiguration xmlns="urn:orleans"> <Globals> <StorageProviders> <Provider Type="Orleans.Storage.MemoryStorage" Name="MemoryStore" /> </StorageProviders> <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>
This configuration starts a silo listening on port 30000 (ProxyingGateway
), and other silos can talk to it on port 11111 (Networking
). It also identifies a SeedNode
, which is the primary silo in the cluster. The seed node address and port match those specified for this silo, which makes this the primary.
You’ll also notice the Override
section at the bottom, which specifies the same ProxyingGateway
and Networking
ports again.
In this case, the Override
section doesn’t do much, but suppose we want to start a secondary silo? We can specify the ports for a secondary node to use here, like this (in this case a silo on the same machine, so on different port numbers):
<?xml version="1.0" encoding="utf-8"?> <OrleansConfiguration xmlns="urn:orleans"> <Globals> ... </Globals> <Defaults> ... </Defaults> <Override Node="Primary"> <Networking Address="localhost" Port="11111" /> <ProxyingGateway Address="localhost" Port="30000" /> </Override> <Override Node="Secondary"> <Networking Address="localhost" Port="11112" /> <ProxyingGateway Address="localhost" Port="30002" /> </Override> </OrleansConfiguration>
This allows us to use the same configuration file for both a primary and a secondary node, as the other settings will be the same (they must all specify the same primary (seed node)).
To make use of the override, when you start the silo, just specify the name as the first argument.
$ OrleansHost.exe Primary $ OrleansHost.exe Secondary
You can also specify the configuration file you want to use, in case you have several (the default is OrleansConfiguration.xml
).
$ OrleansHost.exe Primary MyConfiguration.xml
Interestingly, when starting a number of silos it only seems necessary to tell a client about one of silos (a primary or secondary) it seems to figure out the cluster members automatically.
Reply
You must be logged in to post a comment.