Updates from August, 2014 Toggle Comment Threads | Keyboard Shortcuts

  • Richard 10:37 am on August 29, 2014 Permalink |  

    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.

     
  • Richard 10:22 am on August 13, 2014 Permalink |  

    Public IP Addresses for Amazon 

    I previously blogged about the public IP address ranges for Azure.

    The public IP addresses ranges for Amazon has recently been updated. Amazon has over 8 million addresses, which is 8 times the number Azure has.

    Interestingly, these are not so evenly distributed:

    Untitled

    Raw data:

    DC Total public IP addresses
    US East (Northern Virginia) 3694592
    US West (Oregon) 1507328
    EU (Ireland) 1332224
    Asia Pacific (Tokyo) 739328
    US West (Northern California) 655360
    Asia Pacific (Sydney) 327680
    Asia Pacific (Singapore) 313344
    South America (Sao Paulo) 245760
    China (Beijing) 65536
    GovCloud 16384
    TOTAL 8897536

    I have also updated my tool to look up which DC a website is hosted in, to include the Amazon IP ranges.

     
  • Richard 11:12 am on August 7, 2014 Permalink |  

    Enabling SSL for Self Hosted Nancy 

    One of the things I like about Nancy is the ease of creating self hosted HTTP services.

    Here’s how to enable HTTPS for your service.

    First of all, create your SSL certificate:

    $ openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem
    $ openssl pkcs12 -export -in cert.pem -inkey key.pem -out mycert.pfx
    

    Then go to ‘Manage Computer Certificates’ in the start menu (I’m using Windows 8.1).

    Right click on ‘Personal’ and import the freshly created mycert.pfx.

    Untitled

    Now go to your newly installed certificate, and get the thumbprint:

    Untitled2

    Now you need to register the URL with Windows:

    $ netsh http add urlacl url=https://+:4443/ user=YOUR_USERNAME
    $ netsh http add sslcert ipport=0.0.0.0:4443 certhash=‎YOUR_THUMBPRINT_WITHOUT_SPACES appid={06aabebd-3a91-4b80-8a15-adfd3c8a0b14} 
    

    You need to substitute your username, and the certificate thumbprint you copied (without the spaces)

    The appid is just a random guid, feel free to create your own.

    Now start nancy on this Uri https://localhost:4443/.

    using (var host = new NancyHost(new Uri("https://localhost:4443/")))
    {
        host.Start();
        Console.ReadKey();
    }
    
     
    • mbharallmansitech 1:38 pm on December 16, 2014 Permalink | Log in to Reply

      How to check that HTTPS request working in Nancy Host or not?

    • Richard 1:50 pm on December 16, 2014 Permalink | Log in to Reply

      send it an HTTPS request from your browser?

    • Richard 2:12 pm on December 16, 2014 Permalink | Log in to Reply

      Sounds like it didn’t work.

      Try putting some logging in your app, and looking at the HTTP traffic in fiddler.

    • Manuraj 2:20 pm on December 16, 2014 Permalink | Log in to Reply

      Let me try once again..

    • Manuraj 2:47 pm on December 16, 2014 Permalink | Log in to Reply

      I created new certificate and then i register them successfully. Then I use browser to send https request and apply break point. But it was not working.

    • Manuraj 5:53 am on December 17, 2014 Permalink | Log in to Reply

      Getting error NET::ERR_CERT_AUTHORITY_INVALID

    • Manuraj 6:47 am on December 18, 2014 Permalink | Log in to Reply

      Getting error HTTP Error 503. The service is unavailable on browser. Can you guide me how i can get response using HTTPS.

    • Manuraj 2:14 pm on January 5, 2015 Permalink | Log in to Reply

      Hi Richard,

      I am able to create certificate and able to register it successfully.

      But when i restart computer, Then nancy started but url related to nancy not work.
      It give error
      “GET https://localhost:4444/t1 net::ERR_CONNECTION_RESET”.

      I try to find the solution. But got no solution.

    • Manuraj 2:58 pm on January 5, 2015 Permalink | Log in to Reply

      Every time i have to run
      netsh http add sslcert ipport=0.0.0.0:4443 certhash=‎YOUR_THUMBPRINT_WITHOUT_SPACES appid={06aabebd-3a91-4b80-8a15-adfd3c8a0b14}
      After that it work. But after restart again i have to use same command.

      Is there any solution for this.

    • afterhourscoding 2:28 pm on June 8, 2015 Permalink | Log in to Reply

      The following command failed for me:
      netsh http add sslcert ipport=0.0.0.0:4443 certhash=‎YOUR_THUMBPRINT_WITHOUT_SPACES appid={06aabebd-3a91-4b80-8a15-adfd3c8a0b14}

      With error:
      SSL Certificate add failed, Error 1312
      A specified logon session does not exist. It may already have been terminated.

      I had to import the certificate using MMC.exe’s certificate for local computer module instead of using certmgr.msc. You can watch the certificate listed using ‘certutil -store My’

    • channygold 10:42 am on July 30, 2015 Permalink | Log in to Reply

      Thanks for this post. Really helpful!

  • Richard 9:00 am on August 4, 2014 Permalink |  

    Public IP Addresses for Microsoft Azure 

    Microsoft publish a list of public IP addresses for the compute services hosted in their Azure Datacenters. When they say ‘compute’ they also include SQL Database, and the storage accounts seem to be included too.

    I thought it would be interesting to write a script to count the total number of IP addresses available for each DC.

    Here’s a pretty graph.

    Untitled

    Whilst the number of public IPs is no way of working out the number of machines provisioned in each DC, it does at least give you an idea of the magnitude of each of the regions.

    Some interesting things to note:

    1. The EU data centers are similar sizes, Dublin being slightly bigger.
    2. The 5 DCs in Asia, Brazil and Japan added together are smaller than US West.
    3. The total number of IPs is just over 1 million.
    4. There seems to be a step change between the largest 6, the next 4, and then the 3 small (and new) DCs in Japan and Brazil.
    5. US West is 28 times larger than Brazil South.
    6. Almost 60% of the IPs are in the USA.

    Here’s my processed data in table:

    DC Total public IP addresses
    uswest 179504
    useast 155808
    europenorth 150400
    europewest 144320
    usnorth 118112
    ussouth 109120
    asiaeast 62384
    uscentral 62336
    asiasoutheast 57440
    useast2 46832
    japanwest 18912
    japaneast 10976
    brazilsouth 6288
    TOTAL 1122432

    I think it will be really interesting to keep an eye on the IP ranges, and see how they change over time (or is it just me?).

    I also published a tool to look up if an IP (or domain name) is hosted in Azure, it also tells you which DC it’s in.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel