Saturday, February 25, 2012

WSO2 Message Broker to publish in Message Boxes(SQS) using WSO2 ESB

In this post i’ll describe how we can configure WSO2 Message Broker and WSO2 ESB together. (Note : Here I'm using ESB_HOME as WSO2 ESB installation directory path and MB_HOME as WSO2 MB installation directory path.)

In this first instance we are going to get the WSO2 ESB and MB to work together.
Once you have downloaded and unzipped

Open carbon.xml in MB_HOME/repository/conf directroy and set the offset value to 1,then

Start WSO2 Message Broker.


Open event-broker.xml file in ESB_HOME/repository/conf directory and change deliveryManager type "remote".Then uncomment remoteMessageBroker details & set service port to 9444  & qpidPortto 5673 as below


<deliveryManager name="deliveryManager"
                         class="org.wso2.carbon.event.core.internal.delivery.jms.QpidJMSDeliveryManagerFactory"
                         type="remote">

             <remoteMessageBroker>
                <hostName>localhost</hostName>
                <servicePort>9444</servicePort>
                <webContext>/</webContext>
                <userName>admin</userName>
                <password>admin</password>
                <qpidPort>5673</qpidPort>
                <clientID>clientID</clientID>
                <virtualHostName>carbon</virtualHostName>
            </remoteMessageBroker>
        </deliveryManager>


After Start WSO2 ESB

Then create topic name test in WSO2 ESB & subscribe. You can create a subscription to the topic by providing the information on subscription as below

1.Topic
2.Subscription Mode
The default mode for the subscription is "Topic Only". With this mode , user creates the subscription only to the topic

3.Event Sink URL
you can create a subscription by providing the Event Sink URL : https://localhost:9443/services/EventSinkService/getOMElement
(Note : You can create a simple axis2service and use it's URL as the EventSinkURL . Inorder to create an axis2service ,
Browse the location : /wso2mb-1.0.3/samples/services/EventSinkService
Type the command : ant)
Now you can create a subscription by providing the Event Sink URL : https://localhost:9443/services/EventSinkService/getOMElement

Create a topic & message box with same name in WSO2 MB & subscribe as sqs://admin/topic_name.Message box provides the Simple Queue Service(SQS) operations.
In SQS, When a message is received by an user, that message is unaccessible for a specified time duration, and this message is not visible for other users till that specified time duration is over. If the message received user did not delete the message in that time duration, the message is visible for other users. This time duration is named as visibility timeout.

After that we Publish xml message in WSO2 ESB it will successfully prompted to WSO2 MB


Using the message box in WSO2 MB User can view the content of the message box by going through link in list view.

Setting up Governance Registry with Oracle RAC

Oracle Real Application Clusters (RAC) is an option for the Oracle Database for clustering and high availability in Oracle database environments.
In an Oracle RAC environment, some of the commands we have used in our oracle.sql is considered inefficient.If someone is testing products on a Oracle RAC, please rename oracle_rac.sql to oracle.sql before running -Dsetup.

Create a new database. This can be done by either using oracle db configuration assistant (dbca) or manually. Do necessary changes to oracle tnsnames.ora and listner.ora files in order to define databases addresses for establishing connections to newly created database. After configuring them, connect to oracle as System DBA using SQL*Plus

 $ sqlplus sys/sys-password as sysdba

As SYS DBA Create a database user,and grant privileges to the user as below:

 Create user USER_NAME identified by PASSWORD account unlock; 
grant connect to USER_NAME; 
grant create session, dba to USER_NAME; 
commit;     


Setup Configuration File

Edit $GREG_HOME/repository/conf/registry.xml and give the following:


 <currentDBConfig>oracle-db</currentDBConfig>
    <dbConfig name="oracle-db">
        <url>jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
                 (ADDRESS=(PROTOCOL=TCP)(HOST=host_1) (PORT=1521))
                 (ADDRESS=(PROTOCOL=TCP)(HOST=host_2) (PORT=1521))
                 (CONNECT_DATA=(SERVICE_NAME=service)))
            </url>
        <userName>USER_NAME</userName>
        <password>PASSWORD</password>
        <driverName>oracle.jdbc.driver.OracleDriver</driverName>
        <maxActive>80</maxActive>
        <maxWait>60000</maxWait>
        <minIdle>5</minIdle>
    </dbConfig>


Edit $GREG_HOME/repository/conf/user-mgt.xml and give the following

<Configuration>
        ...
        <Property name="url">jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
                             (ADDRESS=(PROTOCOL=TCP)(HOST=host_1) (PORT=1521))
                             (ADDRESS=(PROTOCOL=TCP)(HOST=host_2) (PORT=1521))
                             (CONNECT_DATA=(SERVICE_NAME=service)))</Property>
        <Property name="userName">USER_NAME</Property>
        <Property name="password">PASSWORD</Property>
        <Property name="driverName">oracle.jdbc.driver.OracleDriver</Property>
        <Property name="maxActive">50</Property>
        <Property name="maxWait">60000</Property>
        <Property name="minIdle">5</Property>
    </Configuration>

 Copy JDBC Driver

