From e3b489e131a6893b9d8f7a680e4a8edf452598ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A5=E4=B8=BD=E7=84=B6?= Date: Tue, 24 Jun 2025 08:42:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E2=80=9D=E5=BC=80?= =?UTF-8?q?=E6=94=BE=E7=AB=AF=E5=8F=A3=E5=88=B0=E9=98=B2=E7=81=AB=E5=A2=99?= =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95=E5=91=BD=E4=BB=A4=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linux/华为云.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 linux/华为云.md diff --git a/linux/华为云.md b/linux/华为云.md new file mode 100644 index 0000000..2fefd0c --- /dev/null +++ b/linux/华为云.md @@ -0,0 +1,7 @@ +### 华为云添加端口到防火墙白名单 + +```bash +/sbin/iptables -I INPUT -p tcp --dport 8096 -j ACCEPT # 华为云添加端口8096到防火墙白名单 + +``` + From 6d8f4e96dcb7e3eab53160a6406d50bd582a01dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A5=E4=B8=BD=E7=84=B6?= Date: Tue, 24 Jun 2025 10:34:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E2=80=9C=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=ACpgsql+timescaleb?= =?UTF-8?q?=E7=9A=84dockerfile=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile/pgsql+timescale/dockerfile | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docker/Dockerfile/pgsql+timescale/dockerfile diff --git a/docker/Dockerfile/pgsql+timescale/dockerfile b/docker/Dockerfile/pgsql+timescale/dockerfile new file mode 100644 index 0000000..1a92ab5 --- /dev/null +++ b/docker/Dockerfile/pgsql+timescale/dockerfile @@ -0,0 +1,41 @@ +# 使用官方 PostgreSQL 最新版本镜像作为基础镜像 +FROM postgres:latest + +# 设置环境变量,用于 PostgreSQL 初始化 +ENV POSTGRES_USER=postgres +ENV POSTGRES_PASSWORD=yhsoft@ecs +ENV POSTGRES_DB=postgres + +# 安装必要的依赖 +RUN apt-get update && apt-get install -y wget gnupg lsb-release + +# 获取当前系统的发行版代号 +RUN DISTRO=$(lsb_release -c -s) && \ + # 添加 TimescaleDB 软件源和 GPG 密钥 + wget -q -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add - && \ + echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $DISTRO main" > /etc/apt/sources.list.d/timescaledb.list + +# 检查文件是否正确生成 +RUN cat /etc/apt/sources.list.d/timescaledb.list + +# 更新包列表 +RUN apt-get update + +# 获取最新的 PostgreSQL 版本号 +RUN PG_VERSION=$(pg_config --version | grep -oE '[0-9]+' | head -n 1) && \ + # 安装与最新 PostgreSQL 版本兼容的 TimescaleDB + apt-get install -y timescaledb-2-postgresql-$PG_VERSION + +# 创建一个脚本,在容器启动时修改配置文件 +RUN echo '#!/bin/bash' > /docker-entrypoint-initdb.d/setup.sh && \ + echo 'while [ ! -f /var/lib/postgresql/data/postgresql.conf ]; do' >> /docker-entrypoint-initdb.d/setup.sh && \ + echo ' sleep 1' >> /docker-entrypoint-initdb.d/setup.sh && \ + echo 'done' >> /docker-entrypoint-initdb.d/setup.sh && \ + echo "echo \"shared_preload_libraries = 'timescaledb'\" >> /var/lib/postgresql/data/postgresql.conf" >> /docker-entrypoint-initdb.d/setup.sh && \ + chmod +x /docker-entrypoint-initdb.d/setup.sh + +# 暴露 PostgreSQL 默认端口 +EXPOSE 5432 + +# 容器启动时执行的命令,启动 PostgreSQL 服务 +CMD ["postgres"] \ No newline at end of file