码迷,mamicode.com
首页 > 编程语言 > 详细

java项目高可用实现配置(包括nginx、redis、keepalived、ekl、filebeat、java、tomcat)

时间:2019-05-23 18:18:11      阅读:449      评论:0      收藏:0      [点我收藏+]

标签:filebeat   i18n   安装文件   用户   gsm   链接   eve   hup   min   

0、涉及安装包和配置文件下载

链接: https://pan.baidu.com/s/1xNYgrk8V_bB86WbRo8mNxg 提取码: mxzk 

链接: https://pan.baidu.com/s/1ii64LcqhySegSMaDu5vlOg 提取码: gu3s 

1、jdk安装

tar -zxzf jdk-8u144-linux-x64.tar.gz

ln -s jdk1.8.0_144/ /usr/local/jdk

vim /etc/profile

 

source /etc/profile

 

#set java environment

JAVA_HOME=/usr/local/src/jdk1.8.0_144

JRE_HOME=$JAVA_HOME/jre

CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

export JAVA_HOME JRE_HOME CLASS_PATH PATH

 

2、tomcat安装

tar -zxzf apache-tomcat-8.5.41.tar.gz

mv apache-tomcat-8.5.41/ /usr/local/tomcat

 

URIEncoding="UTF-8" maxPostSize="-1"

 

#启动时报host错误时,

vi /etc/hosts

在127.0.0.1后加上机器名

 

3、Gcc 离线安装

cd /usr/local/src/gcc/

rpm -ivh linux-glibc-devel-3.9-1.1.noarch.rpm 

rpm -ivh glibc-devel-2.22-8.4.x86_64.rpm 

rpm -ivh cpp48-4.8.5-196.1.x86_64.rpm 

rpm -Uvh cpp48-4.8.5-196.1.x86_64.rpm 

rpm -ivh libasan0-4.8.5-196.1.x86_64.rpm 

rpm -ivh libatomic1-4.8.5-196.1.x86_64.rpm 

rpm -ivh libgomp1-4.8.5-196.1.x86_64.rpm 

rpm -ivh libtsan0-4.8.5-196.1.x86_64.rpm 

rpm -ivh libitm1-4.8.5-196.1.x86_64.rpm 

rpm -ivh gcc48-4.8.5-196.1.x86_64.rpm 

rpm -ivh gcc-4.8-6.68.x86_64.rpm 

rpm -ivh libstdc++48-devel-4.8.5-196.1.x86_64.rpm 

rpm -ivh libstdc++-devel-4.8-6.68.x86_64.rpm 

rpm -ivh gcc48-c++-4.8.5-196.1.x86_64.rpm 

rpm -ivh gcc-c++-4.8-6.68.x86_64.rpm 

gcc -v

 

若安装出现版本冲突时,使用rpm -Uvh更新

 

4、nginx安装

 

安装依赖

 

tar -zxzf pcre-8.38.tar.gz 

cd pcre-8.38/

./configure && make && make install

cd ../

tar -zxzf zlib-1.2.11.tar.gz 

cd zlib-1.2.11/

./configure && make && make install

cd ../

tar -zxzf openssl-1.1.1b.tar.gz 

 

安装nginx

tar -zxzf nginx-1.14.2.tar.gz 

cd nginx-1.14.2/

./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.38 --with-zlib=/usr/local/src/zlib-1.2.11 --with-openssl=/usr/local/src/openssl-1.1.1b

make && make install

cp /usr/local/nginx/nginx /usr/bin/

cp /usr/local/nginx/nginx.conf /etc/nginx.conf

 

 

 

 

 

若安装出现openssl问题可以把--with-openssl=/usr/local/src/openssl-1.1.1b暂时不用

 

5、redis安装

 

tar -zxzf redis-5.0.4.tar.gz

cd redis-5.0.4/

make MALLOC=libc

cp src/redis-server /usr/bin/

cp src/redis-cli /usr/bin/

cp redis.conf /etc/

 

6、keepalived安装

 

 

