July 2019
M T W T F S S
« Jun    
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

WordPress Quotes

Don't hold to anger, hurt or pain. They steal your energy and keep you from love.
Leo Buscaglia
July 2019
M T W T F S S
« Jun    
1234567
891011121314
15161718192021
22232425262728
293031  

Short Cuts

2012 SERVER (64)
2016 windows (9)
AIX (13)
Amazon (36)
Ansibile (19)
Apache (134)
Asterisk (2)
cassandra (2)
Centos (211)
Centos RHEL 7 (267)
chef (3)
cloud (2)
cluster (3)
Coherence (1)
DB2 (5)
DISK (25)
DNS (9)
Docker (30)
Eassy (11)
ELKS (1)
EXCHANGE (3)
Fedora (6)
ftp (5)
GIT (3)
GOD (2)
Grub (1)
Hacking (10)
Hadoop (6)
health (1)
horoscope (23)
Hyper-V (10)
IIS (15)
IPTABLES (15)
JAVA (7)
JBOSS (32)
jenkins (1)
Kubernetes (7)
Ldap (5)
Linux (188)
Linux Commands (166)
Load balancer (5)
mariadb (14)
Mongodb (4)
MQ Server (24)
MYSQL (84)
Nagios (5)
NaturalOil (13)
Nginx (35)
Ngix (1)
openldap (1)
Openstack (6)
Oracle (35)
Perl (3)
Postfix (19)
Postgresql (1)
PowerShell (2)
Python (3)
qmail (36)
Redis (12)
RHCE (28)
SCALEIO (1)
Security on Centos (29)
SFTP (1)
Shell (64)
Solaris (58)
Sql Server 2012 (4)
squid (3)
SSH (10)
SSL (14)
Storage (1)
swap (3)
TIPS on Linux (28)
tomcat (62)
Uncategorized (29)
Veritas (2)
vfabric (1)
VMware (28)
Weblogic (38)
Websphere (71)
Windows (19)
Windows Software (2)
wordpress (1)
ZIMBRA (17)

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Who's Online

18 visitors online now
3 guests, 15 bots, 0 members

Hit Counter provided by dental implants orange county

SSL ON JBOSS

SSL ON JBOSS

SSL Setup is same as Tomcat Procedure

1) Create a keystore using keytool utility

#keytool can be found from Java runtime – /opt/jre1.6.0_18/bin/keytool
# Enter values as required

mkdir $JBOSS_HOME/ssl
cd $JBOSS_HOME/ssl

$ keytool -genkey -alias jboss -keyalg RSA -keystore jboss.keystore -validity 3650
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]:
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]: US
Is valuescorrect?
[no]: yes

Enter key password for
(RETURN if same as keystore password):
Re-enter new password:

A .keystore file will be created in the current directory.

2) Update /opt/jboss-eap-5.0/jboss-as/server/default/deploy/jbossweb.sar/server.xml with correct keystore values.

3) Restart the server. Test using https://{ip_address}:8443/context-root/filename.jsp

Apache commands

Apache commands

#!/bin/sh
echo “————————”
echo “Verify Configuration”
echo “————————”
/opt/apache/bin/httpd -f /opt/apacheconf/httpd.conf -t -S

echo “————————”
echo “Start Apache”
echo “————————”

/opt/apache/bin/httpd -f /opt/apacheconf/httpd.conf -k start

echo “————————”
echo “List HTTP Processes”
echo “————————”
sleep 3
ps -ef | grep http

Custom script to stop Apache (stop_apache.sh)
#!/bin/sh

echo “————————”
echo “Stop Apache”
echo “————————”
/opt/apache/bin/httpd -f /opt/apacheconf/httpd.conf -k stop

echo “————————”
echo ” List HTTP Processes”
echo “————————”
sleep 3
ps -ef | grep http

