Note: This will only work for trial and commercial licensed installation

Steps to setting up your ESB across multiple network in order load balance transactions.

  • Install the ESB on each of your servers that you want to failover to
  • On each server, stop the PServiceBus.ServiceMonitor(If you don't stop it first, it will restart any service you stop) first then stop every PServiceBus.[servicename]. Also stop all the redis server service instance on them
  • Setup a server, Install MSSQL(if you want to do logging and create a database called servicebus).
  • (This is only required if your ESB backplane is redis) - Pull down this folder from https://hg.codeplex.com/pservicebus/file/abcb31765d35/pServiceBus%202.0.0/Redis%20Server.And run the install.bat file in the Redis Server, doing so will install the Redis Window Service. Then you will need to start it, Look for Redis Service in Windows Services console. You will need to allow connection to the port range: 6379-6384 for redis to accept connections.
  • Then on each server you installed PSB on, go to the installation folder and navigate to the "ESB" folder. Then open the app.config file and every where it says localhost:, replace the localhost with your server ipadress/hostname (where you installed the redis server or cassandra). You should also open the configurations.xml and do the same, anywhere you see localhost:
  • While you are still in the ESB folder, you should also change the address in the messageStoreConfig/stores/ node in the app.config file
  • On each server go to the ESB installation folder, and navigate to both the "ESB Gateway" and "ESB Router" folders and open the app.config file. In it replace localhost with the server ipaddress/hostname just like you did for the "ESB" folder.
  • Once all that is done, You should start the PServiceBus.ServiceMonitor service on each server and that will start up all your PServiceBus.* services
  • Now your ESB should be ready to failover and also load balance between servers as needed.

 

 

Doing the above will make it possible for you to point to any of your ESB server endpoint and if any fails, it will reconnect to another available server as needed. You will need to do the following also in your application. You can either do it in code using some kinda of factory or something or by config. 

By doing the following, when the router on one of the server dies, it will look up the next router and try to connect to it

by Code:

 

 
ESBGateway.AddRouterAddress("endpoint://server1:8000");
ESBGateway.AddRouterAddress("endpoint://server2:8001");

 

By Config:

 

<configSections>
    <section name="routerConfig" type="PServiceBus.Services.Gateway.Configurations.ESBRouterConfigSection, PServiceBus"/>
  </configSections>
  <routerConfig>
    <routers>
      <add endpoint="endpoint://server:8000"/>
     <add endpoint="endpoint://server2:8001"/>
    </routers>
  </routerConfig>

Last edited Feb 27, 2014 at 1:09 AM by rpgmaker, version 5

Comments

No comments yet.