Thursday, November 18, 2010

Enable clustering in WSO2 ESB 3.x.x

On this blog post I will guide you on why we need clustering and steps to follow to enable such in WSO2 ESB. The steps are valid for the releases of 3.x.x

Motivation behind clustering

For Real world Enterprise application deployments; scalability and availability of applications are musts. When it comes to products of middle-ware; as the base becomes the middle-ware product itself this is of utmost important. This has lead clustering a popular key word among deployments.

Clustering enables a group of individual items/products to be engage in transactions together as one item/product. These individual items are known as components of a cluster.

Clustering Behind WSO2-ESB

WSO2-ESB has a clearly defined clustering capability for real-world applications. The setup is clearly defined and just could be get over with by few mins. It's that easy.....

You can download the latest WSO2-ESB from here

Step 1
------------
Extract the downloaded WSO2-ESB to folders Cluster_1 and Cluster_2. If you are setting up both the clusters in your local machine you will have to follow the following step in order to avoid clashing http,https ports, else just skip to Step 2.

I will keep the default ports as it is in Cluster_1 and fillowing changes should be made to Cluster_2 folder.

- Go to Cluster_2/wso2esb-3.x.x/repository/conf and open axis2.xml

In the TansportIns section change the default message in-port http 8280 as 8281 or any other; and https port as 8243 as 8241 or any other avoiding conflicts in ports.



Now, you will also have to change the http/https transports of the distributions so that it wont collide;

- Go to Cluster_2/wso2esb-3.x.x/repository/conf and open mgt-transport.xml

In this, change default Admin Console port http 9763 as 9764 or any other; and https port as 9443 as 9444 or any other avoiding conflicts in ports




Step 2
------------

Now we have to enable clustering for both Cluster_1 and Cluster_2 , wso2esb distributions.

- Go to Cluster_1/wso2esb-3.x.x/repository/conf and open axis2.xml

- Browse using the command 'Cluster"

<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="false">
Change the parameter ; as True. This is by default made as "False"
The class attribute of the cluster element specifies the main class of the clustering implementation.

AvoidInitation : whether clustering should be initialized automatically on start
up. By default, this is set to true in the wso2 ESB, which will initialize clustering on start up.

domain : Name of the domain of a cluster. All nodes that use the same domain name belongs to the same cluster. By specifying different domain names different clusters can be created.

mcastAddress/mcastPort/mcastFrequency/mcastDropTime : These are parameters which are set globally for the nodes of one cluster.

localMemberhost/localMemberPort : This sugeest that the defined esb distribution specfies its own port and ip-address. Therefore change the localMemberhost to the machine IP from default (127.0.0.1) or comment out if you're setting up in your own machine, and different ports for localMemberPort (e.g. 4000 and 4001) for the Cluster_1 and Cluster_2.

After the changes, your axis2.xml Clustering configuration would look like something below or similar.


Step 3
------------

You are all set to go in to a cluster mode. You may no 'cd' to the Cluster_1/wso2esb-3.x.x/bin and Cluster_2/wso2esb-3.x.x/bin directory and start the setup by following command

./wso2server.sh (In Unix) ./wso2server.bat (In Windows)

Upon successful enabling of the cluster you will note the following details on the console of Cluster_2.




Clustering Example - A Load Balancing system
----------------------------------------------------------------------------------------

WSO2 ESB, can be used to achieve high availability within a clustered ESB.

Imagine a case where, all client requests are always directed to a primary node via the load balancer. Node 2 and Node 3 are kept as back up servers and no requests will be directed under normal operations.

With all three nodes configured as a cluster, when the primary Node fails, the load balancing system will forward to a Node 2 as the primary server with the other as a backups. This will ensure NO data loss within the system ensuring high reliability.

There are whole bunch of examples that could be given with the use of throttling; caching; Failover; validation through the use of WSO2-ESB.

Visit us; http://wso2.org/library/esb , http://wso2.org/support
Talk to us; support@wso2.com

Monday, August 9, 2010

Learn VIM in 15 mins :)


Vim although looks scary seems to be a handy tool if you just master it. I found the most used commands and just pointing them out so it would be easier for any to start working with vim right away......


Opening a VIM File

In the terminal type :: vim xxxxx.txt

THe filename xxxxx will be opened from vim. If you havenot installed vime, you may install by typing, ' sudo apt-get install vim '

VIM Basics ...

