Tuesday, 29 March 2016

SOP - Software Object Pooling

SOP - Software Object Pooling

SOP tells that rather a creating an object again and again, use of connection pool.
Re-usability of object critical is important. You should manage pool on your own. Life-cycle management of pool is tedious task.

Connection pool
Data source connection pool mechanism is made mandated to all J2EE servers from Java Soft.

java.sql.Connection satisfies the following things declared by SOP.

1) Costly to create connection.
2) Very frequently used
3) Difficult to deploy(GC)

JBOSS Deployment procedure


1) Add Archive to your domain.

Add button in the Deployments tab will let you browse your war file. Once the file is uploaded you'll find the following entry in Documents\vamsi\DC_replica\dc\configuration\domain.xml 

<deployments>
        <deployment name="example.war" runtime-name="example.war">
            <content sha1="cbe0a3a1e144bf6d37dba6cba8ccbc46000fef39"/>
        </deployment>
</deployments>

2) Mapping to application app servers. This you can do from deployments tab.


.

<deployments>
        <deployment name="example.war" runtime-name="example.war">
            <content sha1="cbe0a3a1e144bf6d37dba6cba8ccbc46000fef39"/>
        </deployment>
    </deployments>

    <server-groups>
        <server-group name="Optum-Dev-Group" profile="default">
            <socket-binding-group ref="standard-sockets"/>
            <deployments>
                <deployment name="example.war" runtime-name="example.war"/>
            </deployments>
        </server-group>
        <server-group name="Optum_Prod_Group" profile="ha">
            <socket-binding-group ref="ha-sockets"/>
        </server-group>
    </server-groups>

http://192.168.1.208:8180/example/ - This is where you can test the application deployed properly or not.


Monday, 28 March 2016

JBOSS Configuration Stand Alone Mode

When you prepare another instance for standalone - copy deployments,lib and configuraiton from this location.

Documents\vamsi\EAP-6.4.0\standalone

JBOSS Configuration Domain Mode


Available Jvm's

-------------------
Hotspot JVM
IBM JVM
Oracle JVM
Open JDK


Different Application Servers

------------------------------------
JBoss Application Server
Weblogic
Websphere
Glassfish
Oracle Application Server


Domain Controller(DC)

Host Controller(HC)

Host Controller connects to DC, it's HC's responsibility to connect to DC.

DC is would just run and up, whenever HC connects to DC,DC got all the right to control over HC\s and knowledge ahout HC.


You must put servers in server groups in jboss.

server groups may span acrooss differet hosts
server1 from host1(HC) and server2 from host2(HC) can belongs to same group.

command to start DC - domain.bat

1) It will find out the location of the configuration file. -Djboss.domain.base.dir (bedefault points to jboss installation dir)
2) Go to the configuraiton folder and loads the host.xml in the memory.
3)Host will check <domain-controllerr>, wheather to act as DC or HC.

<domain-controllerr>

     <local/>      - it's DC
</domain-controllerr>


<domain-controllerr>

      <remote host="192.168.0.14" port="9999"/> - it's HC
</domain-controllerr>

with help of <local/> or <remote/> it'll identify it's a DC or HC.


Documents\vamsi\EAP-6.4.0\domain\configuration


host.xml - this is where your <domain-controllerr> configurations.

host-slave.xml - sample file given by jboss
host-master.xml - sample file given by jboss

HC is the service running on a host.


IBM practice - One DC and two HC's installed in different mechines to avoid port conflicts




Configuring DC:


1) We will use host-master.xml

2) specify name to your domain controller
3) Modify interfaces and provide ip address rather than using localhost

<interfaces>

        <interface name="management">
            <inet-address value="${jboss.bind.address.management:192.168.1.208}"/>
        </interface>

</interfaces>


Documents\vamsi\DC_replica\dc\configuration\host-master.xml


start domain controller


 domain.bat -Djboss.domain.base.dir=C:\Users\edi5752\Documents\vamsi\DC_replica\dc  -bydefault it picks up host.xml


-> domain.bat -Djboss.domain.base.dir=C:\Users\edi5752\Documents\vamsi\DC_replica\dc --host-config=host-master.xml


C:\Users\edi5752\Documents\vamsi\EAP-6.4.0\bin>domain.bat -Djboss.domain.base.di

r=C:\Users\edi5752\Documents\vamsi\DC_replica\dc --host-config=host-master.xml

Admin console listening on http://192.168.16.1:9990

Http management interface listening on http://192.168.16.1:9990/management






Documents\vamsi\DC_replica\dc\configuration\domain.xml

The Domain.xml is equalent to standalone.xml in standalone mode.

DC uses host.xml and domain.xml
HC uses host.xml, a unique host.xml is defined for each HC in DC.

When your HC get started, DC must be available, since it need a lot of information from DC while it's starting. It doesn't harm if DC is down once HC is up.

HC's only use host.xml not domain.xml found in it's configuration folder, we can delete them as they have no use.

Configure Host Controller(HC1):


1) We will use host-slave.xml in HC1
2) Modify host-slave.xml

provide a name to this host: Documents\vamsi\DC_replica\hc1\configuration\host-slave.xml
<host name="vamshi-host1" xmlns="urn:jboss:domain:1.7">
3) Increment the native port of HC1(port 9999) is already getting used by DC on same machine)