tar -zxzf keepalived-2.0.15.tar.gz 

cd keepalived-2.0.15/

./configure --prefix=/usr/local/keepalived

make && make install

 

cp /usr/local/keepalived/etc/sysconfig/keepalived  /etc/sysconfig/keepalived

cp /usr/local/keepalived/sbin/keepalived /usr/sbin/keepalived

cp /usr/local/src/keepalived-2.0.15/keepalived/etc/init.d/keepalived /etc/init.d/

mkdir /etc/keepalived

cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf

chkconfig -add keepalived

 

#开机自启动

chkconfig keepalived on

 

 

#可能需要依赖libopenssl-devel,使用zypper安装

zypper in libopenssl-devel

 

7、redis高可用

 

配置文件:/temp/linux安装文件/config/redis-keepalived

 

 

redis-server /etc/redis.conf 

keepalived

 

#sh文件赋予执行权限

chmod +x /etc/keepalived/*.sh

 

redis-cli -a 123456 shutdown

killproc keepalived

 

 

 

Log目录

 

/var/log/message

/var/log/keepalived-redis-check.log

/var/log/keepalived-redis-state.log

 

 

8、nginx 高可用

 

配置文件:/temp/linux安装文件/config/nginx-keepalived

 

 

nginx

keepalived

 

#sh文件赋予执行权限

chmod +x /etc/keepalived/*.sh

 

Nginx -s stop

killproc keepalived

 

 

 

 

Log目录

/var/log/message

 

9、elasticsearch安装 

 

 

cd /usr/local/src/

tar -zxzf elasticsearch-7.1.0-linux-x86_64.tar.gz 

mv elasticsearch-7.1.0/ /usr/local/elasticsearch

cd ../elasticsearch/bin

#启动

./elasticsearch  

#后台启动

./elasticsearch -d

 

 

#配置文件

/temp/linux安装文件/config/elasticsearch.yml

 

#不能使用root用户允许,创建用户

useradd elastic

chown -R elastic /usr/local/elasticsearch/

su elastic

 

#配置log统一路径,赋予权限给新用户

mkdir -p /usr/local/data/elasticsearch/log /usr/local/data/elasticsearch/data

chown -R elastic /usr/local/data/elasticsearch

chmod 777 /usr/local/data/elasticsearch

 

 

#修改系统配置

vim /etc/sysctl.conf

vm.max_map_count=655360

 

vim /etc/security/limits.conf

* soft nofile 65536

* hard nofile 131072

* soft nproc 4096

* hard nproc 4096

* hard memlock unlimited

* soft memlock unlimited

*  - as unlimited

 

#访问路径

http://192.168.1.203:9200

 

#删除所有日志

curl -XDELETE http://192.168.1.203:9200/_all

 

10、kibana安装

 

cd /usr/local/src/

tar -zxzf kibana-7.1.0-linux-x86_64.tar.gz

mv kibana-7.1.0-linux-x86_64 ../kibana

cd ../kibana/bin

./kibana

 

#后台启动

nohup ./kibana &

 

#配置文件

/temp/linux安装文件/config/kibana.yml

 

#支持中文

i18n.locale: "zh-CN"

 

11、logstash安装

 

 

cd /usr/local/src/

tar -zxzf logstash-7.1.0.tar.gz

mv logstash-7.1.0 ../logstash

cd ../logstash/bin

./logstash -f ../config/logstash.conf

 

#后台启动

nohup ./logstash -f ../config/logstash.conf &

 

12、filebeat安装

 

cd /usr/local/src/

tar -zxzf filebeat-7.1.0-linux-x86_64.tar.gz

mv filebeat-7.1.0-linux-x86_64 ../filebeat

cd ../filebeat/

 ./filebeat 

 

 

#后台启动

nohup ./filebeat &

java项目高可用实现配置(包括nginx、redis、keepalived、ekl、filebeat、java、tomcat)

标签:filebeat   i18n   安装文件   用户   gsm   链接   eve   hup   min   

原文地址:https://www.cnblogs.com/llmke/p/10913369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!