init doc
This commit is contained in:
6
doc/script/docker/app/.env
Normal file
6
doc/script/docker/app/.env
Normal file
@@ -0,0 +1,6 @@
|
||||
BLADE_PROFILES_ACTIVE=test
|
||||
BLADE_OAUTH2_PUBLIC_KEY=国密公钥需自行填写
|
||||
BLADE_OAUTH2_PRIVATE_KEY=国密私钥需自行填写
|
||||
BLADE_TOKEN_SIGN_KEY=令牌密钥需自行填写
|
||||
HOST_IP=宿主机IP需自行填写
|
||||
MYSQL_ROOT_PASSWORD=MYSQL的ROOT密码需自行填写
|
||||
6
doc/script/docker/app/README.md
Normal file
6
doc/script/docker/app/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
## 一键部署流程
|
||||
1. 将开发完毕的数据库脚本放入`database`目录下,重命名为`init.sql`, 提前修改好`admin`的密码。
|
||||
2. 将`.env`文件内所需的内容填充完整,注意`publicKey`需要与前端配置保持一致。
|
||||
3. 将前端工程配置好`publicKey`后打包,将打包后的文件放入`nginx/html`目录下。
|
||||
4. 生产环境需采用`prod`模式启动,将会强制校验弱密码,未修改`admin`密码将会无法登陆。
|
||||
5. 执行`docker compose up -d`命令启动容器即可。
|
||||
3635
doc/script/docker/app/database/init.sql
Normal file
3635
doc/script/docker/app/database/init.sql
Normal file
File diff suppressed because one or more lines are too long
114
doc/script/docker/app/docker-compose.yaml
Normal file
114
doc/script/docker/app/docker-compose.yaml
Normal file
@@ -0,0 +1,114 @@
|
||||
# 定义网络配置
|
||||
networks:
|
||||
blade_net:
|
||||
driver: bridge # 使用 bridge 驱动,创建一个桥接网络
|
||||
ipam: # IP 地址管理配置
|
||||
config:
|
||||
- subnet: 172.30.0.0/16 # 定义子网,IP 范围从 172.30.0.0 到 172.30.255.255
|
||||
|
||||
# 定义服务配置
|
||||
services:
|
||||
# BladeX 后端 服务,提供BladeX平台业务功能
|
||||
blade-api:
|
||||
image: blade/blade-api:4.6.0.RELEASE
|
||||
container_name: blade-api
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# OAuth2 公钥,用于身份验证
|
||||
- BLADE_OAUTH2_PUBLIC_KEY=${BLADE_OAUTH2_PUBLIC_KEY}
|
||||
# OAuth2 私钥,用于验签解码
|
||||
- BLADE_OAUTH2_PRIVATE_KEY=${BLADE_OAUTH2_PRIVATE_KEY}
|
||||
# BladeX 密钥,用于Token签名
|
||||
- BLADE_TOKEN_SIGN_KEY=${BLADE_TOKEN_SIGN_KEY}
|
||||
# 时区设置
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 8000:80 # 映射 80 端口到主机的 8000 端口
|
||||
command:
|
||||
- --spring.profiles.active=${BLADE_PROFILES_ACTIVE} # 设置系统启动模式
|
||||
- --social.domain=http://${HOST_IP}:2888 # 设置第三方登录跳转域名
|
||||
depends_on:
|
||||
- blade-db # 依赖数据库
|
||||
- blade-oss # 依赖对象存储
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.80
|
||||
|
||||
# MySQL 数据库服务
|
||||
blade-db:
|
||||
image: mysql:8.3.0
|
||||
container_name: blade-db
|
||||
restart: unless-stopped
|
||||
security_opt:
|
||||
- seccomp:unconfined # 禁用 seccomp 安全配置,允许更多操作
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
- MYSQL_CHARSET=utf8mb4 # 设置字符集为 utf8mb4
|
||||
- MYSQL_COLLATION=utf8mb4_unicode_ci # 设置排序规则为 utf8mb4_unicode_ci
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} # 数据库 root 密码
|
||||
- MYSQL_USER=bladexadmin
|
||||
- MYSQL_PASSWORD=bladexadmin
|
||||
- MYSQL_DATABASE=bladex_boot
|
||||
ports:
|
||||
- 13306:3306 # 映射 MySQL 服务端口
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql # 持久化 MySQL 数据
|
||||
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql # 挂载 SQL 初始化脚本
|
||||
command: --lower_case_table_names=1 # 添加忽略大小写配置
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.33
|
||||
|
||||
# Redis 服务,用于缓存
|
||||
blade-redis:
|
||||
image: redis:7.2.5
|
||||
container_name: blade-redis
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
ports:
|
||||
- 16379:6379 # 映射 Redis 默认端口
|
||||
command: redis-server --appendonly yes --requirepass bladexadmin # 配置密码和持久化
|
||||
privileged: true
|
||||
restart: always
|
||||
volumes:
|
||||
- ./data/redis/data:/data # 持久化 Redis 数据
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.63
|
||||
|
||||
# MinIO 对象存储服务
|
||||
blade-oss:
|
||||
image: minio/minio:RELEASE.2021-04-22T15-44-28Z.hotfix.56647434e
|
||||
container_name: blade-oss
|
||||
restart: unless-stopped
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
- MINIO_ACCESS_KEY=bladexadmin # 存储访问密钥
|
||||
- MINIO_SECRET_KEY=bladexadmin # 存储密钥
|
||||
ports:
|
||||
- 9000:9000 # 映射 MinIO 服务端口
|
||||
command: server /data --address '0.0.0.0:9000' # 启动 MinIO
|
||||
volumes:
|
||||
- ./data/minio/data:/data # 持久化数据
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.90
|
||||
|
||||
# Nginx 服务,用于反向代理和负载均衡
|
||||
blade-nginx:
|
||||
image: nginx:stable-alpine-perl
|
||||
container_name: blade-nginx
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
ports:
|
||||
- 2888:2888 # 映射端口
|
||||
volumes:
|
||||
- ./nginx/html:/usr/share/nginx/html # 持久化 Nginx 网页数据
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf # 持久化 Nginx 配置
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.18
|
||||
46
doc/script/docker/app/nginx/html/index.html
Normal file
46
doc/script/docker/app/nginx/html/index.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang='en'>
|
||||
|
||||
<head>
|
||||
<meta charset='UTF-8' />
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<meta http-equiv='X-UA-Compatible' content='chrome=1' />
|
||||
<meta name='renderer' content='webkit'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0'>
|
||||
<meta name='apple-mobile-web-app-capable' content='yes'>
|
||||
<meta name='apple-mobile-web-app-status-bar-style' content='black'>
|
||||
<meta name='format-detection' content='telephone=no'>
|
||||
<link rel='icon' href='/favicon.png' />
|
||||
<link rel='stylesheet' href='/iconfont/index.css'>
|
||||
<link rel='stylesheet' href='/iconfont/avue/iconfont.css'>
|
||||
<link rel='stylesheet' href='/iconfont/saber/iconfont.css'>
|
||||
<link rel='stylesheet' href='/iconfont/common/iconfont.css'>
|
||||
<link rel='stylesheet' href='/css/loading.css'>
|
||||
<link rel='stylesheet' href='/css/saber.css'>
|
||||
<title>BladeX微服务开发平台</title>
|
||||
<script type="module" crossorigin src="/assets/index-DpW_RhWM.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/element-plus-BIeOjcXi.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/@smallwei/avue-vR-k9VHw.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BsjWj5lr.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='app'>
|
||||
<div id='loader-wrapper'>
|
||||
<div class='loader-box'>
|
||||
<span>BladeX</span>
|
||||
<span>微</span>
|
||||
<span>服</span>
|
||||
<span>务</span>
|
||||
<span>开</span>
|
||||
<span>发</span>
|
||||
<span>平</span>
|
||||
<span>台</span>
|
||||
</div>
|
||||
<div class='loader-title'>系统加载中</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
77
doc/script/docker/app/nginx/nginx.conf
Normal file
77
doc/script/docker/app/nginx/nginx.conf
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
user root;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
#include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
upstream gateway {
|
||||
server blade-api;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 2888;
|
||||
server_name web;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_comp_level 2;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
|
||||
gzip_vary on;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
location /{
|
||||
index index.html;
|
||||
error_page 404 /index.html;
|
||||
}
|
||||
|
||||
location ~ ^/(api/)?actuator {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ^~ /oauth/redirect {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
location ^~ /api/ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_buffering off;
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
proxy_pass http://gateway/;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
27
doc/script/docker/elk/README.md
Normal file
27
doc/script/docker/elk/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
## 一、调整内存:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144](elasticsearch用户拥有的内存权限太小,至少需要262144)
|
||||
|
||||
#### 1.修改配置sysctl.conf
|
||||
[root@localhost ~]# vi /etc/sysctl.conf
|
||||
#### 2.添加下面配置:
|
||||
vm.max_map_count=262144
|
||||
#### 3.重新加载:
|
||||
[root@localhost ~]# sysctl -p
|
||||
#### 4.最后重新启动elasticsearch,即可启动成功。
|
||||
|
||||
|
||||
## 二、Docker 命令自动补全
|
||||
#### 1.安装依赖工具bash-complete
|
||||
[root@localhost ~]# yum install -y bash-completion
|
||||
|
||||
[root@localhost ~]# source /usr/share/bash-completion/completions/docker
|
||||
|
||||
[root@localhost ~]# source /usr/share/bash-completion/bash_completion
|
||||
|
||||
## 三、将本文件夹内的文件拷贝至服务器
|
||||
#### 1.对sh脚本赋予执行权限
|
||||
|
||||
#### 2.执行 ./deploy.sh
|
||||
|
||||
#### 3.等待服务启动完毕即可
|
||||
|
||||
#### 4.卸载执行 ./undeploy.sh
|
||||
88
doc/script/docker/elk/deploy.sh
Normal file
88
doc/script/docker/elk/deploy.sh
Normal file
@@ -0,0 +1,88 @@
|
||||
#./bin/bash
|
||||
# 定义颜色
|
||||
BLUE_COLOR="\033[36m"
|
||||
RED_COLOR="\033[31m"
|
||||
GREEN_COLOR="\033[32m"
|
||||
VIOLET_COLOR="\033[35m"
|
||||
RES="\033[0m"
|
||||
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
echo -e "${BLUE_COLOR}# Docker ELK Deploy Script #${RES}"
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
|
||||
# 创建目录
|
||||
echo -e "${BLUE_COLOR}---> create [elasticsearch]directory start.${RES}"
|
||||
if [ ! -d "./elasticsearch/" ]; then
|
||||
mkdir -p ./elasticsearch/master/conf ./elasticsearch/master/data ./elasticsearch/master/logs \
|
||||
./elasticsearch/slave1/conf ./elasticsearch/slave1/data ./elasticsearch/slave1/logs \
|
||||
./elasticsearch/slave2/conf ./elasticsearch/slave2/data ./elasticsearch/slave2/logs
|
||||
fi
|
||||
|
||||
echo -e "${RED_COLOR}---> create [kibana]directory start.${RES}"
|
||||
if [ ! -d "./kibana/" ]; then
|
||||
mkdir -p ./kibana/conf ./kibana/logs
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> create [logstash]directory start.${RES}"
|
||||
if [ ! -d "./logstash/" ]; then
|
||||
mkdir -p ./logstash/conf ./logstash/logs
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> create [filebeat]directory start.${RES}"
|
||||
if [ ! -d "./filebeat/" ]; then
|
||||
mkdir -p ./filebeat/conf ./filebeat/logs ./filebeat/data
|
||||
fi
|
||||
|
||||
echo -e "${VIOLET_COLOR}---> create [nginx]directory start.${RES}"
|
||||
if [ ! -d "./nginx/" ]; then
|
||||
mkdir -p ./nginx/conf ./nginx/logs ./nginx/www
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> create directory success.${RES}"
|
||||
|
||||
# 目录授权(data/logs 都要授读/写权限)
|
||||
echo -e "${BLUE_COLOR}---> directory authorize start.${RES}"
|
||||
if [ -d "./elasticsearch/" ]; then
|
||||
chmod 777 ./elasticsearch/master/data/ ./elasticsearch/master/logs/ \
|
||||
./elasticsearch/slave1/data/ ./elasticsearch/slave1/logs/ \
|
||||
./elasticsearch/slave2/data/ ./elasticsearch/slave2/logs
|
||||
fi
|
||||
|
||||
if [ -d "./filebeat/" ]; then
|
||||
chmod 777 ./filebeat/data/ ./filebeat/logs/
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> directory authorize success.${RES}"
|
||||
|
||||
# 移动配置文件
|
||||
echo -e "${BLUE_COLOR}---> move [elasticsearch]config file start.${RES}"
|
||||
if [ -f "./es-master.yml" ] && [ -f "./es-slave1.yml" ] && [ -f "./es-slave2.yml" ]; then
|
||||
mv ./es-master.yml ./elasticsearch/master/conf
|
||||
mv ./es-slave1.yml ./elasticsearch/slave1/conf
|
||||
mv ./es-slave2.yml ./elasticsearch/slave2/conf
|
||||
fi
|
||||
|
||||
echo -e "${RED_COLOR}---> move [kibana]config file start.${RES}"
|
||||
if [ -f "./kibana.yml" ]; then
|
||||
mv ./kibana.yml ./kibana/conf
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> move [logstash]config file start.${RES}"
|
||||
if [ -f "./logstash.yml" ] && [ -f "./logstash-filebeat.conf" ]; then
|
||||
mv ./logstash-filebeat.conf ./logstash/conf
|
||||
mv ./logstash.yml ./logstash/conf
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> move [filebeat]config file start.${RES}"
|
||||
if [ -f "./filebeat.yml" ]; then
|
||||
mv ./filebeat.yml ./filebeat/conf
|
||||
fi
|
||||
|
||||
echo -e "${VIOLET_COLOR}---> move [nginx]config file start.${RES}"
|
||||
if [ -f "./nginx.conf" ]; then
|
||||
mv ./nginx.conf ./nginx/conf
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> move config files success.${RES}"
|
||||
echo -e "${GREEN_COLOR}>>>>>>>>>>>>>>>>>> The End <<<<<<<<<<<<<<<<<<${RES}"
|
||||
|
||||
# 部署项目
|
||||
echo -e "${BLUE_COLOR}==================> Docker deploy Start <==================${RES}"
|
||||
docker-compose up --build -d
|
||||
115
doc/script/docker/elk/docker-compose.yml
Normal file
115
doc/script/docker/elk/docker-compose.yml
Normal file
@@ -0,0 +1,115 @@
|
||||
version: "3"
|
||||
services:
|
||||
es-master:
|
||||
container_name: es-master
|
||||
hostname: es-master
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9200:9200
|
||||
- 9300:9300
|
||||
volumes:
|
||||
- ./elasticsearch/master/conf/es-master.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/master/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/master/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-slave1:
|
||||
container_name: es-slave1
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9201:9200
|
||||
- 9301:9300
|
||||
volumes:
|
||||
- ./elasticsearch/slave1/conf/es-slave1.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/slave1/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/slave1/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-slave2:
|
||||
container_name: es-slave2
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9202:9200
|
||||
- 9302:9300
|
||||
volumes:
|
||||
- ./elasticsearch/slave2/conf/es-slave2.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/slave2/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/slave2/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-head:
|
||||
container_name: es-head
|
||||
image: mobz/elasticsearch-head:5
|
||||
restart: always
|
||||
ports:
|
||||
- 9100:9100
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
kibana:
|
||||
container_name: kibana
|
||||
hostname: kibana
|
||||
image: kibana:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 5601:5601
|
||||
volumes:
|
||||
- ./kibana/conf/kibana.yml:/usr/share/kibana/config/kibana.yml
|
||||
environment:
|
||||
- elasticsearch.hosts=http://es-master:9200
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
filebeat:
|
||||
# 容器名称
|
||||
container_name: filebeat
|
||||
# 主机名称
|
||||
hostname: filebeat
|
||||
# 镜像
|
||||
image: docker.elastic.co/beats/filebeat:7.1.1
|
||||
# 重启机制
|
||||
restart: always
|
||||
# 持久化挂载
|
||||
volumes:
|
||||
- ./filebeat/conf/filebeat.yml:/usr/share/filebeat/filebeat.yml
|
||||
# 映射到容器中[作为数据源]
|
||||
- ./logs:/home/project/elk/logs
|
||||
- ./filebeat/logs:/usr/share/filebeat/logs
|
||||
- ./filebeat/data:/usr/share/filebeat/data
|
||||
# 将指定容器连接到当前连接,可以设置别名,避免ip方式导致的容器重启动态改变的无法连接情况
|
||||
links:
|
||||
- logstash
|
||||
ports:
|
||||
- 9000:9000
|
||||
# 依赖服务[可无]
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
logstash:
|
||||
container_name: logstash
|
||||
hostname: logstash
|
||||
image: logstash:7.1.1
|
||||
command: logstash -f ./conf/logstash-filebeat.conf
|
||||
restart: always
|
||||
volumes:
|
||||
# 映射到容器中
|
||||
- ./logstash/conf/logstash-filebeat.conf:/usr/share/logstash/conf/logstash-filebeat.conf
|
||||
- ./logstash/conf/logstash.yml:/usr/share/logstash/config/logstash.yml
|
||||
ports:
|
||||
- 5044:5044
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
28
doc/script/docker/elk/es-master.yml
Normal file
28
doc/script/docker/elk/es-master.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-master
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: false
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9200
|
||||
# 设置节点间交互的tcp端口
|
||||
transport.port: 9300
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
28
doc/script/docker/elk/es-slave1.yml
Normal file
28
doc/script/docker/elk/es-slave1.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-slave1
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: true
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9201
|
||||
# 设置节点间交互的tcp端口
|
||||
#transport.port: 9301
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
28
doc/script/docker/elk/es-slave2.yml
Normal file
28
doc/script/docker/elk/es-slave2.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-slave2
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: true
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9202
|
||||
# 设置节点间交互的tcp端口
|
||||
#transport.port: 9302
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
37
doc/script/docker/elk/filebeat.yml
Normal file
37
doc/script/docker/elk/filebeat.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
filebeat.inputs:
|
||||
- type: log
|
||||
enabled: true
|
||||
paths:
|
||||
# 当前目录下的所有.log文件
|
||||
- /home/project/elk/logs/*.log
|
||||
multiline.pattern: ^\[
|
||||
multiline.negate: true
|
||||
multiline.match: after
|
||||
- type: tcp
|
||||
enabled: true
|
||||
max_message_size: 10MiB
|
||||
host: "0.0.0.0:9000"
|
||||
|
||||
filebeat.config.modules:
|
||||
path: ${path.config}/modules.d/*.yml
|
||||
reload.enabled: false
|
||||
|
||||
setup.template.settings:
|
||||
index.number_of_shards: 1
|
||||
|
||||
setup.dashboards.enabled: false
|
||||
|
||||
setup.kibana:
|
||||
host: "http://kibana:5601"
|
||||
|
||||
# 不直接传输至ES
|
||||
#output.elasticsearch:
|
||||
# hosts: ["http://es-master:9200"]
|
||||
# index: "filebeat-%{[beat.version]}-%{+yyyy.MM.dd}"
|
||||
|
||||
output.logstash:
|
||||
hosts: ["logstash:5044"]
|
||||
|
||||
processors:
|
||||
- add_host_metadata: ~
|
||||
- add_cloud_metadata: ~
|
||||
8
doc/script/docker/elk/kibana.yml
Normal file
8
doc/script/docker/elk/kibana.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
# 服务端口
|
||||
server.port: 5601
|
||||
# 服务IP
|
||||
server.host: "0.0.0.0"
|
||||
# ES
|
||||
elasticsearch.hosts: ["http://es-master:9200"]
|
||||
# 汉化
|
||||
i18n.locale: "zh-CN"
|
||||
23
doc/script/docker/elk/logstash-filebeat.conf
Normal file
23
doc/script/docker/elk/logstash-filebeat.conf
Normal file
@@ -0,0 +1,23 @@
|
||||
input {
|
||||
# 来源beats
|
||||
beats {
|
||||
# 端口
|
||||
port => "5044"
|
||||
}
|
||||
}
|
||||
# 分析、过滤插件,可以多个
|
||||
filter {
|
||||
grok {
|
||||
match => { "message" => "%{COMBINEDAPACHELOG}"}
|
||||
}
|
||||
geoip {
|
||||
source => "clientip"
|
||||
}
|
||||
}
|
||||
output {
|
||||
# 选择elasticsearch
|
||||
elasticsearch {
|
||||
hosts => ["http://es-master:9200"]
|
||||
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
|
||||
}
|
||||
}
|
||||
8
doc/script/docker/elk/logstash.yml
Normal file
8
doc/script/docker/elk/logstash.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
# 服务IP
|
||||
http.host: "0.0.0.0"
|
||||
# ES
|
||||
xpack.monitoring.elasticsearch.hosts: [ "http://es-master:9200" ]
|
||||
|
||||
xpack.monitoring.enabled: true
|
||||
|
||||
xpack.management.enabled: false
|
||||
16
doc/script/docker/elk/undeploy.sh
Normal file
16
doc/script/docker/elk/undeploy.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#./bin/bash
|
||||
# 定义颜色
|
||||
BLUE_COLOR="\033[36m"
|
||||
RED_COLOR="\033[31m"
|
||||
GREEN_COLOR="\033[32m"
|
||||
VIOLET_COLOR="\033[35m"
|
||||
RES="\033[0m"
|
||||
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
echo -e "${BLUE_COLOR}# Docker ELK UnDeploy Script #${RES}"
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
|
||||
# 部署项目
|
||||
echo -e "${BLUE_COLOR}==================> Docker UnDeploy Start <==================${RES}"
|
||||
docker-compose stop
|
||||
docker-compose rm
|
||||
1
doc/script/fatjar/service.cmd
Normal file
1
doc/script/fatjar/service.cmd
Normal file
@@ -0,0 +1 @@
|
||||
java -Xms1024m -Xmx1024m -jar app.jar
|
||||
76
doc/script/fatjar/service.sh
Normal file
76
doc/script/fatjar/service.sh
Normal file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
#设置jar文件名
|
||||
APP_NAME=app.jar
|
||||
|
||||
#使用说明,用来提示输入参数
|
||||
usage() {
|
||||
echo "Usage: sh 执行脚本.sh [start|stop|restart|status]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#检查程序是否在运行
|
||||
is_exist(){
|
||||
pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' `
|
||||
#如果不存在返回1,存在返回0
|
||||
if [ -z "${pid}" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
#启动方法
|
||||
start(){
|
||||
is_exist
|
||||
if [ $? -eq "0" ]; then
|
||||
echo "${APP_NAME} is already running. pid=${pid} ."
|
||||
else
|
||||
nohup java -Xms1024m -Xmx1024m -jar $APP_NAME > /dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
#停止方法
|
||||
stop(){
|
||||
is_exist
|
||||
if [ $? -eq "0" ]; then
|
||||
kill -9 $pid
|
||||
else
|
||||
echo "${APP_NAME} is not running"
|
||||
fi
|
||||
}
|
||||
|
||||
#输出运行状态
|
||||
status(){
|
||||
is_exist
|
||||
if [ $? -eq "0" ]; then
|
||||
echo "${APP_NAME} is running. Pid is ${pid}"
|
||||
else
|
||||
echo "${APP_NAME} is NOT running."
|
||||
fi
|
||||
}
|
||||
|
||||
#重启
|
||||
restart(){
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
#根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$1" in
|
||||
"start")
|
||||
start
|
||||
;;
|
||||
"stop")
|
||||
stop
|
||||
;;
|
||||
"status")
|
||||
status
|
||||
;;
|
||||
"restart")
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user