When we connecting WSO2 Governance Registry with Oracle 11g versions we want to copy the newest version oracle jdbc libraries to
$CARBON_HOME/repository/components/lib.If we used previous one ArrayIndexOutOfBoundsException arise.

 Create the database tables

Windows users can run $GREG_HOME/bin/wso2server.bat -Dsetup to create the database tables when starting WSO2 Governance Registry for the first time. Linux users should use $GREG_HOME/bin/wso2server.sh -Dsetup



Sunday, February 5, 2012

Perform a Generic OEL 5.4 installation

Perform a Generic OEL 5.4 installation

prepare the os as with rpm and kernal settings
as follows
General Cd/DVD mount
mkdir /media/cdrom
mount -t iso9660 -o ro /dev/cdrom /media/cdrom
cd /media/cdrom/Server
Specific mount

cd /media/Enterprise\ Linux\ dvd\ 20090908/Server/

# rpm -ivh libaio-devel*rpm

warning: libaio-devel-0.3.106-3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:libaio-devel           ########################################### [ 50%]
   2:libaio-devel           ########################################### [100%]
[root@host5 Server]# rpm -ivh unixODBC-2*rpm unixODBC-devel-2*rpm 
warning: unixODBC-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                
########################################### [100%]
   1:unixODBC               ########################################### [ 25%]
   2:unixODBC               ########################################### [ 50%]
   3:unixODBC-devel         ########################################### [ 75%]
   4:unixODBC-devel         ########################################### [100%]


    

As root, open a terminal window and perform these steps:

Edit /etc/hosts. The file should contain text similar to the following:
vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.100.58  host5.localdomain host5

Configure the kernel.

vi /etc/sysctl.conf

Add the following to the file:

# Kernel paramaters required by Oracle 11gR1
fs.file-max = 6553600
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144

For the /etc/sysctl.conf changes to take effect now issue this command.

sysctl -p 

vi /etc/security/limits.conf

Add these lines:

oracle           soft    nproc           2047
oracle           hard    nproc           16384
oracle           soft    nofile          1024
oracle           hard    nofile          65536
grid           soft    nproc           2047
grid           hard    nproc           16384
grid           soft    nofile          1024
grid           hard    nofile          65536

vi /etc/pam.d/login

Add these lines:

session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
       
 vi /etc/profile

Add these lines: 


if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
    if [ \$SHELL = "/bin/ksh" ]; then
        ulimit -p 16384 
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
    umask 022
fi

 Create Groups and User for Grid Infrastructure

Lets start this section by creating the recommended OS groups and user for Grid Infrastructure on both Oracle RAC nodes:

[root@racnode1 ~]#                               
groupadd -g 1000 oinstall
                             
groupadd -g 1200 asmadmin
                                
groupadd -g 1201 asmdba
                                
groupadd -g 1202 asmoper

groupadd -g 1300 dba
                               
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid

                                
id grid
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper)
                              

Set the password for the grid account:

[root@racnode1 ~]#  
                                
passwd grid
Changing password for user grid.
New UNIX password:  
                                
xxxxxxxxxxx
Retype new UNIX password:  
                                
xxxxxxxxxxx
passwd: all authentication tokens updated successfully.


[grid@host5 ~]$ vi .bash_profile

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=host5.localdomain; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
    if [ \$SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
    umask 022
fi

  Create Groups and User for Oracle Database Software

Next, create the the recommended OS groups and user for the Oracle database software

[root@racnode1 ~]#
groupadd -g 1301 oper
  
                                
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle

[root@racnode1 ~]#  
                                
id oracle
uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)
                            

[root@host5 Server]# passwd oracle
Changing password for user oracle.
New UNIX password: 
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.
[root@host5 Server]# 

[root@host5 Server]# su - oracle
[oracle@host5 ~]$ vi .bash_profile


# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=host5.localdomain; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
    if [ \$SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
    umask 022
fi


  Create the Oracle Base Directory Path

The final step is to configure an Oracle base path compliant with an Optimal Flexible Architecture (OFA) structure and correct permissions. This will need to be performed on both Oracle RAC nodes in the cluster as root.

This guide assumes that the /u01 directory is being created in the root file system. Please note that this is being done for the sake of brevity and is not recommended as a general practice. Normally, the /u01 directory would be provisioned as a separate file system with either hardware or software mirroring configured. 


[root@racnode1 ~]#  
                                
mkdir -p /u01/app/grid
[root@racnode1 ~]#  
                                
mkdir -p /u01/app/11.2.0/grid
[root@racnode1 ~]#  
                                
chown -R grid:oinstall /u01
[root@racnode1 ~]#  
                                
mkdir -p /u01/app/oracle
[root@racnode1 ~]#  
                                
chown oracle:oinstall /u01/app/oracle
[root@racnode1 ~]#  
                                
chmod -R 775 /u01