设为首页 收藏本站
查看: 1147|回复: 0

jboss lnmp keepalived (HA)

[复制链接]

尚未签到

发表于 2015-11-16 10:56:17 | 显示全部楼层 |阅读模式
  #########################################################################################################
#####################################system update#######################################################
#########################################################################################################
LANG=C
  yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-develkrb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
  #########################################################################################################
#####################################jboss###############################################################
#########################################################################################################
1、设置环境变量:
[iyunv@wych-1 configuration]# vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export JBOSS_HOME=/usr/local/jboss
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin:$JBOSS_HOME/bin
  [iyunv@wych-1 bin]# vi /etc/hosts
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
10.10.42.211 master wych01
10.10.42.212 wych02
10.10.42.213 wych03
  2、修改master的host.xml:
[iyunv@wych-1 configuration]# cd /usr/local/jboss/domain/configuration
[iyunv@wych-1 configuration]# cp host-master.xml host.xml
[iyunv@wych-1 configuration]# vi /usr/local/jboss/domain/configuration/host.xml
......
  <subsystem xmlns=&quot;urn:jboss:domain:messaging:1.4&quot;>
                <hornetq-server>
                    <!--
                    <cluster-user>jms-user</cluster-user>
                    <cluster-password>simple-pass</cluster-password>
                    <cluster-password>${jboss.messaging.cluster.password:CHANGE ME!!}</cluster-password>
                    -->
                    <security-enabled>false</security-enabled>
                    <persistence-enabled>true</persistence-enabled>
......
  <subsystem xmlns=&quot;urn:jboss:domain:messaging:1.4&quot;>
                <hornetq-server>
                    <security-enabled>false</security-enabled>
                    <persistence-enabled>true</persistence-enabled>
                    <journal-type>NIO</journal-type>
                    <journal-min-files>2</journal-min-files>
......
    <interfaces>
        <interface name=&quot;management&quot;>
            <inet-address value=&quot;${jboss.bind.address.management:10.10.42.211}&quot;/>
        </interface>
    </interfaces>
  3、启动domain:
[iyunv@wych-1 configuration]# nohup domain.sh &
  4、登陆控制台:
http://10.10.42.211:9990/console
  Welcome to EAP 6
The Enterprise Application Platform 6 is running.
However you have not yet added any users to be able to access the admin console.
  To add a new user execute the add-user.sh script within the bin folder of your EAP 6 installation and enter the requested information.
  By default the realm name used by EAP is &quot;ManagementRealm&quot; this is already selected by default.
  After you have added the user follow this link to Try Again.
  5、设置控制台密码:
[iyunv@wych-1 bin]# cd /usr/local/jboss/bin/
[iyunv@wych-1 bin]# ./add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
To represent the user add the following to the server-identities definition <secret value=&quot;VGVzdF8xMjM0&quot; />     //很重要的东西,添加节点是要用的,一定要记录下来
  6、重新登陆控制台:
http://10.10.42.211:9990/console
  7、添加host control
7.1、创建用户
[iyunv@wych-1 local]# add-user.sh wych02 Test_1234
Added user 'wych02' to file '/usr/local/jboss/standalone/configuration/mgmt-users.properties'
Added user 'wych02' to file '/usr/local/jboss/domain/configuration/mgmt-users.properties'
[iyunv@wych-1 local]# add-user.sh wych03 Test_1234
Added user 'wych03' to file '/usr/local/jboss/standalone/configuration/mgmt-users.properties'
Added user 'wych03' to file '/usr/local/jboss/domain/configuration/mgmt-users.properties'
7.2、修改配置文件
[iyunv@wych-2 configuration]# vi ./host.xml
<host name=&quot;wych02&quot; xmlns=&quot;urn:jboss:domain:1.5&quot;>
  <management>
        <security-realms>
            <security-realm name=&quot;ManagementRealm&quot;>
                <server-identities>
                     <!-- Replace this with either a base64 password of your own, or use a vault with a vault expression -->
                     <secret value=&quot;VGVzdF8xMjM0&quot;/>
                </server-identities>
......
    <domain-controller>
       <remote host=&quot;${jboss.domain.master.address:10.10.42.211}&quot; port=&quot;${jboss.domain.master.port:9999}&quot; security-realm=&quot;ManagementRealm&quot;/>
    </domain-controller>