Moving around with cursor:
h key = LEFT, l key = RIGHT, k key = UP, j key = DOWN
Exiting vim editor without saving:
press ESC to get into command mode, enter :q! to exit.
Deleting characters in vim command mode:
delete with x key
Inserting / appending text:
Press i or a in command mode and type
Saving changes and exit:
in command mode :wq or SHIFT+zz



VIM Operators and Motions summary

Deleting words:
delete word with d operator and w or e motion
Deleting to the end of the line:

delete to the end of the line with d operator and $ motion
Using operators, motions and counts:

beginning of the line 0, end of the line $, end of the 2nd word 2e beginning of the 4th word 4w
Deleting multiple words:

to delete 3 words you would use d3w
Deleting lines:

to delete single line dd, delete n lines ndd
Undo changes:

undo changes with u



VIM apprentice user summary

Paste command:
paste your cache memory with p command
Replace characters:

rt replace current character with t
Change characters:

ce to change single word, c$ to change to the end of the line



VIM experienced user summary

Advanced Navigation:
end of the file G, beginning of the file gg or 1G, to get on line n use nG instruct vim display file information CTRL+g
Search text with vim:

search forward /, search backward ?, next search n , previous search N
Vim Substitution :

- first occurrence single line :s/bash/perl/
- all occurrences single line :s/bash/perl/g
- first occurrence between line range: :23,100s/bash/perl/
- all occurrences between line range: :23,100s/bash/perl/g
- first occurrence in whole text: :%s/bash/perl/

- all occurrences whole text: :%s/bash/perl/g VIM veteran user summary

Execute external commands on shell from vim:

:!ls will execute ls command on your shell
Writing to files advanced:
:w saves current file without quit, :w bash.sh whites to file bash.sh
Highlight text and save to different file:

highlight text with v operator and save it with :w
Retrieve text from different file:
:r will retrieve content of file



VIM expert user summary

Using o operator:
:o insert line bellow you cursor, O inserts line above your cursor
Copy and paste:

yank line with y and paste it with p
Customize vim's environment:

edit ~/.vimrc file to customize vim's environment




Hope this summary works !! For more information have a look at [1]

[1] http://www.linuxconfig.org/Vim_Tutorial







Sunday, July 25, 2010

ESB - Introduction

There seems to be no specific introduction for an ESB (Enterprise Service Bus) but this presentation helps to understand what an ESB does and depending on the features it has an ESB definition may vary.......


http://www.infoq.com/presentations/Enterprise-Service-Bus


Features it may have :

1. Routing
2. Message Transformation
3. Message Enhancement
4. Protocol Transformation
5. Service Mapping
6. Message Processing
7. Process Choreography
8. Service Orchestration
9. Transaction Management
10. Security


Close Definition could be written up as follows;

Standards based integration platform that combines messaging, web services, data transformation & intelligent routing to reliably connect & coordinate interaction of diverse applications....

Thursday, July 15, 2010

I'm Ishani, an Electrical Engineer by profession; at least up to now when I started blogging ! , and I graduated from University of Moratuwa a year before.

I always wanted to do Computer Engineering but due to lack of marks in the semesters I ended up as a graduate in Electrical Engineering. With the four years learning in the field I felt it in vain to give up on the Electrical and move on to a complete new field with the degree at hand. Soon after my final exams at the university I was offered a Job in Electrical Engineering at a prestigious company.

So I took the offer and started working. Day by day I understood that this was not the line for me. The stream I worked doesn't revolve all the time. I felt it was too static and routine and I was just held back at the Job. And the stress of other people were building up on me with no direct connection with their jobs over mine.

It may be too fast to comment on a field and move on to another since you just had a bad experience. However, with the experience I've gained I decided to change course in my carrier. It was a tough decision which took me one year to realise that the place I dreamt was not the place I'll be if I be an Electrical Engineer !!

We, Engineers seems to be very restricted in our arena and tends to be working solely on management rather than what an Engineer is ought to do. Some may disagree to my thought; and I believe I'm too young in the society to make such a comment.

~ For many people a job is more than an income – it's an important part of who we are. So a career transition of any sort is one of the most unsettling experiences you can face in your life. ~

Moving in to a new field with new technologies and new developments is practically scares me in to bits.

However, I'm thankful for the opportunity I've been given, and to those who helped me to make my decision to move ahead in my carrier.

I believe in my self to be a success; to learn what I've always wanted...... I just take up the Challenge !!

Cheers !
Ishani