Spark-ClickHouse-ES实时项目第二天上-Nginx安装

仓库位置

日志生成:https://github.com/SmallScorpion/gmall-mock.git
日志服务器:https://github.com/SmallScorpion/gmall-spark-ch-es-realtime.git

安装Nginx

  1. 安装依赖
> sudo yum -y install    openssl openssl-devel pcre pcre-devel    zlib zlib-devel gcc gcc-c++

Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第1张图片

  1. 解压配置
    解压缩nginx-xx.tar.gz包(压缩包在项目中)
    Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第2张图片

  2. 指定安装目录

./configure   --prefix=/opt/module/nginx_spark_ch_es_realtime

Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第3张图片
4. 编译

make && make install 

Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第4张图片

启动命令:  在/usr/local/nginx/sbin目录下执行  ./nginx
关闭命令: 在/usr/local/nginx/sbin目录下执行  ./nginx  -s  stop 
重新加载命令: 在/usr/local/nginx/sbin目录下执行  ./nginx  -s reload
  1. 赋权限
sudo setcap cap_net_bind_service=+eip /opt/module/nginx_spark_ch_es_realtime/sbin/nginx

Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第5张图片
6. 修改/opt/module/nginx_spark_ch_es_realtime/conf/nginx.conf

http{
     
   ..........
    upstream logserver{
     
      server    hadoop102:8080 weight=1;  
      server    hadoop103:8080 weight=1;
      server    hadoop104:8080 weight=1;
 
    }
    server {
     
        listen       80;
        server_name  logserver;
 
        location / {
     
            root   html;
            index  index.html index.htm;
            proxy_pass http://logserver;
            proxy_connect_timeout 10;
 
         }
   ..........
}

Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第6张图片

更改发送端口

更改日志生成发送到nginx端口地址

Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第7张图片

启动

开启日志服务器 …jar
开启103 104检测log日志 tail -20f /…/.log
开启nginx ./nginx
启动日志生成 java -jar …jar
Spark-ClickHouse-ES实时项目第二天上-Nginx安装_第8张图片

采集脚本

#!/bin/bash
JAVA_BIN=/opt/module/jdk1.8.0_144/bin/java
#PROJECT= spark-ck-es-mock-log/logger_server
APPNAME=gmall-logger-0.0.1-SNAPSHOT.jar
SERVER_PORT=8080
 
case $1 in
 "start")
   {
     
 
    for i in hadoop102 hadoop103 hadoop104
    do
     echo "========: $i==============="
    ssh $i  "$JAVA_BIN -Xms32m -Xmx64m  -jar /home/atguigu/spark-ck-es-mock-log/logger_server/$APPNAME --server.port=$SERVER_PORT >/dev/null 2>&1  &"
    done
     echo "========NGINX==============="
    /opt/module/nginx_spark_ch_es_realtime/sbin/nginx
  };;
  "stop")
  {
      
     echo "======== NGINX==============="
    /opt/module/nginx_spark_ch_es_realtime/sbin/nginx  -s stop
    for i in hadoop102 hadoop103 hadoop104
    do
     echo "========: $i==============="
     ssh $i "ps -ef|grep $APPNAME |grep -v grep|awk '{print \$2}'|xargs kill" >/dev/null 2>&1
    done
 
  };;
   esac

你可能感兴趣的:(Spark,ClickHouse,ElasticSearch,spark)