jdk
/home/user/software/jdk folder and then execute the following commands
./j2sdk-1_4_2_07-linux-i586.rpm.bin
rpm -ivh j2sdk-1_4_2_07-linux-i586.rpm
get jdk1.5.0_22 folder
jdk1.5.0_22
copy to /usr/java/jdk1.5.0_22
chmod 775 /usr/java/ -R
vi ~/.bashrc
export JAVA_HOME=/usr/java/j2sdk1.4.2_07
export PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/lib/classes.zip
export CLASSPATH=$CLASSPATH:
export PATH=/sbin:$PATH
java -version
1.5.0_22
if get this error
/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
do this,
yum -y install glibc.i686
------------
http://sourceforge.net/projects/jboss/files/JBoss/
jboss 4.0.3 sp1
useradd -d /home/jboss -s /bin/bash -m jboss //m=create home dir if not exists;-d=default values;-s=shell
passwd jboss
cp ->>>>> /home/jboss/jbossunzip
mv->>> /home/jboss/jboss4.0.3
su jboss
vi .bash_profile or .bashrc
export JBOSS_HOME=$HOME/jboss4.0.3
export JAVA_HOME=/usr/java/j2sdk1.4.2_07
source .bash_profile or .bashrc
cd jboss4.0.3/bin
./run.sh
root
chown jboss.jboss jboss4.0 -R
chmod 775 jboss4.0 -R
service iptables stop
in log4j.xml use "FILE"--------------->
<root>
<priority value="WARN" />
<appender-ref ref="FILE"/>
</root>
------>
<param name="File" value="/var/log/myg/sys/server.log"/>
------------------>
//localhost:8080
--------------------------------------
<root>
<priority value="INFO" />
<appender-ref ref="FILE"/>
</root>
----------------
node2
vim /jboss/jboss_2/server/default/conf/log4j.xml and edit the following;
<appender name="FILE"
<param name="File" value="/var/log/sys/server2.log"/>
<appender name="MIDE"
<appender name="FILE"
<param name="File" value="/var/log/sys/server2.log"/>
<appender name="MIDE"
<param
name="File" value="/var/log/app/midestream2.log"/>
*****
vim /jboss_2/bin/run.sh
# Setup the
JVM
if [ "x$JAVA" = "x" ];
then
if [
"x$JAVA_HOME" != "x" ]; then
JAVA="$JAVA_HOME/bin/java_2"
else
JAVA="java_2"
fi
fi
*****
vim /jboss/jboss_2/server/default/conf/jboss-service.xml
Find (<mbean
code="org.jboss.services.binding.ServiceBindingManager") line and
add (-->) before the
line. And change the port
number as required.
-->
<mbean
code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute
name="ServerName">ports-01</attribute>
<attribute
name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
<attribute
name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>
-----------------------------------
Use this but not necessary.
vim /mysystem/jboss/jboss_1/server/default/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml
<attribute name="UseJK">true</attribute>
vim /mysystem/jboss/jboss_1/server/default/deploy/jbossweb-tomcat55.sar/server.xml
<Engine jvmRoute="tomcat1" name="jboss.web" defaultHost="localhost">
do this to all jboss nodes
-------------------------------------
Memory set
/bin/run.sh
find OPTS comment, #JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME"
/////////////////////////////JAVA_OPTS="-server -Xms1024m -Xmx1024m -Xloggc:"/var/log/myg/sys/verbose.log" -XX:+UseParNewGC -XX:SurvivorRatio=2 -XX:NewRatio=8 -XX:MaxPermSize=256m -Djavax.net.ssl.trustStore=/mysystem/jboss/jboss_1/bin/certs/mycert.keystore -DRezNode=AviStgOneNode1 -Dprogram.name=$PROGNAME"
///////or
JAVA_OPTS="-server -XX:ParallelGCThreads=2 -Xms768m -Xmx768m -XX:MaxPermSize=256m -d64 -Denvironment_id=CLOUD_G1 -Dprogram.name=$PROGNAME -Dsun.net.inetaddr.ttl=0"orJAVA_OPTS="-server -XX:ParallelGCThreads=2 -Xms768m -Xmx768m -XX:MaxPermSize=256m -d32 -Denvironment_id=CLOUD_G1 -Dprogram.name=$PROGNAME -Dsun.net.inetaddr.ttl=0"
-------------------------------------
jbstart
#!/bin/sh
jvcount=$(ps -e|grep java_1 |wc -l)
if [ $jvcount -eq 0 ]
then
NOWDATE=$(date +"%m-%d-%Y_%H%M")
zip /var/log/myg/sys/server1java_1.log$NOWDATE.zip /var/log/myg/sys/server1java_1.log
cd /mysystem/jboss/jboss_1/server/default
rm -r -f work/
rm -r -f tmp/
ls -l /mysystem/jboss/jboss_1/server/default/
cd /mysystem/jboss/jboss_1/bin/
./run.sh -b 192.168.0.95 &
echo "jboss_1 started at $(date)" >> /var/log/myg/sys/jbAvailability.log
echo "===========================================" >> /var/log/myg/sys/jbAvailability.log
else
echo "java_1 process is already runing, Please stop it before starting!!!"
fi
ALTER WAY jbstop
#!/bin/bash
#Check if user is root
if [ $EUID -eq 0 ]; then
echo "You're trying to stop jboss as root. Switching to myuser"
su - myuser
exit
fi
mPS=`/sbin/pidof java_1`
kill -term $mPS;
while ps -p $mPS > /dev/null; do
echo "waiting for process [$mPS] to stop"; sleep 1;
done
echo "Process [$mPS] Stopped Successfully....";
-----------------------------------
Use this but not necessary.
vim /mysystem/jboss/jboss_1/server/default/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml
<attribute name="UseJK">true</attribute>
vim /mysystem/jboss/jboss_1/server/default/deploy/jbossweb-tomcat55.sar/server.xml
<Engine jvmRoute="tomcat1" name="jboss.web" defaultHost="localhost">
do this to all jboss nodes
-------------------------------------
Memory set
/bin/run.sh
find OPTS comment, #JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME"
/////////////////////////////JAVA_OPTS="-server -Xms1024m -Xmx1024m -Xloggc:"/var/log/myg/sys/verbose.log" -XX:+UseParNewGC -XX:SurvivorRatio=2 -XX:NewRatio=8 -XX:MaxPermSize=256m -Djavax.net.ssl.trustStore=/mysystem/jboss/jboss_1/bin/certs/mycert.keystore -DRezNode=AviStgOneNode1 -Dprogram.name=$PROGNAME"
///////or
JAVA_OPTS="-server -XX:ParallelGCThreads=2 -Xms768m -Xmx768m -XX:MaxPermSize=256m -d64 -Denvironment_id=CLOUD_G1 -Dprogram.name=$PROGNAME -Dsun.net.inetaddr.ttl=0"orJAVA_OPTS="-server -XX:ParallelGCThreads=2 -Xms768m -Xmx768m -XX:MaxPermSize=256m -d32 -Denvironment_id=CLOUD_G1 -Dprogram.name=$PROGNAME -Dsun.net.inetaddr.ttl=0"
-------------------------------------
jbstart
#!/bin/sh
jvcount=$(ps -e|grep java_1 |wc -l)
if [ $jvcount -eq 0 ]
then
NOWDATE=$(date +"%m-%d-%Y_%H%M")
zip /var/log/myg/sys/server1java_1.log$NOWDATE.zip /var/log/myg/sys/server1java_1.log
cd /mysystem/jboss/jboss_1/server/default
rm -r -f work/
rm -r -f tmp/
ls -l /mysystem/jboss/jboss_1/server/default/
cd /mysystem/jboss/jboss_1/bin/
./run.sh -b 192.168.0.95 &
echo "jboss_1 started at $(date)" >> /var/log/myg/sys/jbAvailability.log
echo "===========================================" >> /var/log/myg/sys/jbAvailability.log
else
echo "java_1 process is already runing, Please stop it before starting!!!"
fi
ALTER WAY jbstop
#!/bin/bash
#Check if user is root
if [ $EUID -eq 0 ]; then
echo "You're trying to stop jboss as root. Switching to myuser"
su - myuser
exit
fi
mPS=`/sbin/pidof java_1`
kill -term $mPS;
while ps -p $mPS > /dev/null; do
echo "waiting for process [$mPS] to stop"; sleep 1;
done
echo "Process [$mPS] Stopped Successfully....";
#######################################################
running jboss on 8080 8180, httpd running /etc/httpd
yum install httpd-devel
yum groupinstall 'Development Tools'
dissable ip tables, disable selinux
mod_jk connector download
cd native
./configure --with-apxs=/usr/local/apache/bin/apxs OR /usr/sbin/apxs
make
make install
worker
[root@hasaranga ~]# vi /etc/httpd/conf/workers.properties
worker.list=balancer,stat
worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=10
#worker.tomcat1.port=8009
#worker.tomcat1.host=localhost
#worker.tomcat1.type=ajp13
#worker.tomcat1.lbfactor=100
#worker.tomcat1.socket_timeout=60
#worker.tomcat1.domain=gayashanqatar
#worker.tomcat1.activation=A
#worker.tomcat1.redirect=tomcat2
#worker.tomcat2.port=8109
#worker.tomcat2.host=localhost
#worker.tomcat2.type=ajp13
#worker.tomcat2.lbfactor=100
#worker.tomcat2.socket_timeout=60
#worker.tomcat2.domain=gayashanqatar2
worker.list=balancer,stat
worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=10
#worker.tomcat1.port=8009
#worker.tomcat1.host=localhost
#worker.tomcat1.type=ajp13
#worker.tomcat1.lbfactor=100
#worker.tomcat1.socket_timeout=60
#worker.tomcat1.domain=gayashanqatar
#worker.tomcat1.activation=A
#worker.tomcat1.redirect=tomcat2
#worker.tomcat2.port=8109
#worker.tomcat2.host=localhost
#worker.tomcat2.type=ajp13
#worker.tomcat2.lbfactor=100
#worker.tomcat2.socket_timeout=60
#worker.tomcat2.domain=gayashanqatar2
#worker.tomcat2.activation=A
#worker.tomcat2.redirect=tomcat1
#worker.loadbalancer1.type=lb
#worker.loadbalancer1.sticky_session=0
#worker.loadbalancer1.balanced_workers=tomcat1
#worker.loadbalancer1.method=B
#worker.loadbalancer1.socket_timeout=60
#worker.loadbalancer1.lock=O
#worker.jkstatus.type=status
#worker.loadbalancer2.type=lb
#worker.loadbalancer2.sticky_session=0
#worker.loadbalancer2.balanced_workers=tomcat2
#worker.loadbalancer2.method=B
#worker.loadbalancer2.socket_timeout=60
#worker.loadbalancer2.lock=O
#worker.jkstatus.type=status
worker.tomcat2.type=ajp13
worker.tomcat2.host=localhost
worker.tomcat2.port=8109
worker.tomcat2.lbfactor=10
worker.balancer.type=lb
worker.balancer.balance_workers=tomcat1,tomcat2
worker.stat.type=status
-------------
httpd.conf
LoadModule jk_module /etc/httpd/modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel emerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /hasar* balancer
JkMount /status stat
--------------------------------------
**************************
with directory listing
vim /etc/httpd/conf/httpd.conf
LoadModule jk_module /etc/httpd/modules/mod_jk.so
#JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel emerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /hasar* balancer
JkMount /status stat
DocumentRoot /var/www/
Alias /ks /var/www/
<Directory "/var/www/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
**********************************************
haproxy (1.4.) (default)
-----------------------------
in a new server
http://tecadmin.net/how-to-configure-haproxy-statics/
yum install haproxy
vim /etc/haproxy/haproxy.cfg
global
log 127.0.0.1 local0
log 127.0.0.1 local1 debug
maxconn 45000 # Total Max Connections.
daemon
nbproc 1 # Number of processing cores.
defaults
timeout server 86400000
timeout connect 86400000
timeout client 86400000
timeout queue 1000s
# [HTTP Site Configuration]
listen http_web 192.168.10.10:80 ////////////////////
mode http
balance roundrobin # Load Balancing algorithm
option httpchk
option forwardfor
server server1 192.168.10.100:80 weight 1 maxconn 512 check//////////////////
server server2 192.168.10.101:80 weight 1 maxconn 512 check///////////////
# [HTTPS Site Configuration]
listen https_web 192.168.10.10:443////////////////
mode tcp
balance source# Load Balancing algorithm
reqadd X-Forwarded-Proto:\ http
server server1 192.168.10.100:443 weight 1 maxconn 512 check/////////////////
server server2 192.168.10.101:443 weight 1 maxconn 512 check /////////////////
-------------------------
nbproc <value> # Number of processing cores in your system.
mode <value> # ‘http’ for http site and ‘tcp’ for https site
balance <value> # Type of load balancing like ‘source’, ’roundrobin’ etc.
service haproxy start
chkconfig haproxy on
-------------------------------------
after defaults section.
listen stats 192.168.10.10:1936/////////////////
mode http
log global
maxconn 10
clitimeout 100s
srvtimeout 100s
contimeout 100s
timeout queue 100s
stats enable
stats hide-version
stats refresh 30s
stats show-node
stats auth admin:password
stats uri /haproxy?stats
--------------------
URL: http://192.168.10.10:1936/haproxy?stats
Login user: admin
Login password: password
-------------------------------------------------
war
https://sites.google.com/site/hasarangaprasad/home/jb/jboss%20app.zip?attredirects=0&d=1
https://jdbc.postgresql.org/download.html -> copy to deploy/ mini&default/..(all3) libs
JDBC3 Postgresql Driver, Version 9.3-1103
apache2 haproxynew sloni
https://sites.google.com/site/hasarangaprasad/home/jb/apache2haproxyslony.zip?attredirects=0&d=1
-------------------------------------------------------------------------
haproxy Manual Conf (1.4)(get config examples from above haproxy default installation)
vim /etc/hosts
uname –a
uname -r
2.6.32-573.18.1.el6.x86_64
reffer https://samsclass.info/124/proj11/proj15-haproxy.html
http://www.haproxy.org/download/1.4/src/haproxy-1.4.23.tar.gz
cd haproxy-1.4.24
make TARGET=26
sudo make install
sudo mkdir /etc/haproxy
cd examples/
sudo cp haproxy.cfg /etc/haproxy
sudo cp haproxy.init /etc/init.d/haproxy
sudo chmod 755 /etc/init.d/haproxy
sudo nano /etc/init.d/haproxy
In the nano text editor, execute these commands:
Ctrl+W
Ctrl+R to start search and replace
At the "Search (to replace):" prompt, type
/usr/sbin
press Enter
At the "Replace with:" prompt, type
/usr/local/sbin
Press Enter
At the "Replace this instance?" prompt, type
A
you should see a message saying "[ replaced 6 occurrences ]"
Save the file with Ctrl+X, Y, Enter
######global
##### daemon
##### maxconn 256 defaults
####### mode http
######timeout connect 5000ms
##### timeout client 50000ms
###### timeout server 50000ms
#######1.global 2.defaults 3.fronend http-in 4.backend 5.Admin
vi /etc/haproxy/haproxy.cfg
add after default and global
############comments
# chroot /usr/share/haproxy
# redispatch
bind 192.168.137.11:80 #default haproxy frond end IP and port number
default_backend QAD #Alias of backend
backend QAD
server sv1 192.168.137.12:80 maxconn 32 check
server sv2 192.168.137.13:80 maxconn 32 check
##Admin console configuration
listen admin
bind 192.168.137.11:8082 #admin console IP address:password
stats enable
#stats uri /admin?stats (if not defined it is "/haproxy?stats")
stats hide-version
stats auth admin:admin #admin console login username:password
stats auth admin2:admin #admin console login username:password
stats refresh 5s #refresh admin console every 5sec
stats admin if TRUE #to remove/add, Enable/Disable functionality of admin console
-----------------------
#####/root/haproxy-1.4.24/haproxy -f /root/haproxy-1.4.24/haproxy.cfg
/usr/local/sbin/haproxy -f /etc/haproxy/haproxy.cfg
http://192.168.137.11:8082/haproxy?stats
#############################
tested
HAProxy version 1.5.4, released 2014/09/02
######################################
http://www.haproxy.org/download/1.5/src/haproxy-1.5.4.tar.gzsame install as 1.4
###############
vim /etc/haproxy/haproxy.cfg
##############
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
# chroot /usr/share/haproxy
uid 99
gid 99
daemon
#debug
#quiet
defaults
# log global
# mode http
# option httplog
# option dontlognull
# retries 3
# redispatch
# maxconn 2000
# contimeout 5000
# clitimeout 50000
# srvtimeout 50000
timeout client 50000
timeout server 50000
timeout connect 5000
listen stats-in
bind 192.168.0.74:8082#admin console IP address:password
balance
mode http
stats enable
stats uri /haproxy?stats
stats auth admin:123456
stats admin if TRUE
listen http_web
bind 192.168.0.74:80
mode tcp
maxconn 1000
balance leastconn
# contimeout 2000
# clitimeout 260000
# srvtimeout 260000
timeout client 260000
timeout server 260000
timeout connect 2000
server sv1 192.168.0.95:8080 maxconn 350 weight 15 check inter 20000
server sv2 192.168.0.95:8180 maxconn 350 weight 20 check inter 20000
server sv3 192.168.0.74:8080 maxconn 350 weight 20 check inter 20000
#####################
http://192.168.0.74:8082/haproxy?stats
http://192.168.0.74/webapp
######################
If there is an error in EC2 saying cant bind private IP
type:
net.ipv4.ip_nonlocal_bind=1
========== haproxy.sock for shell commands
yum -y install socat
add this line in global section
stats socket /var/run/haproxy.sock mode 600 level admin
reload haproxy
echo "set server http_web/ sv1 state drain" | sudo socat stdio /var/run/haproxy.sock
echo "set server http_web/ sv1 state ready" | sudo socat stdio /var/run/haproxy.sock
No comments:
Post a Comment