......
    <interfaces>
        <interface name=&quot;management&quot;>
            <inet-address value=&quot;${jboss.bind.address.management:10.10.42.212}&quot;/>
        </interface>
        <interface name=&quot;public&quot;>
           <inet-address value=&quot;${jboss.bind.address:10.10.42.212}&quot;/>
        </interface>
        <interface name=&quot;unsecure&quot;>
            <!-- Used for IIOP sockets in the standard configuration.
                 To secure JacORB you need to setup SSL -->
            <inet-address value=&quot;${jboss.bind.address.unsecure:10.10.42.212}&quot;/>
        </interface>
    </interfaces>
  
  
  
[dom ain@ localhost:9999 /] EAP_HOME/bin/jboss-cli.sh
[dom ain@ localhost:9999 /] /host=master:shutdown
[dom ain@ localhost:9999 /] /server-group=main-server-group:start-servers
[dom ain@ localhost:9999 /] /server-group=main-server-group:stop-servers
[dom ain@ localhost:9999 /] /host=master/server-config=server-one:start
[dom ain@ localhost:9999 /] /host=master/server-config=server-one:stop
[dom ain@ localhost:9999 /] quit
[disconnected /] connect
$ EAP_HOME/bin/jbo ss-cli .sh --connect
$ EAP_HOME/bin/jbo ss-cli .sh --connect --controller= 192.168.0.1:9999
[standalone@ localhost:9999 /] deploy --help
[standalone@ localhost:9999 /] history
[standalone@ localhost:9999 /] history --clear
  #########################################################################################################