rm /opt/apachelogs/*

List statically compiled modules
/opt/apache/bin/httpd -l or /opt/apache/bin/apachectl -l

Which mpm is used by apache?
/opt/apache/bin/apachectl -l

List all loaded modules
/opt/apache/bin/httpd -t -D DUMP_MODULES

Setup X-Forwarded Proto in Apache

Setup X-Forwarded Proto in Apache


RequestHeader set X-Forwarded-Proto “http”


RequestHeader set X-Forwarded-Proto “https”

JBOSS virtual hosts

JBOSS virtual hosts

Edit /opt/jboss5.0/jboss-as/server/default/deploy/jboss.sar/server.xml to include your virtual hosts.



www.rmohan.com
webtest.rmohan.com
somename.rmohan.com

Using Apache mod_jk with BigIP LTM and JBOSS

Using Apache mod_jk with BigIP LTM and JBOSS

Using Apache mod_jk with BigIP LTM and JBOSS

1) Make sure your JBOSS is running and listening on AJP port 8009

2) LTM Load Balancer Configuration
a) Create a TCP monitor jboss-tcp-monitor using parent profile TCP
b) Create a Virtual Server with port 8009
c) Create a Pool
d) Create a Pool member with port 8009. The member will be JBOSS server IP and port 8009
e) Associate Pool with jboss-tcp-monitor

3) Configure mod_jk in apache

Update these values to read as

worker.node1.port=8009
worker.node1.host={ltm-loadbalancer-vip}
worker.node1.type=ajp13

4) Test the browser website URL

Jboss with Apache integration

Jboss with Apache integration

Jboss Apache integration is same procedure of Tomcat Setup. 🙂 so they are not hard to so.

1) Download mod_jk module from

http://www.gtlib.gatech.edu/pub/apache/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.28/i586/

2) Copy mod_jk-1.2.28-httpd-2.2.X.so to /opt/apacheconf

3) Edit the httpd.conf and add the following line
Include /opt/apacheconf/mod-jk.conf

4) Create /opt/apacheconf/mod-jk.conf file with the following content
LoadModule jk_module /opt/apacheconf/mod_jk-1.2.28-httpd-2.2.X.so
JkWorkersFile /opt/apacheconf/workers.properties
JkLogFile /opt/apachelogs/mod_jk.log
JkLogLevel info
JkLogStampFormat “[%a %b %d %H:%M:%S %Y]”
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
JkRequestLogFormat “%w %V %T”

JkMountFile /opt/apacheconf/uriworkermap.properties
JkShmFile /opt/apachelogs/jk.shm


JkMount status
#Order deny,allow
#Deny from all
#Allow from 127.0.0.1

5) Create /opt/apacheconf/uriworkermap.properties file with the following content
# Simple worker configuration file
# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer
/testWeb/*=loadbalancer
!/testWeb/images/*=loadbalancer

6) Create /opt/apacheconf/workers.properties file with the following content
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host={jboss-server-ip-address goes here}
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
worker.node1.ping_mode=A #As of mod_jk 1.2.27
# worker.node1.connection_pool_size=10 (1)

# Define Node2
# modify the host as your host IP or DNS name.
#worker.node2.port=8009
#worker.node2.host= node2.mydomain.com
#worker.node2.type=ajp13
#worker.node2.lbfactor=1
#worker.node2.prepost_timeout=10000 #Not required if using ping_mode=A
#worker.node2.connect_timeout=10000 #Not required if using ping_mode=A
#worker.node2.ping_mode=A #As of mod_jk 1.2.27
# worker.node1.connection_pool_size=10 (1)

# Load-balancing behaviour
worker.loadbalancer.type=lb
#worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.balance_workers=node1

# Status worker for managing load balancer
worker.status.type=status

The above configuration is to test with one app server functionally.

7) Update /opt/apacheconf/httpd-vhosts.conf with JkMount
Listen 9080
NameVirtualHost *

ServerName {server-name}
ServerAlias {alias}
JkMount /testWeb loadbalancer
JkMount /testWeb/* loadbalancer

8) Update the following line to include jvmRoute in /opt/jboss-eap-5.0/jboss-as/server/default/deploy/jbossweb.sar/server.xml

9) Restart Apache and JBOSS server

10) Test the web server URL http://{domain-name}/testWeb/test.jsp

Jboss Linux Tuning

Jboss Linux Tuning

Linux Tuning Optimization

1) Commands to check current settings before updating sys parameters
———————————————————
cat /proc/sys/fs/file-max

ulimit -n

cat /proc/sys/net/core/rmem_default
cat /proc/sys/net/core/wmem_default
cat /proc/sys/net/core/rmem_max
cat /proc/sys/net/core/wmem_max

/sbin/ifconfig -a
eth0 Link encap:Ethernet HWaddr
inet addr: Bcast: Mask:
inet6 addr: fe80::250:56ff:febf:7f5a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9313376 errors:0 dropped:0 overruns:0 frame:0

cat /proc/sys/kernel/shmmax
cat /proc/sys/vm/nr_hugepages
———————————————————

2) Edit /etc/sysctl.conf and append these values
———————————————————
# Set File Max
set fs.file-max=102642

# Increase default socket send and receive buffers
net.core.rmem_default=262122

net.core.wmem_default=262122
net.core.rmem_max=262122
net.core.wmem_max=262122
———————————————————

3) Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and append MTU
# recommended for gigabit ethernet to reduce packet fragmentation
MTU=9000

4) echo 2147483647 > /proc/sys/kernel/shmmax or update sysctl.conf
5) echo 1000 > /proc/sys/vm/nr_hugepages

6) Edit /etc/limits.conf and set ulimit value

Vi Editior

Vi Editior

How to copy data in VI editor

vi first edit source file
then move your cursor to start of selection
ma mark current position with letter a
then move your cursor to end of selection
y’a yank to buffer x from current position to mark a
:e other edit target file
move cursor to where you want the data
p put from buffer x

Copying a block of text from one file to another in Vi
December 29th, 2008 No comments

To copy a block of text between files execute the commands:
Command Explaination
1. Edit the file containing the text you want to copy.
2. Go to the top line to be copied.
3. ma Mark this line as mark “a”.
4. Go to the bottom line to be copied
5. y’a Yank (y) the text from the current cursor location to the mark “a” (‘a)
6. :split second-file Open another window containing the second file. (This the file in which the text is to be inserted.)
7. Go to the line where the insert is to occur. The text will be place after this line.
8. p Put the text after the cursor.

For Vi Editor
Do you like www.linuxnix.com ? Please consider supporting us by becoming a subscriber and get a Linux basics e-book for free.
unix_vi_editor

VI editor is the default file editor in most of the Linux/Nix machines. It is having great capabilities to edit a file with in few key strokes.

Lets start with some general information and then move on to some good things what vi editor can do for you while editing a file.
1. Vi stands for visual.
2. Vi have its variants like vim which stands for Vi IMproved, VimX11 for gui and winvi for MS windows.
3. Vi is the most popular editor and next most popular editor is gedit.
4. Do you know there is a book on VI editor from orally which is of 600+ pages.
5. Some other editors which will do the work of editing files are neno, pico, gedit, emacs, joe, nedit, ed etc.

Learning vi editor and remembering them is a very a easy task if you learn it in a systematic way.
a. Modes of VI
b. Navigational commands
c. Editing commands.
d. Search and Replace
e. Save and quiting a file.

a. Modes of VI :
Vi have two mode of operation.
1. Command mode
2. Inserting mode

Command mode :
Vi editor begins in command mode, where cursor movement(navigation in the file) and editing occur. To enter in to command mode from Inserting mode press esc button.

Inserting mode :
Used for entering text, this is similar to notepad in Windows. To enter in to inserting mode you can use any of the following.
i or I => present line
o => one line down the present line
O => one line above

Note : All comments will work in command mode only.

b. Navigational commands :
1. Character navigation k, h, l and j
h => To move one character left.
j => To move one line down.
k => To move one line up.
l => To move one character right.

How to use above commands in clever way?
Examples :
6j => to move 6 lines down from the present courser.
7k => to move 7 lines above from the present courser.

2. Word Navigation
w => word forward.
e =>word forward, but end of the word.
b => one word backward.

Examples :
32w => To move 32 words forward
6b => To move 6 words back.

3. Setting (nu) mbering to lines
:set nu
Removing of (nonu)mbering to lines
:set nonu

4. Moving paragraphs
move one paragraph up => {{
move one paragraph down => }}

5. Moving page up/down
For up => ctrl+b
For down => ctrl+f

6. Moving start/end of the file
Starting of the file(first line => [[
End of the file(last line) => ]]

7. Going to any line :
:lineno

Example :
If we want to go to 56 line then type
:56

c. Editing commands

8. Replace one letter
Replace one letter => r
Delete one letter => x

>9. Editing one word
Edit one word => cw
Delete one word => dw

10. Editing one line
Editing a line from courser to the end of that line => d$

11. Cutting
deleting(cutting) one line => dd

Examples :
2dd(deleting/cutting two lines)

12. Pasting
Pasting a line below the courser => p
Pasting a line above the courser => P

13. Coping
Copying one line => yy
Copying n lines => nyy

14. Special commands
joining lines => J
undoing things => u
repeating previous command => .

d. Search and replace

15. Search for a term /term

Example : If you want to search for suresh then press /suresh enter
/suresh
Moving to next occurrence, press “n” with out quotes moving to previous occurrence, press “N” with out quotes.

16. Searching and replacing a term(here separator is / )
:%s/searchterm/replaceterm/g
change default separator
:%s_/home/surya/grade_/home/testing/dest_g

To search and replace particular term from given line to other given line.
:%s294,304/sahana/xyz/g

e)Save and quiting a file
:w => save the file
:q => quit the file
:wq => save and quit
:w! => force save the file
:q! => force quit with out save
:wq => save and quit forcefully

Memory commands

Memory commands

How do I find out System / Server Memory Utilization under RHEL / CentOS / any other Linux distribution?

A. You need to use free command which, displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
free command example

Type the free command at shell prompt:
$ free
$ free -m
Output:

total used free shared buffers cached
Mem: 2010 1965 45 0 152 776
-/+ buffers/cache: 1036 974
Swap: 2047 137 1910

vmstat command

vmstat command provides more information :
$ vmstat
Output:

procs ———–memory———- —swap– —–io—- –system– —–cpu——
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 140480 43636 158196 797692 1 0 108 220 1 4 7 5 87 1 0

Understanding vmstat memory options

* swpd: the amount of virtual memory used.
* free: the amount of idle memory.
* buff: the amount of memory used as buffers.
* cache: the amount of memory used as cache.
* inact: the amount of inactive memory. (-a option)
* active: the amount of active memory. (-a option)

$ vmstat -a
Output:

procs ———–memory———- —swap– —–io—- –system– —–cpu——
r b swpd free inact active si so bi bo in cs us sy id wa st
0 1 140480 37376 109516 1730040 1 0 108 220 1 4 7 5 87 1 0

The following command displays one new line of utilization data every second
$ vmstat 1
The following command displays one new line per 2 second, but only for the next 10 seconds:
$ vmstat 2 10
Output:

procs ———–memory———- —swap– —–io—- –system– —–cpu——
r b swpd free inact active si so bi bo in cs us sy id wa st
4 0 139216 23508 130644 1723680 1 0 108 220 1 5 7 5 87 1 0
2 0 139216 23252 130668 1723816 0 0 0 410 3242 11472 9 7 84 0 0
1 0 139216 23120 130656 1724012 0 0 0 750 3280 11592 3 6 90 1 0
0 0 139216 22996 130588 1724180 0 0 0 426 3272 11052 2 5 93 0 0
2 0 139216 20988 129932 1726980 0 0 6 1146 3353 12105 14 9 74 2 0
1 0 139216 20244 129900 1727216 0 0 0 392 3238 11752 8 7 85 0 0
1 0 139216 20120 129868 1727352 0 0 0 444 3197 11173 2 5 93 0 0
1 0 139216 25964 129852 1721044 0 0 0 268 3147 9269 1 4 95 0 0
3 0 139216 25964 129748 1721196 0 0 2 132 3199 10540 1 4 95 0 0
1 0 139216 25964 129676 1721332 0 0 0 456 3213 10608 2

Free Memory on Linux at Runtime
sync
echo 3 > /proc/sys/vm/drop_caches

Display Only The Process IDs of Lighttpd

ps -C lighttpd -o pid=
OR
pgrep lighttpd
OR
pgrep -u vivek php-cgi
Display The Name of PID 55977

ps -p 55977 -o comm=

CPU COMMAND

CPU COMMAND

PU COMMAND

10 cpu usage command

ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’

####Watch changeable data continuously

watch -n.1 ‘cat /proc/interrupts’

cat /proc/interrupts

Check CPU Temperature
# echo `date +%b-%d-%H:%M:%S` | tr -d ‘\ 012’ ; echo -n ‘ ‘; sensors | awk ‘/CPU Temp:/{ print $3 }’

Check those commands which have been used most
# history|awk ‘{print $2}’ |awk ‘{print $1}’ | sort | uniq -c | sort -rn | head -10