Documents\vamsi\DC_replica\hc1\configuration\host-slave.xml

<management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.native.port:19999}"/>
            </native-interface>

</management-interfaces>

4) Specify location(ip) of domain controller and native port of DC, so that HC can connect to DC while starting up.

<domain-controller>
       <remote host="${jboss.domain.master.address:192.168.1.208}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/>
    </domain-controller>

    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:192.168.1.208}"/>
        </interface>
        <interface name="public">
           <inet-address value="${jboss.bind.address:192.168.1.208}"/>
        </interface>
        <interface name="unsecure">
            <!-- Used for IIOP sockets in the standard configuration.
                 To secure JacORB you need to setup SSL -->
            <inet-address value="${jboss.bind.address.unsecure:192.168.1.208}"/>
        </interface>

    </interfaces>

5) Ensure all the servers on this host using unique ports
6) starting host controller
domain.bat -Djboss.domain.base.dir=C:\Users\edi5752\Documents\vamsi\DC_replica\hc1 --host-config=host-slave.xml

You can find the following statement recorded to domain consile as soon as it revieves connection from HC1.

[Host Controller] 12:04:00,944 INFO  [org.jboss.as.domain] (Host Controller Serv
ice Threads - 31) JBAS010918: Registered remote slave host "vamshi-host1", JBoss

 EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21)







Configure Host Controller(HC2):

Follow the same steps you did for HC1 along with the following one to avoid port conflicts.

For the second HC change ports : port-offset incremented by 1 here.

<servers>
        <server name="server-one" group="main-server-group">
            <socket-bindings port-offset="1"/>
        </server>
        <server name="server-two" group="other-server-group">
            <!-- server-two avoids port conflicts by incrementing the ports in
                 the default socket-group declared in the server-group -->
            <socket-bindings port-offset="151"/>
        </server>

    </servers>


domain.bat -Djboss.domain.base.dir=C:\Users\edi5752\Documents\vamsi\DC_replica\hc2 --host-config=host-slave.xml

C:\Users\edi5752\Documents\vamsi\EAP-6.4.0\bin>domain.bat -Djboss.domain.base.di

r=C:\Users\edi5752\Documents\vamsi\DC_replica\hc2 --host-config=host-slave.xml





Delete Configurations:

All these steps need to be followed sequentially.

  1. Stop all servers.
  2. Delete all servers for all hosts.
  3. Delete server groups.


You can stop/start servers from the console.







Now to create servers , you need follow the above steps in reverse order
All these steps need to be followed sequentially.


  1. Create server groups.
  2. Create all servers for all hosts.
  3. Start all servers.



JBoss Settings

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository/>
    <profiles>
        <profile>
            <id>jboss-ga</id>
            <repositories>
                <repository>
                    <id>jboss-ga-repository</id>
                    <name>JBoss GA Tech Preview Maven Repository</name>
                    <url>http://maven.repository.redhat.com/techpreview/all</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>jboss-ga-plugin-repository</id>
                    <name>JBoss 6 Maven Plugin Repository</name>
                    <url>http://maven.repository.redhat.com/techpreview/all</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>jboss-ga</activeProfile>
    </activeProfiles>
</settings>

Friday, 25 March 2016

Mule Develpment

Mule ESB - Enterprise Service Bus

Mule ESB is integration platform.
Mule is open source application.
Mule can work with any JMS Provider including Active MQ , Websphere MQ and Tibco.

JMS Q
Mule MQ can work as JMS Server.
Jboss Fuse and Mule are leaders in ESB Arena.

Palate  -
Canvas -

If you develop any service and it's following SOA architecture, you can use MULE as integration platform.

100 thousand developers already using Mule Esb.
Light weight ESB.

 

Thursday, 10 March 2016

Linux

Linux Basic Commands :

  • uname -a  : Gives us OS information.

IBX AIX :
vi : Esc + x - to delete data
vi : Esc + I  - insert data

  • chmod 777 <file/directory>
0 – no permission
1 – execute
2 – write
3 – write and execute
4 – read
5 – read and execute
6 – read and write
7 – read, write, and execute

  • sudo - super user do - Sue dough
 Have you ever tried to run a command in terminal only to be given “Access Denied?”  Well this is the command for you!  But, with great power comes great responsibility!  It is much better than logging in as root, or using the su “switch user” command.

sudo –b will run the command in the background.  This is useful for commands that display a lot of output as they are running.
sudo –s will run the shell specified with elevated privlages, giving you the # prompt (don’t forget to exit!)
sudo su – will make you the root user and load your custom user environment variables.

https://linuxacademy.com/blog/linux/linux-commands-for-beginners-sudo/

  • ps -ef | grep <processName>
  • ps aux | grep <processName>
To run a file having different user priviliges:
sudo su -c "sh elasticsearch" -s /bin/sh aneela1
sudo -b su -c "sh elasticsearch" -s /bin/sh aneela1  - to run it background
sudo -b su -c "sh kibana" -s /bin/sh aneela1

something.sh -d -p pid    -to run a process as demon
ls -ltr | wc -l    -to see no of files existing