Download JBossEAP6 Pass Guarantee Paper ...
Redhat JBoss EAP 6 - JB248 Exam Paper v2.0
SECTION I
2
1. INSTALL JBOSS IN /OPT
2
CONFIGURE DOMAIN , SERVER GROUP AND DEFAULT INSTANCE BY USING DEFAULT PROFILE. DO NOT USE “HA” , “FULL” & “FULL-HA” .......................................................................................................... 3 2.1. CONFIGURE DOMAIN WITH NAME AS SERVER1 ...................................................................................... 3 2.2. CONFIGURE SERVER GROUP AND ONE JBOSS INSTANCE ....................................................................... 3 3. HTTP PARAMETER TUNING ..................................................................................................................... 4 3.1. Use the default standard http connector ............................................................................................ 4 3.2. Set Max Connections to 50 for http connector ................................................................................... 4 3.3. Configure AJP Connector ................................................................................................................. 5 ADD A SOCKET TO THE SOCKET BINDING GROUP. .......................................................................................... 8 TO ADD A SOCKET TO THE SOCKET BINDING GROUP, ISSUE THE FOLLOWING COMMAND, REPLACING THE PROTOCOL AND PORT WITH THE ONES YOU NEED. ............................................................................................. 8 ADD THE SOCKET BINDING TO THE WEB SUBSYSTEM. .................................................................................... 8 ISSUE THE FOLLOWING COMMAND TO ADD A CONNECTOR TO THE WEB SUBSYSTEM , SUBSTITUTING THE SOCKET BINDING NAME AND PROTOCOL WITH THE ONES YOU NEED . .............................................................................. 8 4. JVM CONFIGURATION ...........................................................................................................................
8 4.1. Configure JVM at group level. Even if you add additional instances, new JVM settings would get replicated. .................................................................................................................................................... 8 STACK SIZE ADDITION CANNOT BE DONE FROM MANAGED CONSOLE .......................................................... 9 ADDING THE PIECE IN BETWEEN GROUP LINES ................................................................................................ 10 5. REMOVE THE EXAMPLEDS WHICH IS IN-MEMORY BASED DATASOURCE. ........................................... 11 5.1. ExampleDS Datasource in in-memory based Datasource which comes default with JBoss EAP 6.0. Do not remove h2 driver. ........................................................................................................................... 11 6. CONFIGURE NON-XA DATASOURCE.................................................................................................... 11 6.1. Configure Non-XA datasource with below attributes ....................................................................... 11 7. DBMS SECURITY SETUP ....................................................................................................................... 14 7.1. Application authentication with Database. ...................................................................................... 14 8. DEPLOY THE APPLICATION AS ROOT CONTEXT .................................................................................. 17 9. CONFIGURE XA DATASOURCE ............................................................................................................. 18 SECTION II ..................................................................................................................................................... 19 10. CONFIGURE TWO HOST CONTROLLERS ............................................................................................ 19 10.1. Configure two groups. ................................................................................................................
19 11. CONFIGURE TCP BASED CLUSTERED ENVIRONMENT SETUP. .......................................................... 22 12. CONFIGURE APACHE BASED LOAD BALANCER. ................................................................................ 23 13. CONFIGURE JMS............................................................................................................................... 26
There would be 2 sections and each section is 50% of marks. You have to achieve 210 Marks out of 300. CAUTION: User would not be provided with root access. To perform all the activities, jboss account is given all kind of privileges. NO NEED of using sudo command even to copy apache modules to /etc/httpd/modules. CAUTION: After each and every topic, test the configuration question would help you to assist that your configuration is complete and successful. IF you get the result based on test the configuration, then you are would be getting cent percent marks for that topic
Section I
1. Install JBoss in /Opt
Setup JBoss in domain mode with installation directory as /opt/ex248. Install jboss under /opt and then rename the jboss-eap-6.0 to ex248. You would be provided with link to download jboss-eap.6.0 in either zip format or jar format. Better to choose jar format binaries, because it gets installed with Native libraries. (Native binaries which would be used to setup mod-cluster) You would be provided with webApps directory which would have all the war/ear files Path of war/ear/jar files è /home/jboss/Desktop/webapps NOTE: Your login session would be as “jboss” Account.
Step #1:
Check whether java is installed.
$ which java ( This confirms whether java is installed ) /etc/alternatives/java_sdk/bin/java Step #2:
Download JBoss binaries and install in /opt
Step #3: $ java –jar jboss-eap-installer-6.0.0.GA.jar
Give the Specified Path è /opt Give the credentials as
User :webmin password :asecret 2
Step#4:
Move the Installed JBoss EAP.
$ mv jboss-eap-6.0 ex248 $ /opt/ex248/bin/domain.sh &
Configure domain , server group and default instance by using default profile. DO NOT use “ha” , “full” & “full-ha” Configure domain with name as server1 NOTE:
Do NOT modify any configurations and use default settings.
Solution: Step#1:
cp –R /opt/ex248/domain server1
Step#2:
Start in background
/opt/ex248/bin/domain.sh /opt/ex248/server1 & NOTE: IF you start in server1 domain, it would be bind to Loopback IP-Address 127.0.0.1. Remaining 8 Questions would have to be performed on this environment. IMPORTANT: Take backup of domain.xml & host.xml files inside server1 domain.
Testing the Configuration: Access the JBoss Domain console: http://localhost:9990 Credentials: You might have already given while installing Login: webmin Passwd:
asecret
NOTE: Delete existing default groups and server instances, which come as pre-built.
Configure Server group and One JBoss Instance Solution: Step #1:
http://localhost:9990
Step#2:
Configure one group with name as prod-group of “default” profile.
NOTE: DO NOT use either “ha” , “full” or “full-ha” profiles.
3
Step#3:
Configure one JBoss Instance with name as Server One
Give the port-offset as 0 (zero)
Testing the Configuration: Access the URL in browser: http://localhost:8080
3. Http parameter Tuning Use the default standard http connector http://localhost:8080
Testing the Configuration: Access http://localhost:8080 à You should see the JBoss welcome Page.
Set Max Connections to 50 for http connector
Step #1: $ cd /home/jboss/jboss-eap-6.0/bin $ ./jboss-cli.sh -c --controller=localhost:9999 [domain@localhost:9999 connector=http] pwd /profile=default/subsystem=web/connector=http [
[email protected]:9999 connector=http] :read-resource
{
"outcome" => "success", "result" => {
"enable-lookups" => false, "enabled" => true, "executor" => undefined, "max-connections" => undefined, "max-post-size" => 2097152, "max-save-post-size" => 4096, "name" => "http", "protocol" => "HTTP/1.1", "proxy-name" => undefined, "proxy-port" => undefined, "redirect-port" => 8433, "scheme" => "http", "secure" => false, "socket-binding" => "http", "ssl" => undefined,
"virtual-server" => undefined
4
} }
Step #2:
Set the http max-connections to 50
[domain@localhost:9999 connector=http] :write-attribute(name=maxconnections,value=50) {
"outcome" => "success", "result" => undefined, "server-groups" => Prod-Group
}
Testing the Configuration: [domain@localhost:9999 connector=http] :read-resource { "outcome" => "success", "result" => {
"enable-lookups" => false, "enabled" => true, "executor" => undefined, "max-connections" => 50, "max-post-size" => 2097152, "max-save-post-size" => 4096, "name" => "http", "protocol" => "HTTP/1.1", "proxy-name" => undefined, "proxy-port" => undefined, "redirect-port" => 8433, "scheme" => "http", "secure" => false, "socket-binding" => "http", "ssl" => undefined,
"virtual-server" => undefined } }
Configure AJP Connector
Option #1: Step#1: Go to http://localhost:9990/console
5
Go to Profiles tab and then select default profile as show in below picture snapshot. Hit on “Web” Subsystem and hit servlet/Http tab and add ajp connector. Please step which are shown in diagram.
6
Option #2: Use CLI to configure AJP Connector
[domain@ localhost:9999 /] /profile=default/subsystem= web/connector=ajp:readresource(recursive= true) { "outcom e" => "success", "result" => { "enable-lookups" => false, "enabled" => true, "m ax-post-size" => 2097152, "m ax-save-post-size" => 4096, "protocol" => "AJP/1.3", "redirect- port" => 8443, "schem e" => "http", "secure" => false, "socket-binding" => "ajp", "ssl" => undefined, "virtual-server" =>
undefined } }
Step #1:
7
Add the necessary connectors to the web subsystem
T o add a connector to the web subsystem, it needs to have a socket binding. The socket binding is added to the socket binding group used by your server or server group. The following steps assume that your server group is Prod-Group and that your socket binding group is standard-sockets.
Add a socket to the socket binding group. To add a socket to the socket binding group, issue the following command, replacing the protocol and port with the ones you need.
[domain@localhost:9999/]/socket-binding-group=standardsockets/socketbinding=ajp:add(port=8009)
Add the socket binding to the web subsystem. Issue the following command to add a connector to the web subsystem, substituting the socket binding name and protocol with the ones you need.
[domain@localhost:9999/]/profile=default/subsystem=web/connector= ajp:add(socketbindi ng=ajp,protoco l="AJP/1.3",enabl ed= true,scheme= "http" )
4. JVM Configuration
Configure JVM at group level. Even if you add additional instances, new JVM settings would get replicated. Group_level JVM with heap size 1182m Perm Gen with size 512m Stack Size 256k Option#1: Setup from Manage Domain Console
8
Stack Size addition cannot be done from Managed Console $ cd /home/jboss/jboss-eap-6.0/bin $ ./jboss-cli.sh -c --controller=localhost:9999 [
[email protected]:9999 jvm=Group_Level] cd /server-group=ProdGroup/jvm=Group_Level [
[email protected]:9999 jvm=Group_Level] :read-resource {
"outcome" => "success", "result" => {
"agent-lib" => undefined, "agent-path" => undefined, "env-classpath-ignored" => undefined, "environment-variables" => undefined,
"heap-size" => "1182m", "java-agent" => undefined, "java-home" => undefined, "jvm-options" => undefined, "max-heap-size" => "1182m", "max-permgen-size" => "512m", "permgen-size" => "512m", "stack-size" => undefined,
"type" => undefined }
9
}
Adding Stack Size of 256k [
[email protected]:9999 jvm=Group_Level] :write-attribute(name=stacksize,value=256k) { "outcome" => "success", "result" => undefined, "server-groups" => Prod-Group
}
Testing the Configuration: [
[email protected]:9999 jvm=Group_Level] :read-resource { "outcome" => "success", "result" => {
"agent-lib" => undefined, "agent-path" => undefined, "env-classpath-ignored" => undefined, "environment-variables" => undefined, "heap-size" => "1182m", "java-agent" => undefined, "java-home" => undefined, "jvm-options" => undefined, "maxheap-size" => "1182m", "max-permgen-size" => "512m", "permgen-size" => "512m", "stack-size" => "256k",
"type" => undefined } } Option#2:
Modify domain.xml directly for group-level JVM setting.
CAUTION: You should good hands-on on adding directly to domain.xml file, which might result in XML parsing exceptions or errors and your domain might not start. ALSO, do take backup before editing it and then requires restart of domain after changes.
Adding the piece in between group lines
Edit domain.xml 10
5. Remove the ExampleDS which is in-memory based Datasource. ExampleDS Datasource in in-memory based Datasource which comes default with JBoss EAP 6.0. Do not remove h2 driver.
Solution: Access http://localhost:9990/console
INFORMATION:
Task is to remove default ExampleDS
6. Configure NON-XA Datasource.
Configure Non-XA datasource with below attributes java:jboss/datasources/webDS username: web password: apps DatabaseName: webDS 11
Set below attributes Prepared statement cache è40 Min-pool è10 Max-pool è25 Sql validation èSELECT 1 Background validation ètrue Validation milliseconds è10 millis Deploy èdstest.war Solution: Step#1:
Go to Runtime tab (top right side of console ) and deploy postgresql.jar driver from
Jboss managed domain console Step#2: Go to Profiles tab and select default profile and then go to Connector Subsystem and then select datasources tab Name èwebDS JNDI name è java:jboss/datasources/webDS Hit next page and then select deployed postgresql.jar driver Hit next page to configure jdbc connection settings
Step#3:
12
Hit validation tab and configure below settings.
Step#4: Hit attributes.
13
Step#5: Similarly hit pool tab and set the min-pool to 10 and max-pool to 25. Step#6: Set Transaction-read-commited
Step#7:
Finally deploy dstest.war application
Testing the Configuration: Hit : http://localhost:8080/dstest java: jboss/datasources/webDS
Enter Select * from webDS è This sql statement would be given in exam. All you have to do is to copy and paste and hit the button to test it. You should get result after hitting it.
7. DBMS Security Setup 7.1.
Application authentication with Database.
Below details would be given to configure it
14
Jndi name: java:DBMS dsJndiName java:jboss/datasources/webDS principalsQuery select Password from Principals where PrincipalID=? rolesQuery select Role, from Roles where PrincipalID=? Finally deploy secureApp.ear Solution: Step#1: Hit profiles tab and then select default profile and then go to security subsystem and then select “Security Domain”
15
16
Step#2:
Finally go to Runtime tab and deploy secureApp.ear application.
Testing the Configuration: http://localhost:8080/secureApp It should ask for credentials to be entered. As soon as credentials are entered, application gets accessed.
8. Deploy the Application as Root Context Step#1:
Set enable-welcome-root to false
/profile=default/subsystem =web/virtual-server=default-host:write-attribute( name=enable-welcomeroot,value=false)
(or) It can be done by modifying domain.xml Search for /profile=default and then search for virtual and change the enable-welcome=true to false.
17
Step#2: Modify the war file $ mkdir WEB-INF $ vi WEB-INF/jboss-web.xml $ jar uf example.war WEB-INF/jboss-web.xml Step#3: Deploy the Application from Managed Domain console. Go to runtime tab and hit manage deployments and deploy it.
Testing the Configuration: http://localhost:8080 You should be able to access the application with giving application context.
9. Configure XA Datasource Jndi name: java:jboss/datasources/transactDS Username:
web
Database:
TrasactDB
Password:
apps
Solution:
Step#1: Go to profile tab and select default profile. Go to connector subsystem and then select Datasources tab and then hit XA datasources configuration tab. Name: TransactDS JndiName:
java:jboss/datasources/transactDS
18
Section II 10.
Configure two host controllers
Configure two groups. Configure two hosts “host1” and “host2” . This setup should be configured with two groups “Clustered” and “Mailbox”. Each host should be bind with IP-Address. Host1 à IP-Address: 192.168.7.20
Host2 à IP-Address: 192.168.7.21 $ cd /opt/ex248 $ cp –R domain Machine1 $ cp –R domain Machine2 NOTE: Configure group with clustered feature, however You are NOT setting up clustered environment right away. Also you are NOT going to use Messaging subsystem, so make sure that it is removed.
19
NOTE: All the JBoss instances should get started automatically, as soon as the host-controller or server is restarted. Manual starting of JBoss instances should be avoided.
Solution: Step#1: Configure two host controllers. Step#2: cd /opt/ex248/ Step#3: cp –R domain Machine1 Step#4: cp –R domain Machine2
Important Step: Step#5: vi /opt/ex248/Machine1/configuration/domain.xml Search for full-ha profile and then search for hornet-server, delete the messaging subsystem. Save and quit. Step#6: vi /opt/ex248/Machine1/configuration/host.xml Change#1: Search for name=”master” and replace with value as “host1” . This should be first line in host.xml Replace as below
Change#2: Replace Loopback (127.0.0.1) with 192.168.7.20 Vi command (1,$s/127.0.0.1/192.168.7.20/g) Change#3: Remove all the existing server instances --------------------------------------------------------------------------------------------------------------------------------
Above one should look like below
Change#3: Change the loopback IP-Address with 192.168.7.21 Change#4: Remove all the existing server instances. Step#9: Start Host2 host-controller. Once it is started, make sure it registers with host1 host-controller.
$ /opt/ex248/bin/domain.sh –Djboss.domain.base.dir=/opt/ex248/Machine2/ &
Step#10: Create groups & JBoss instances. Clustered_s1 à On host1 à port-Offset à 0 Full-ha à Clustered
21
Clustered_s2 à On host2 à Port-Offset à 0
mail_s1 àOn host1 à port-Offset à 200 Full àMailbox mail_s2 à On host2 à Port-Offset à 200
Create two groups Clustered and Mailbox and Clustered group should have Clustered_s1 & Clustered_s2 Jboss instances. Similarly Mailbox group should have two jboss instances called mail_s1 and mail_s2. Step#11:
remove Messaging
NOTE: Make sure you select check box to true, to start the instances automatically. 11.
Configure TCP Based Clustered environment setup.
Most of the cloud vendor do NOT allow UDP communication. In such scenarios we have have to configure Clustering JBoss JGroups to use TCP instead of UDP. By default, cluster nodes monitor each other's status using the UDP protocol. Some networks only allow TCP to be used. In this situation, you can add the TCPPING protocol stack to your configuration and use it as the default mechanism. These configuration options are available in the command-line based Management CLI. The mod_cluster subsystem also uses UDP communication by default, and you can choose to use TCP here as well. IMPORTANT: Setup Instances on Host/Master Controller itself based on the examination question. $ cd /opt/ex248/Machine1/configuration $ vi domain.xml
Search for profile=full-ha Then again search for udp and then replace it with tcp :wq! $ ./jboss-cli.sh -c --controller=192.168.7.20:9999 9999 /] cd /profile=full-ha/subsystem=jgroups/stack=tcp/protocol=MPING
9999 /] :write-attribute(name=type,value=TCPPING) 9999/ ] :write-attribute(name=socket-binding)
22
9999 /] cd /profile=full-ha/subsystem=jgroups/stack=tcp/protocol=MPING/property 9999/] ./initial_hosts/:add(value="192.168.7.20[7600],192.168.7.21[7600]")
12.
Configure Apache based Load balancer.
Solution: Step#1: “jboss” account is given full access.
$ /etc/httpd/conf/apachectl stop $ /etc/httpd/conf/apachectl start $ ps –ef | grep httpd Step #2: Copy mod-cluster modules to /etc/httpd/modules $ cd /home/student/JB248/opt/jboss-eap-6.0/modules/native/lib64/httpd/modules $ sudo cp * /etc/httpd/modules ( NOTE: no need of using sudo command )
$ cp * /etc/httpd/modules Step #3: Perform below changes in httpd.conf (These changes are already completed in exam )
1. Change the Listen IP-Address of Apache
IMPORTANT: IF in Redhat JBoss 248 examination: Setup httpd based loadbalancer and the said URL should work after examination: http://192.168.0.20/cluster_test
Then NO need of makding the Apache listen on IP-Address. The listen entry would like below, in /etc/httpd/conf/httpd.conf Listen 80 Listen 192.168.0.20 80 2. Search for balancer module and comment it. $ vi /etc/httpd/conf/httpd.conf
23
Include conf.d/*.conf
# change the Apache Listen IP-Address as below Listen 192.168.2.20:80 à Listen IP address is already added. Listen 80 à Making it listen on Loopback (127.0.0.1 ) based on exam question # comment below module #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so à This line is already commented in exam
Step #3: Setup modcluster.conf/proxy.conf $ vi /etc/httpd/conf.d/proxy.conf (or )
LoadModule slotmem_module modules/mod_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule advertise_module modules/mod_advertise.so LoadModule jk_module modules/mod_jk.so ManagerBalancerName mybalancer Order deny,allow Allow from all
KeepAliveTimeout 300 MaxKeepAliveRequests 0
EnableMCPMReceive ServerAdvertise Off à This indicates using TCP Protocol SetHandler mod_cluster-manager Order deny,allow Deny from all Allow from all
24
Save & exit Step #4:
Setup mybalancer & proxylist in mod-cluster subsystem under “full-ha” profiles.
Once it is done, it will ask for reload. Goahead and restart jboss server instances. Step #5: Restart Httpd $ /etc/httpd/bin/apachectl stop $ /etc/httpd/bin/apachectl start Step#6: Access the mod-cluster manager page. http://192.168.7.20/modcluster-manager
You should be able to see all the JBoss nodes of full-ha profile. IMPORTANT: Configure stick session
25
IMPORTANT: Deploy the clustered application.
13.
Configure JMS.
Create JMS Connection Factory. Also, make sure, you have deleted existing Connection Factory for Mailbox group. NOTE: make sure that connection Factory should be accessible to external users. Solution: Step #1: Create Connection Factory TrasactDS Connection Factory should be accessible to external users, then it should be netty connector type. Queue à testQueue à Create Queue with name as testQueue ApplicationRealm $ ./add-user.sh What type of user do you wish to add? Management User (mgmt-users.properties) Application User (application-users.properties) (a): b Enter the details of the new user to add. Realm (ApplicationRealm) : Username : jmsClient Password : Re-enter Password : What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none) [ ]: tester About to add user 'jmsClient' for realm 'ApplicationRealm' Is this correct yes/no? yes Added user 'jmsClient' to file '/opt/ex248/standalone/configuration/application-users.properties' Added user 'jmsClient' to file '/opt/ex248/domain/configuration/application-users.properties' Added user 'jmsClient' with roles tester to file '/opt/ex248/standalone/configuration/application-roles.properties' Added user 'jmsClient' with roles tester to file '/opt/ex248/domain/configuration/application-roles.properties'
$ cp /opt/ex248/domain/configuration/application-roles.properties /opt/ex248/Machine1/domain/configuration $ cp /opt/ex248/domain/configuration/application-users.properties /opt/ex248/Machine1/domain/configuration $ cp /opt/ex248/domain/configuration/application-roles.properties /opt/ex248/Machine2/domain/configuration $ cp /opt/ex248/domain/configuration/application-users.properties /opt/ex248/Machine2/domain/configuration
26
Give testQueue send and consume options:
Select profile=full from jboss domain console
27
Testing the Configuration: Run the command given in the exam. We should be able send and consume messages over destination testQueue.
28