argus/src/log/elasticsearch/build/start-es-supervised.sh
yuyr 8a38d3d0b2 dev_1.0.0_yuyr 完成 log和bind模块开发部署测试 (#8)
- [x] 完成log模块镜像构建、本地端到端写日志——收集——查询流程;
- [x] 完成bind模块构建;
- [x] 内置域名IP自动更新脚本,使用 /private/argus/etc目录下文件进行同步,容器启动时自动写IP,定时任务刷新更新DNS服务器IP和DNS规则;

Co-authored-by: root <root@curious.host.com>
Reviewed-on: #8
Reviewed-by: sundapeng <sundp@mail.zgclab.edu.cn>
2025-09-22 16:39:38 +08:00

33 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -euo pipefail
echo "[INFO] Starting Elasticsearch under supervisor..."
# 创建数据目录并设置权限(如果不存在)
mkdir -p /private/argus/log/elasticsearch
# 创建软链接到Elasticsearch预期的数据目录
if [ -L /usr/share/elasticsearch/data ]; then
rm /usr/share/elasticsearch/data
elif [ -d /usr/share/elasticsearch/data ]; then
rm -rf /usr/share/elasticsearch/data
fi
ln -sf /private/argus/log/elasticsearch /usr/share/elasticsearch/data
# 记录容器ip地址
DOMAIN=es.log.argus.com
IP=`ifconfig | grep -A 1 eth0 | grep inet | awk '{print $2}'`
echo current IP: ${IP}
echo ${IP} > /private/argus/etc/${DOMAIN}
echo "[INFO] Data directory linked: /usr/share/elasticsearch/data -> /private/argus/log/elasticsearch"
# 设置环境变量ES配置通过docker-compose传递
export ES_JAVA_OPTS="${ES_JAVA_OPTS:-"-Xms512m -Xmx512m"}"
echo "[INFO] Starting Elasticsearch process..."
# 启动原始的Elasticsearch entrypoint
exec /usr/local/bin/docker-entrypoint.sh elasticsearch