#####################################nginx###############################################################
#########################################################################################################
//查看nginx编译参数:/usr/local/nginx/sbin/nginx -V
//查看apache编译参数:cat /usr/local/apache2/build/config.nice
//查看mysql编译参数:cat /usr/local/mysql/bin/mysqlbug | grep CONFIGURE_LINE
//查看php编译参数:/usr/local/php/bin/php -i | grep configure
//[iyunv@localhost sbin]# ./nginx -V
//nginx version: nginx/0.8.55
//built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
//configure arguments: --prefix=/usr/local/nginx --with-pcre=/opt/pcre-8.35 --with-http_realip_module --without-http-cache
tar xzvf pcre-8.35.tar.gz
cd ./pcre-8.35
make && make install
tar xzvf nginx-0.8.55.tar.gz
cd ./nginx-0.8.55
./configure --prefix=/usr/local/nginx --with-pcre=/opt/pcre-8.35 --with-http_realip_module --without-http-cache
make && make install
  vi /usr/local/nginx/conf/nginx.conf
  http {
    include       mime.types;
    default_type  application/octet-stream;
  upstream  myapp {
       # server 10.10.42.6:9000 weight=1;
        server 10.10.7.60:9002 weight=1;
        server 10.10.7.60:9003 weight=1;
        }
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ \.php$ {
            root           html;   ################修改为绝对路径时表示在php环境下绝对路径
            #fastcgi_pass   10.10.7.60:9001;
            fastcgi_pass   myapp;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;      #####$document_root 为root定义路径
            include        fastcgi_params;
        }
  
#########################################################################################################
#####################################php#################################################################
#########################################################################################################
## Mysql 开发库
yum install libxml2
yum install libxml2-devel -y
yum install mysql-devel
  ######安装PHP的mcrypt扩展需提前安装mcrypt库,下载Libmcrypt,mhash,mcrypt安装包#####
源码编译安装
1、先安装Libmcrypt
[iyunv@php1 opt]# tar xvf libmcrypt-2.5.8.tar.bz2
#cd libmcrypt-2.5.8
#./configure
#make
#make install 说明:libmcript默认安装在/usr/local
2、安装mhash
#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make
#make install
3、安装mcrypt
#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib ./configure
#make
#make install
  ###编译安装PHP###
###--prefix=/usr/local/php 设置安装路径,本案例安装在/usr/local/webserver/php
###--with-config-file-path=/usr/local/php/etc 指定配置文件php.ini地址
###--with-mysql=/usr/local/mysql 启用mysql支持
cd /opt/php-5.3.28  (执行PHP编译的过程可能出现找不到mysql模块文件)
cp /usr/lib64/mysql/libmysqlclient.so* /usr/lib/
  #tar -zxvf php-5.3.28.tar.gz
#cd php-5.3.28
#./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/bin/mysql --with-mysqli=/usr/bin/mysql_config --with-iconv-dir \
--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml \
--disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop \
--enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex  --enable-fpm  \
--enable-mbstring  --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip \
--enable-soap --without-pear --with-gettext --with-mcrypt
#make
#make install
  vi /usr/local/php/etc/php-fpm.conf
listen = 10.10.7.60:9000
/usr/local/php/sbin/php-fpm
  #########################################################################################################
#####################################rhongx##############################################################
#########################################################################################################
  http://10.10.16.88/data/mango/SoftManage/CodeGroup/source/TOPGroup/SOURCE/service/rhongx-src
yum -y install gcc gcc-c&#43;&#43; autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-develkrb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
  cd pcre-8.10
./configure
make && make install
cd lua-5.1.5
make install
wget http://luarocks.org/releases/luarocks-2.1.1.tar.gz
tar xzvf luarocks-2.1.1.tar.gz
cd luarocks-2.1.1
./configure
make && make install
  luarocks list
luarocks install md5
luarocks install lbase64
luarocks install lua-cjson
luarocks install lua-iconv
luarocks install luacrypto
[iyunv@wych00 ~]#  yum install expat-devel     
[iyunv@wych00 ~]#  luarocks install luaexpat
luarocks install lluasoap
luarocks install luasocket
luarocks install luaxml
[iyunv@wych00 ~]# yum install libzip-devel.x86_64
[iyunv@wych00 ~]# luarocks install lzlib ZLIB_INCDIR=/usr/include/ ZLIB_LIBDIR=/usr/lib64/
[iyunv@wych00 ~]# yum install mysql-devel mysql
[iyunv@wych00 ~]# luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql MYSQL_LIBDIR=/usr/lib64/mysql
[iyunv@wych00 ~]# luarocks list
cd rhongx-src/src
useradd www
./configure --user=www --group=www --prefix=/usr/local/webserver/rhongx --with-http_stub_status_module --with-http_ssl_module --with-debug --with-http_gzip_static_module --without-mail_pop3_module --without-mail_imap_module --without-http_uwsgi_module --without-http_scgi_module--without-http_ssi_module --add-module=../lua-nginx-module-0.6.10 --add-module=../ngx_devel_kit-0.2.17 --add-module=../memc-nginx-module --add-module=../srcache-nginx-module --add-module=../echo-nginx-module --add-module=../ngx_cache_purge-1.6 --add-module=../evanmiller-nginx_upstream_hash-2580b21--add-module=../nginx-gridfs --add-module=../nginx_upload_module-2.2.0 --add-module=../masterzen-nginx-upload-progress-module-82b35fc --add-module=../nginx-accesskey-2.0.3 --add-module=../set-misc-nginx-module --add-module=../iconv-nginx-module
  make && make install
cd /usr/local/webserver/rhongx/
/usr/local/webserver/rhongx/sbin/nginx -t -c /data/sgcore/ngx/cfg/sg.ngx.conf
/usr/local/webserver/rhongx/sbin/nginx  -c /data/sgcore/ngx/cfg/sg.ngx.conf
ps -ef | grep &quot;nginx: master process&quot; | grep -v &quot;grep&quot; | awk -F ' ' '{print $2}'|xargs kill -HUP
  
  update /etc/sysctl.conf
# Disable netfilter on bridges.
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0
  # Add
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog =  32768
net.core.somaxconn = 32768
  net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
  net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
  net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1
  net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
#
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 120
net.ipv4.ip_local_port_range = 1024  65535
  #Redis2.6.17need
vm.overcommit_memory = 1
  # End
  #########################################################################################################
#####################################redis安装###########################################################
#########################################################################################################
wget http://download.redis.io/releases/redis-2.6.17.tar.gz
[iyunv@wych00 redis-2.6.17]# cd /opt/ ; tar xzvf redis-2.6.17.tar.gz
[iyunv@wych00 redis-2.6.17]# cd /opt/redis-2.6.17
[iyunv@wych00 redis-2.6.17]# make && make install
[iyunv@wych00 redis-2.6.17]# mkdir /data/logs/redis/6399 -p
[iyunv@wych00 redis-2.6.17]# /opt/redis-2.6.17/src/redis-server /data/sgcore/ngx/cfg/sg.aof.conf
[iyunv@wych00 redis-2.6.17]# /opt/redis-2.6.17/src/redis-cli -p 6399
[iyunv@wych00 redis-2.6.17]# /opt/redis-2.6.17/src/redis-cli -p 6399 -a 142ffb5bfa1-cn-jijilu-dg-a75
[iyunv@wych00 redis-2.6.17]# redis 127.0.0.1:6399> set foo bar
OK
[iyunv@wych00 redis-2.6.17]# redis 127.0.0.1:6399> get foo
&quot;bar&quot;
  #########################################################################################################
#####################################node.js安装#################################################################
#########################################################################################################
使用  yum install gcc gcc-c&#43;&#43; autoconf automake 来安装编译环境;
先检查是否安装python,并且python的版本需要在2.6以上
运行命令python –V查看当前python版本如果没安装运行以下步骤:
(A) 在以下网址下载(http://www.python.org/ftp/python/)对应的python的安装包;
(B) 下载完成后,解压python(命令:tar xzf Python-2.X.X.tgz),进入python安装程序目录(命令:cd Python-2.X.X);
(C) 编译安装python,按顺序执行以下命令:
./configure --prefix=/usr/local/python2.X;
make;
make install;
&#61548; 安装node
(A)下载nodejs到本地并解压缩
wget http://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz
tar zxvf node-v0.10.21.tar.gz
(B)进入到该目录编译和安装
cd node-v0.10.21
./configure --prefix=/usr/local/node/0.10.21
这样指定安装在/usr/local/node/0.10.21目录下
make
make install
  3).配置NODE_HOME
[iyunv@node-v0.9.0]# vi /etc/profile
在export PATH USER 。。。一行的上面添加如下内容,并将NODE_HOME/bin设置到系统path中
#set for nodejs
export NODE_HOME=/usr/local/node/0.9.0
export PATH=$NODE_HOME/bin:$PATH
保存退出后执行如下命令,使刚才的配置生效
[iyunv@node-v0.9.0]# source /etc/profile
  2、环境安装
&#61548; 修改程序包中的config/BaseConfig.js中的数据库连接;
&#61548; 在程序包根目录下运行npm install,安装必需的包;
&#61548; 安装包完成后,运行node run.js运行程序。
  
  
  
#########################################################################################################
#####################################常用配置文件及启动方法##############################################
#########################################################################################################
服务网关(HA)机器常用配置及启动命令:
[iyunv@rhong1 ~]# vi /data/sgcore/ngx/src/usgateway/core.lua    (服务网管超时时间设置点)
[iyunv@rhong1 ~]# vi /data/sgcore/ngx/src/usgateway/init.lua    (服务网管连接读数据设置)
[iyunv@rhong1 ~]# vi /data/sgcore/ngx/cfg/sg.ngx.conf    (rhongx配置文件)
[iyunv@rhong1 ~]# vi /data/sgcore/ngx/cfg/sg.aof.conf    (redis配置文件)
[iyunv@rhong1 ~]# vi /etc/keepalived/keepalived.conf     (keepalived配置文件)
[iyunv@rhong1 ~]# /opt/redis-2.6.17/src/redis-server /data/sgcore/ngx/cfg/sg.aof.conf  (默认只在130.58上启动)
[iyunv@rhong2 ~]# /usr/local/webserver/rhongx/sbin/nginx -c /data/sgcore/ngx/cfg/sg.ngx.conf
[iyunv@rhong2 ~]# service keepalived start
  业务网关(HA)机器常用配置及启动命令:
[iyunv@rhong1 ~]# vi /etc/keepalived/keepalived.conf     (keepalived配置文件)
[iyunv@ngx2 ~]# vi /usr/local/nginx/conf/nginx.conf      
[iyunv@rhong2 ~]# service keepalived start
[iyunv@ngx2 ~]# /usr/local/nginx/sbin/nginx
[iyunv@ngx2 ~]# /usr/local/nginx/sbin/nginx -s stop
  PHP(AA)机器常用配置及启动命令:
[iyunv@php1 ~]# vi /usr/local/php/etc/php-fpm.conf
[iyunv@php1 ~]# /usr/local/php/sbin/php-fpm
  PHP(AA)发布:
[iyunv@php1 scripts]# vi /scripts/config/database.php  (php连接数据库配置文件)
[iyunv@php1 ~]# cd /scripts/    (发布php文件)
  [iyunv@php1 scripts]# cd /nodejs/spider/    (nodejs部署文件路径)
[iyunv@php1 scripts]# vi /nodejs/spider/ticket/config/BaseConfig.js (连接读数据)
[iyunv@php1 scripts]# vi /nodejs/spider/tour/config/BaseConfig.js   (连接写数据)
  
  #########################################################################################################
#####################################Memcache##############################################
#########################################################################################################
  Memcache的安装、配置如下:
/usr/local/webserver/php/ 这个php的安装路径要根据服务器的安装路径做修改。
  wget http://pecl.php.net/get/memcache-2.2.7.tgz
./configure --enable-memcache --with-php-config=/usr/local/webserver/php/bin/php-config -with-zlib-dir
make
make install
  在 php.ini 文件添加
[memcache]
extension_dir = &quot;/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/&quot;
extension=memcache.so
  
         版权声明:本文为博主原创文章,未经博主允许不得转载。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-139851-1-1.html 上篇帖子: LNMP一键安装环境 下篇帖子: Ubuntu 10.10上编译安装LNMP
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表