digoal
2023-08-14
PostgreSQL , PolarDB , docker , 插件 , Dockerfile , docker build
amd64芯片参考:
以上docker镜像是在x86芯片的macOS上做的, 本文基于以上内容重新做了一个apple chip的版本.
为了图方便, 就不做同时支持multi platform的同名镜像了. apple chip的版本使用了另一个标签: pg14_with_exts_arm64.
已经集成到云起实验室, 云起实验永久免费提供给PostgreSQL数据库开源爱好者、PostgreSQL数据库教学.
# 拉取镜像, 第一次拉取一次即可. 或者需要的时候执行, 将更新到最新镜像版本.
docker pull registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:pg14_with_exts_arm64
# 启动容器
docker run -d -it -P --cap-add=SYS_PTRACE --cap-add SYS_ADMIN --privileged=true --name pg --shm-size=1g registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:pg14_with_exts_arm64
##### 如果你想学习备份恢复、修改参数等需要重启数据库实例的case, 换个启动参数, 使用参数--entrypoint将容器根进程换成bash更好. 如下:
docker run -d -it -P --cap-add=SYS_PTRACE --cap-add SYS_ADMIN --privileged=true --name pg --shm-size=1g --entrypoint /bin/bash registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:pg14_with_exts_arm64
##### 以上启动方式需要进入容器后手工启动数据库实例: su - postgres; pg_ctl start;
##### 将 宿主机的存储位置 映射到 docker容器内 的例子
# 宿主机:
# mkdir -p ~/docker_volumn/pg
# 创建容器时进行映射, 例如: -v ~/docker_volumn/pg:/data 将宿主机 ~/docker_volumn/pg 映射到 容器 /data
# 如:
# docker run -v ~/docker_volumn/pg:/data -d -it -P --cap-add=SYS_PTRACE --cap-add SYS_ADMIN --privileged=true --name pg --shm-size=1g registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:pg14_with_exts_arm64
#####
# 进入容器
docker exec -ti pg bash
# 连接数据库
psql
插件列表:
- 与amd64 image集成的插件一样. 请参考, 《AMD64 , 使用Dockerfile+docker build制作PolarDB | PostgreSQL 开源docker镜像, 集成大量插件方便学习, 并推送到阿里云镜像服务》
使用duckdb:
# 进入容器
docker exec -ti pg bash
# 切换用户
su - postgres
# 启动duckdb
./duckdb
1、创建Dockerfile工作目录:
mkdir ~/pg14
2、下载Oracle OCI到Dockerfile工作目录. (oracle_fdw, dblink_plus插件依赖oracle library.)
《PostgreSQL 商用版本EPAS(阿里云ppas) - 测试环境部署(EPAS 安装、配置、管理、Oracle DBLINK、外表)》
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
https://www.oracle.com/database/technologies/instant-client/linux-arm-aarch64-downloads.html
cd ~/pg14
unzip instantclient-basic-linux.arm64-19.19.0.0.0dbru.zip
unzip instantclient-sdk-linux.arm64-19.19.0.0.0dbru.zip
2.1、下载几个较大的源码包, 降低在docker build时下载报错导致build失败的概率.
cd ~/pg14
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L http://faculty.cse.tamu.edu/davis/GraphBLAS/GraphBLAS-3.1.1.tar.gz -o GraphBLAS-3.1.1.tar.gz
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://api.pgxn.org/dist/datasketches/1.7.0/datasketches-1.7.0.zip -o datasketches-1.7.0.zip
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/duckdb/duckdb/releases/download/v0.9.2/libduckdb-linux-aarch64.zip -o libduckdb-linux-aarch64.zip
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/duckdb/duckdb/releases/download/v0.9.2/libduckdb-src.zip -o libduckdb-src.zip
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/duckdb/duckdb/releases/download/v0.9.2/duckdb_cli-linux-aarch64.zip -o duckdb_cli-linux-aarch64.zip
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/Kitware/CMake/releases/download/v3.27.4/cmake-3.27.4.tar.gz -o cmake-3.27.4.tar.gz
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/Kitware/CMake/releases/download/v3.27.9/cmake-3.27.9-linux-aarch64.tar.gz -o cmake-3.27.9-linux-aarch64.tar.gz
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/mongodb/mongo-c-driver/releases/download/1.17.3/mongo-c-driver-1.17.3.tar.gz -o mongo-c-driver-1.17.3.tar.gz
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/json-c/json-c/archive/json-c-0.15-20200726.tar.gz -o json-c-0.15-20200726.tar.gz
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/microsoft/onnxruntime/releases/download/v1.15.1/onnxruntime-linux-aarch64-1.15.1.tgz -o onnxruntime-linux-aarch64-1.15.1.tgz
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://nodejs.org/download/release/v14.21.3/node-v14.21.3.tar.gz -o node-v14.21.3.tar.gz
pg_task需要修改postgres.c, 很容易下载失败, 预编译好, 防止制作docker image失败.
cd pg14
docker cp pg:/usr/lib/postgresql/14/lib/pg_task.so ./
docker cp pg:/usr/lib/postgresql/14/lib/bitcode/pg_task ./
docker cp pg:/usr/lib/postgresql/14/lib/bitcode/pg_task.index.bc ./
docker cp pg:/usr/share/postgresql/14/extension/pg_task.control ./
docker cp pg:/usr/share/postgresql/14/extension/pg_task--1.0.sql ./
参考文档打包pg_tiktoken:
参考文档打包lantern_extras:
参考文档打包pg_bm25(pg_search), pg_sparse(svector), pg_analytics, pg_lakehouse:
参考文档打包pg_idkit:
参考文档打包 PgDD:
参考文档打包 pgmq, pg_later, pg_vectorize :
3.0、解决github慢或无法联通问题:
# 如果有必要, 可以使用如下方法解决github clone性能问题.
# [《macOS 通过“oversea region ECS和ssh隧道转发代理请求” OR “openVPN” 提升github等访问体验 - chrome Proxy SwitchyOmega , cli ... 可用》](../202310/20231029_01.md)
# 在docker宿主机开启代理, proxy.sh 里面 -D 127.0.0.1:11111 改成 -D 0.0.0.0:11111 表示监听所有ipv4端口
# 获取宿主机bridgeIP: ifconfig
# 在docker build的脚本中, 执行 github clone 开始前, 先执行export 如下. 执行一次即可.
# export all_proxy=socks5://宿主机bridgeIP:11111
3、准备脚本, 参考末尾Max depth exceeded
报错, 目的是减少dockerfile步骤. 但是写成一堆脚本不太好调试, 建议先手工制作后再用Dockerfile来制作.
cd ~/pg14
vi 1.sh
#!/bin/bash
set -vx
cd /tmp
sed -i "s@http://\(deb\|security\).debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list
apt-get update
apt-get reinstall -y apt-transport-https ca-certificates
sed -i "s@http://mirrors.aliyun.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list
apt-get update
apt-get install -y lsb-release wget vim man
# RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
apt-get install -y gnupg2
# RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmour -o /etc/apt/trusted.gpg.d/postgresql.gpg
# wget --quiet -O - https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/apt/ACCC4CF8.asc | gpg --dearmour -o /etc/apt/trusted.gpg.d/postgresql.gpg
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | gpg --dearmour -o /etc/apt/trusted.gpg.d/postgresql.gpg
apt-get update
apt-get install -y locales
localedef -i en_US -f UTF-8 en_US.UTF-8
apt-get install -y curl libicu-dev icu-devtools libbison-dev libfl-dev git libreadline-dev libedit-dev g++ make cmake man-db dnsutils clang libssl-dev default-jdk strace gdb libsqlite3-dev lsof blktrace
apt-get install -y unixodbc unixodbc-dev bash-completion m4 python3-distutils python glibc-source zlib1g-dev pkg-config default-jre openjdk-17-jdk openjdk-17-jdk-headless
apt-get install -y zip unzip dpkg-dev
apt-get install -y -q oracle-libs
# echo "A" | apt-get install -y -q oracle-libs
apt-get install -y postgresql-14 postgresql-client-14 postgresql-server-dev-14 postgresql-doc-14
apt-get install -y postgresql-14-dirtyread postgresql-14-extra-window-functions postgresql-14-first-last-agg postgresql-14-hll postgresql-14-hypopg
apt-get install -y postgresql-14-ip4r postgresql-14-mysql-fdw postgresql-14-jsquery postgresql-14-ogr-fdw postgresql-14-oracle-fdw postgresql-14-pgmemcache
apt-get install -y postgresql-14-pljava postgresql-14-pllua postgresql-14-plpgsql-check postgresql-14-plproxy postgresql-14-prefix postgresql-14-rational
apt-get install -y postgresql-14-rdkit postgresql-14-orafce postgresql-14-pg-qualstats postgresql-14-pg-stat-kcache
apt-get install -y postgresql-14-pg-wait-sampling postgresql-14-pgfincore postgresql-14-pgaudit postgresql-14-pgpool2 postgresql-14-pgrouting postgresql-14-pgrouting-doc
apt-get install -y postgresql-14-pgrouting-scripts postgresql-14-pgsphere postgresql-14-pgvector postgresql-14-pldebugger postgresql-14-pointcloud postgresql-14-plr
apt-get install -y postgresql-14-postgis-3 postgresql-14-postgis-3-scripts postgresql-14-powa powa-collector postgresql-14-q3c postgresql-14-repack
apt-get install -y postgresql-14-rum postgresql-14-show-plans postgresql-14-similarity postgresql-14-tablelog postgresql-14-tdigest postgresql-14-wal2json
apt-get install -y postgresql-14-tds-fdw postgresql-14-plprofiler postgresql-14-cron
apt-get install -y pgagroal pgpool2 pgbouncer pgxnclient pgagent postgresql-plpython3-14 postgresql-14-icu-ext libpq-dev pgreplay pgbackrest pgbackrest-doc elephant-shed-pgbackrest patroni barman etcd vip-manager2 repmgr postgresql-14-repmgr postgresql-14-pgtap inetutils-ping telnet
echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | tee /etc/apt/sources.list.d/timescaledb.list
for ((i=1;i>=0;i=1))
do
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg
if [ $? -eq 0 ]; then
break
fi
done
for ((i=1;i>=0;i=1))
do
apt-get update
if [ $? -eq 0 ]; then
break
fi
done
for ((i=1;i>=0;i=1))
do
apt-get install -y timescaledb-2-postgresql-14 timescaledb-toolkit-postgresql-14 timescaledb-2-loader-postgresql-14
if [ $? -eq 0 ]; then
break
fi
done
for ((i=1;i>=0;i=1))
do
wget -T 36000 -t 0 --waitretry=5 https://packages.groonga.org/debian/groonga-apt-source-latest-bullseye.deb
if [ $? -eq 0 ]; then
break
fi
done
apt-get install -y -V ./groonga-apt-source-latest-bullseye.deb
for ((i=1;i>=0;i=1))
do
apt-get update
if [ $? -eq 0 ]; then
break
fi
done
for ((i=1;i>=0;i=1))
do
apt-get install -y postgresql-14-pgdg-pgroonga
if [ $? -eq 0 ]; then
break
fi
done
apt-get install -y postgresql-14-credcheck postgresql-14-decoderbufs postgresql-14-mimeo postgresql-14-pgmp postgresql-14-preprepare postgresql-14-prioritize postgresql-14-squeeze postgresql-14-toastinfo postgresql-14-unit pgbadger pg-auto-failover-cli postgresql-14-auto-failover net-tools apt-utils ora2pg pgloader postgresql-14-partman pg-activity
# 包安装方式暂不支持ARM架构
# https://dev.mysql.com/downloads/repo/apt/
# cd /tmp
# wget -T 36000 -t 0 --waitretry=5 https://repo.mysql.com//mysql-apt-config_0.8.28-1_all.deb
# dpkg -i mysql-apt-config_0.8.28-1_all.deb
# apt-get update
# apt-get install -y mysql-server
# proxysql, High Performance Advanced Proxy for MySQL
# https://proxysql.com/documentation/installing-proxysql/
cd /tmp
dpkg -i proxysql_2.5.5-debian11_arm64.deb
vi 2.sh
#!/bin/bash
set -vx
export ROOT_HOME=/root
echo "# add by digoal" >>$ROOT_HOME/.bashrc
echo "alias rm='rm -i'" >>$ROOT_HOME/.bashrc
echo "alias cp='cp -i'" >>$ROOT_HOME/.bashrc
echo "alias ll='ls -larth'" >>$ROOT_HOME/.bashrc
echo "alias mv='mv -i'" >>$ROOT_HOME/.bashrc
echo "export PGHOME=/usr/lib/postgresql/14" >>$ROOT_HOME/.bashrc
echo "export PATH=\$PGHOME/bin:\$PATH" >>$ROOT_HOME/.bashrc
echo "export LD_LIBRARY_PATH=\$PGHOME/lib:/usr/local/lib:/usr/lib/aarch64-linux-gnu:\$LD_LIBRARY_PATH" >>$ROOT_HOME/.bashrc
echo "export PGDATA=/var/lib/postgresql/14/pgdata" >>$ROOT_HOME/.bashrc
echo "export PGUSER=postgres" >>$ROOT_HOME/.bashrc
echo "export PGHOST=\$PGDATA" >>$ROOT_HOME/.bashrc
echo "export PGPORT=1921" >>$ROOT_HOME/.bashrc
echo "export PGDATABASE=postgres" >>$ROOT_HOME/.bashrc
echo "export LC_ALL=en_US.UTF-8" >>$ROOT_HOME/.bashrc
echo "export PATH=/tmp/cmake-3.27.9/bin:\$PATH" >>$ROOT_HOME/.bashrc
echo "export MANPATH=/tmp/cmake-3.27.9/man:\$MANPATH" >>$ROOT_HOME/.bashrc
. $ROOT_HOME/.bashrc
export PG_HOME=/var/lib/postgresql
echo "# add by digoal" >>$PG_HOME/.bash_profile
echo "alias rm='rm -i'" >>$PG_HOME/.bash_profile
echo "alias cp='cp -i'" >>$PG_HOME/.bash_profile
echo "alias ll='ls -larth'" >>$PG_HOME/.bash_profile
echo "alias mv='mv -i'" >>$PG_HOME/.bash_profile
echo "export PGHOME=/usr/lib/postgresql/14" >>$PG_HOME/.bash_profile
echo "export PATH=\$PGHOME/bin:\$PATH" >>$PG_HOME/.bash_profile
echo "export LD_LIBRARY_PATH=\$PGHOME/lib:/usr/local/lib:/usr/lib/aarch64-linux-gnu:\$LD_LIBRARY_PATH" >>$PG_HOME/.bash_profile
echo "export PGDATA=/var/lib/postgresql/14/pgdata" >>$PG_HOME/.bash_profile
echo "export PGUSER=postgres" >>$PG_HOME/.bash_profile
echo "export PGHOST=\$PGDATA" >>$PG_HOME/.bash_profile
echo "export PGPORT=1921" >>$PG_HOME/.bash_profile
echo "export PGDATABASE=postgres" >>$PG_HOME/.bash_profile
echo "export LC_ALL=en_US.UTF-8" >>$PG_HOME/.bash_profile
echo "export PATH=/tmp/cmake-3.27.9/bin:\$PATH" >>$PG_HOME/.bash_profile
echo "export MANPATH=/tmp/cmake-3.27.9/man:\$MANPATH" >>$PG_HOME/.bash_profile
echo ". ~/.bash_profile" > $PG_HOME/.profile
chown postgres:postgres $PG_HOME/.bash_profile
chown postgres:postgres $PG_HOME/.profile
vi 3.sh
#!/bin/bash
set -vx
export ROOT_HOME=/root
. $ROOT_HOME/.bashrc
export TEMP_DIR=/tmp
cd $TEMP_DIR
git clone --depth 1 https://github.com/jaiminpan/pg_jieba
cd $TEMP_DIR/pg_jieba
git submodule update --init --recursive --depth 1
mkdir build
cd $TEMP_DIR/pg_jieba/build
cmake -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/14/server ..
make && make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/ChenHuajun/pg_roaringbitmap
cd $TEMP_DIR/pg_roaringbitmap
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/theirix/parray_gin
cd $TEMP_DIR/parray_gin
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/jirutka/smlar
cd $TEMP_DIR/smlar
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/alitrack/duckdb_fdw
# 14版本 bug fix 之前
# git clone https://github.com/alitrack/duckdb_fdw
cd $TEMP_DIR/duckdb_fdw
# git checkout 87c66cf04243c7bc43e0e75d0b8ce5dd76d81cd5
# wget -T 36000 -t 0 --waitretry=5 https://github.com/duckdb/duckdb/releases/download/v0.9.2/libduckdb-linux-aarch64.zip
# curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/duckdb/duckdb/releases/download/v0.9.2/libduckdb-linux-aarch64.zip -o libduckdb-linux-aarch64.zip
# cp $TEMP_DIR/libduckdb-linux-aarch64.zip $TEMP_DIR/duckdb_fdw/
# unzip -n -d . libduckdb-linux-aarch64.zip
# cp libduckdb.so $(pg_config --libdir)
# USE_PGXS=1 make
# USE_PGXS=1 make install
mkdir /tmp/duckdb_fdw/libduckdb
mv /tmp/libduckdb-src.zip /tmp/duckdb_fdw/libduckdb/
cd /tmp/duckdb_fdw/libduckdb
unzip libduckdb-src.zip
unalias cp
cp -f duckdb.h ../
cp -f duckdb.hpp ../
# 编译 libduckdb.so 可能比较费内存, 建设调大docker 内存限制到8GB以上
# 编译参数需要 -std=c++11 与 duckdb_fdw src Makefile 一致
clang++ -c -fPIC -std=c++11 duckdb.cpp -o duckdb.o
clang++ -shared -o libduckdb.so *.o
cp -f libduckdb.so $(pg_config --libdir)
cp -f libduckdb.so /tmp/duckdb_fdw/
cd /tmp/duckdb_fdw
USE_PGXS=1 make uninstall
USE_PGXS=1 make clean
USE_PGXS=1 make distclean
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/EnterpriseDB/hdfs_fdw
cd $TEMP_DIR/hdfs_fdw/libhive
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64 JDK_INCLUDE=$JAVA_HOME/include INSTALL_DIR=/usr/lib/postgresql/14/lib PATH=/usr/lib/postgresql/14/bin:$PATH make
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64 JDK_INCLUDE=$JAVA_HOME/include INSTALL_DIR=/usr/lib/postgresql/14/lib PATH=/usr/lib/postgresql/14/bin:$PATH make install
cd $TEMP_DIR/hdfs_fdw/libhive/jdbc
javac MsgBuf.java
javac HiveJdbcClient.java
jar cf HiveJdbcClient-1.0.jar *.class
cp HiveJdbcClient-1.0.jar /usr/lib/postgresql/14/lib
cd $TEMP_DIR/hdfs_fdw
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64 JDK_INCLUDE=$JAVA_HOME/include INSTALL_DIR=/usr/lib/postgresql/14/lib PATH=/usr/lib/postgresql/14/bin:$PATH USE_PGXS=1 make
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64 JDK_INCLUDE=$JAVA_HOME/include INSTALL_DIR=/usr/lib/postgresql/14/lib PATH=/usr/lib/postgresql/14/bin:$PATH USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 --branch stable https://github.com/jedisct1/libsodium
cd $TEMP_DIR/libsodium
./configure
make
make check
make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/michelp/pgsodium
cd $TEMP_DIR/pgsodium
C_INCLUDE_PATH=/usr/include/postgresql/14/server PG_LDFLAGS=-L/usr/lib/postgresql/14/lib USE_PGXS=1 make
C_INCLUDE_PATH=/usr/include/postgresql/14/server PG_LDFLAGS=-L/usr/lib/postgresql/14/lib USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://github.com/libgd/libgd/archive/refs/tags/gd-2.3.3.tar.gz
tar -zxvf gd-2.3.3.tar.gz
cd $TEMP_DIR/libgd-gd-2.3.3
mkdir build
cd $TEMP_DIR/libgd-gd-2.3.3/build
cmake ..
make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/digoal/imgsmlr
# git clone --depth 1 https://github.com/postgrespro/imgsmlr
cd $TEMP_DIR/imgsmlr
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/postgrespro/vops
cd $TEMP_DIR/vops
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b PG14 https://github.com/ossc-db/pg_hint_plan
cd $TEMP_DIR/pg_hint_plan
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
apt-get install -y libselinux1-dev libpam0g-dev libkrb5-dev liblz4-dev
git clone --depth 1 https://github.com/ossc-db/pg_bulkload
cd $TEMP_DIR/pg_bulkload
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b 1.6.1 https://github.com/ossc-db/pg_store_plans
cd $TEMP_DIR/pg_store_plans
USE_PGXS=1 make
USE_PGXS=1 make install
# cd $TEMP_DIR
# git clone --depth 1 -b REL-5_5_1 https://github.com/EnterpriseDB/mongo_fdw
# cd $TEMP_DIR/mongo_fdw
# ./autogen.sh --with-master
# apt-get install -y libmongoc-dev
# # C_INCLUDE_PATH="/include/libmongoc-1.0/mongoc:/include/libbson-1.0" USE_PGXS=1 make
# # C_INCLUDE_PATH="/include/libmongoc-1.0/mongoc:/include/libbson-1.0" USE_PGXS=1 make install
# USE_PGXS=1 make
# USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b REL-5_5_1 https://github.com/EnterpriseDB/mongo_fdw
cd $TEMP_DIR/mongo_fdw
cp $TEMP_DIR/mongo-c-driver-1.17.3.tar.gz ./
tar -xzvf mongo-c-driver-1.17.3.tar.gz
rm -rf mongo-c-driver
mv mongo-c-driver-1.17.3 mongo-c-driver
cd $TEMP_DIR/mongo_fdw/mongo-c-driver
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_SSL=AUTO .
make install
cd $TEMP_DIR/mongo_fdw
cp $TEMP_DIR/json-c-0.15-20200726.tar.gz ./
tar -xzvf json-c-0.15-20200726.tar.gz
rm -rf json-c
mv json-c-json-c-0.15-20200726 json-c
cd $TEMP_DIR/mongo_fdw/json-c
cmake .
make -j 2
make install
apt-get install -y libmongoc-dev
cd $TEMP_DIR/mongo_fdw
echo "#ifdef __CONFIG__" >> config.h
echo "#define META_DRIVER" >> config.h
echo "#endif" >> config.h
export PKG_CONFIG_PATH=mongo-c-driver/src/libmongoc/src:mongo-c-driver/src/libbson/src
mv Makefile Makefile.origin
cp Makefile.meta Makefile
# C_INCLUDE_PATH="/include/libmongoc-1.0/mongoc:/include/libbson-1.0" USE_PGXS=1 make
# C_INCLUDE_PATH="/include/libmongoc-1.0/mongoc:/include/libbson-1.0" USE_PGXS=1 make install
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/neondatabase/neon
cd $TEMP_DIR/neon/pgxn/hnsw
USE_PGXS=1 make
USE_PGXS=1 make install
# cd $TEMP_DIR
# curl https://install.citusdata.com/community/deb.sh > add-citus-repo.sh
# bash add-citus-repo.sh
# apt-get install -y postgresql-14-citus-12
# Unfortunately, the Citus repository does not contain packages for non-x86_64 architectures.
apt-get install -y libzstd-dev libxslt1-dev libxml2-dev libcurl-ocaml-dev
cd $TEMP_DIR
git clone --depth 1 https://github.com/citusdata/citus
cd $TEMP_DIR/citus
./autogen.sh
./configure
make -j8
make install
cd $TEMP_DIR
apt-get install -y libboost-all-dev
# wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/datasketches/1.7.0/datasketches-1.7.0.zip
unzip datasketches-1.7.0.zip
cd $TEMP_DIR/datasketches-1.7.0
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
# get GraphBLAS, compile with debug symbols
# curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L http://faculty.cse.tamu.edu/davis/GraphBLAS/GraphBLAS-3.1.1.tar.gz -o GraphBLAS-3.1.1.tar.gz
tar -zxvf GraphBLAS-3.1.1.tar.gz
cd GraphBLAS-3.1.1
make library CMAKE_OPTIONS='-DCMAKE_BUILD_TYPE=Debug'
make install
cd $TEMP_DIR
git clone --depth 1 --branch 22July2019 https://github.com/GraphBLAS/LAGraph.git && cd LAGraph && make -j4 library && make install
# cd $TEMP_DIR
# curl --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -s -L https://github.com/theory/pgtap/archive/v0.99.0.tar.gz | tar zxvf - && cd pgtap-0.99.0 && make -j4 && make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/michelp/pggraphblas
cd $TEMP_DIR/pggraphblas
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b REL1_2_STABLE https://github.com/pgbigm/pg_bigm
cd $TEMP_DIR/pg_bigm
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/percona/pg_stat_monitor
cd $TEMP_DIR/pg_stat_monitor
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/neondatabase/pg_embedding
cd $TEMP_DIR/pg_embedding
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/cybertec-postgresql/pgfaceting
cd $TEMP_DIR/pgfaceting
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/pgexperts/pg_plan_filter
cd $TEMP_DIR/pg_plan_filter
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/postgrespro/pg_variables
cd $TEMP_DIR/pg_variables
USE_PGXS=1 make install
cd $TEMP_DIR
apt-get install -y libcurl-ocaml-dev
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/pg_curl/2.2.2/pg_curl-2.2.2.zip
unzip pg_curl-2.2.2.zip
cd $TEMP_DIR/pg_curl-2.2.2
USE_PGXS=1 make install
cd $TEMP_DIR
apt-get install -y systemtap-sdt-dev
mkdir -p /usr/lib/postgresql/14/lib
mkdir -p /usr/lib/postgresql/14/lib/bitcode
mkdir -p /usr/share/postgresql/14/extension
mv pg_task.so /usr/lib/postgresql/14/lib/
mv pg_task.index.bc /usr/lib/postgresql/14/lib/bitcode/
mv pg_task /usr/lib/postgresql/14/lib/bitcode/
mv pg_task.control /usr/share/postgresql/14/extension/
mv pg_task--1.0.sql /usr/share/postgresql/14/extension/
cd $TEMP_DIR
git clone --depth 1 -b extension https://github.com/RekGRpth/pg_task
# OR
# git clone --depth 1 -b extension https://github.com/RekGRpth/pg_task
# cd $TEMP_DIR/pg_task
# USE_PGXS=1 make install
# OR
# wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/pg_task/2.0.41/pg_task-2.0.41.zip
# unzip pg_task-2.0.41.zip
# cd $TEMP_DIR/pg_task-2.0.41
# USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/temporal_tables/1.2.2/temporal_tables-1.2.2.zip
unzip temporal_tables-1.2.2.zip
cd $TEMP_DIR/temporal_tables-1.2.2
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b v3.1 https://github.com/darold/pgtt
cd $TEMP_DIR/pgtt
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/pg_query_rewrite/0.0.5/pg_query_rewrite-0.0.5.zip
unzip pg_query_rewrite-0.0.5.zip
cd $TEMP_DIR/pg_query_rewrite-0.0.5
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/pg_track_settings/2.1.2/pg_track_settings-2.1.2.zip
unzip pg_track_settings-2.1.2.zip
cd $TEMP_DIR/pg_track_settings-2.1.2
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/aggs_for_vecs/1.3.0/aggs_for_vecs-1.3.0.zip
unzip aggs_for_vecs-1.3.0.zip
cd $TEMP_DIR/aggs_for_vecs-1.3.0
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/quantile/1.1.7/quantile-1.1.7.zip
unzip quantile-1.1.7.zip
cd $TEMP_DIR/quantile-1.1.7
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/pg_utility_trigger_functions/1.9.1/pg_utility_trigger_functions-1.9.1.zip
unzip pg_utility_trigger_functions-1.9.1.zip
cd $TEMP_DIR/pg_utility_trigger_functions-1.9.1
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/pg_safer_settings/0.8.10/pg_safer_settings-0.8.10.zip
unzip pg_safer_settings-0.8.10.zip
cd $TEMP_DIR/pg_safer_settings-0.8.10
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/ddlx/0.27.0/ddlx-0.27.0.zip
unzip ddlx-0.27.0.zip
cd $TEMP_DIR/ddlx-0.27.0
USE_PGXS=1 make install
cd $TEMP_DIR
wget -T 36000 -t 0 --waitretry=5 https://api.pgxn.org/dist/pgtelemetry/1.6.0/pgtelemetry-1.6.0.zip
unzip pgtelemetry-1.6.0.zip
cd $TEMP_DIR/pgtelemetry-1.6.0
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b REL14_0 https://github.com/ossc-db/pg_dbms_stats
cd $TEMP_DIR/pg_dbms_stats
USE_PGXS=1 make install
cd $TEMP_DIR
apt-get install -y libzlcore-dev
git clone --depth 1 -b REL_14_STABLE https://github.com/ossc-db/pg_rman
cd $TEMP_DIR/pg_rman
make install
# http://sigaev.ru/ 和 http://www.sigaev.ru/git/gitweb.cgi 需要开网络授权, 否则无法访问导致build image报错.
cd $TEMP_DIR
git clone --depth 1 git://sigaev.ru/online_analyze
cd $TEMP_DIR/online_analyze/
USE_PGXS=1 make
USE_PGXS=1 make install
# http://sigaev.ru/ 和 http://www.sigaev.ru/git/gitweb.cgi 需要开网络授权, 否则无法访问导致build image报错.
cd $TEMP_DIR
git clone --depth 1 git://sigaev.ru/plantuner
cd $TEMP_DIR/plantuner/
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/digoal/gevel
cd $TEMP_DIR/gevel
. ./install.sh
cd $TEMP_DIR
git clone --depth 1 -b 4.6 https://github.com/zubkov-andrei/pg_profile
cd $TEMP_DIR/pg_profile
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
# git clone --depth 1 https://github.com/s-hironobu/pg_plan_inspector
# cd $TEMP_DIR/pg_plan_inspector
# bug 修复之前 : https://github.com/s-hironobu/pg_plan_inspector/issues/1
git clone https://github.com/s-hironobu/pg_plan_inspector
cd $TEMP_DIR/pg_plan_inspector
git checkout fa845045ed5a776779f2d5308608ac18ed045aad
USE_PGXS=1 make
USE_PGXS=1 make install
# apt-get install -y libhealpix-cxx-dev
# cd $TEMP_DIR
# git clone --depth 1 -b 1.2.3 https://github.com/postgrespro/pgsphere
# cd $TEMP_DIR/pgsphere
# USE_PGXS=1 make
# USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/sraoss/pg_ivm
cd $TEMP_DIR/pg_ivm
USE_PGXS=1 make
USE_PGXS=1 make install
# cd $TEMP_DIR
# git clone --depth 1 https://github.com/pgvector/pgvector
# cd $TEMP_DIR/pgvector
# USE_PGXS=1 make
# USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth=1 https://github.com/vyruss/pg_statviz.git
cd $TEMP_DIR/pg_statviz
USE_PGXS=1 make install
apt-get install -y python3-pip
pip install pg_statviz
cd $TEMP_DIR
## curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/Kitware/CMake/releases/download/v3.27.4/cmake-3.27.4.tar.gz -o cmake-3.27.4.tar.gz
# tar -zxvf cmake-3.27.4.tar.gz
# cd $TEMP_DIR/cmake-3.27.4
# env CC=clang CXX=clang++ ./bootstrap -- -DCMAKE_BUILD_TYPE:STRING=Release
# make -j8
# make install
tar -zxvf cmake-3.27.9-linux-aarch64.tar.gz
mv cmake-3.27.9-linux-aarch64 cmake-3.27.9
cd $TEMP_DIR
git clone --depth 1 https://github.com/zachasme/h3-pg
cd $TEMP_DIR/h3-pg
USE_PGXS=1 make all
USE_PGXS=1 make install
cd $TEMP_DIR
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o ./rust.sh
chmod 500 rust.sh
./rust.sh -y
source "$HOME/.cargo/env"
cd $TEMP_DIR
git clone --depth 1 -b 1.3.2 https://gitlab.com/dalibo/postgresql_anonymizer.git
cd $TEMP_DIR/postgresql_anonymizer
make extension
make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/postgresml/pgcat
cd $TEMP_DIR/pgcat
cargo build --release
cd $TEMP_DIR
git clone --depth 1 https://github.com/chimpler/postgres-aws-s3
cd $TEMP_DIR/postgres-aws-s3
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b PG14 https://github.com/apache/age
cd $TEMP_DIR/age
USE_PGXS=1 make
USE_PGXS=1 make install
apt-get install -y npm
# cd $TEMP_DIR
# tar -zxvf node-v14.21.3.tar.gz
# cd node-v14.21.3
# ./configure
# CC=clang CXX=clang++ make -j 4
# CC=clang CXX=clang++ make install
npm config set registry https://registry.npmmirror.com
npm config set fetch-retries 100
npm config set fetch-retry-mintimeout 120000
npm config set fetch-retry-maxtimeout 60000000
npm config set cache-min 3600
npm i pm2
cd $TEMP_DIR
git clone --depth 1 https://github.com/apache/age-viewer
cd $TEMP_DIR/age-viewer
npm run setup
cd $TEMP_DIR
git clone --depth 1 https://github.com/michelp/pgjwt
cd $TEMP_DIR/pgjwt
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/supabase/pg_net
cd $TEMP_DIR/pg_net
USE_PGXS=1 make install
# bug : ERROR: extension "pg_net" has no installation script nor update path for version "0.7.3"
# cd $TEMP_DIR/pg_net/sql
# cp -f -n ./pg_net.sql ./pg_net--0.7.3.sql /usr/share/postgresql/14/extension/
cd $TEMP_DIR
wget -q -O - http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2 | tar jxf -
cd $TEMP_DIR/scws-1.2.3
./configure
make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/amutu/zhparser.git
cd $TEMP_DIR/zhparser
PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config make && make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/pramsey/pgsql-http
cd $TEMP_DIR/pgsql-http
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/pgsentinel/pgsentinel
cd $TEMP_DIR/pgsentinel/src
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/postgrespro/zson
cd $TEMP_DIR/zson
USE_PGXS=1 make install
cd $TEMP_DIR
cp pg_tiktoken--0.0.1.sql /usr/share/postgresql/14/extension/
cp pg_tiktoken.control /usr/share/postgresql/14/extension/
cp pg_tiktoken.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
git clone --depth 1 --recursive https://github.com/lanterndata/lantern.git
cd $TEMP_DIR/lantern
mkdir build
cd $TEMP_DIR/lantern/build
cmake ..
make install
cd $TEMP_DIR
cp lantern_extras--0.1.5.sql /usr/share/postgresql/14/extension/
cp lantern_extras.control /usr/share/postgresql/14/extension/
cp lantern_extras.so /usr/lib/postgresql/14/lib/
cp lantern-cli /var/lib/postgresql/
chown postgres:postgres /var/lib/postgresql/lantern-cli
cd $TEMP_DIR
git clone --depth 1 -b v1.1.2 https://github.com/hydradatabase/hydra
cd $TEMP_DIR/hydra/columnar
./configure
USE_PGXS=1 make install
cd $TEMP_DIR
mkdir -p /usr/local/onnxruntime
tar vzxf onnxruntime-linux-aarch64-1.15.1.tgz -C /usr/local/onnxruntime --strip-components=1
echo "/usr/local/onnxruntime/lib" > /etc/ld.so.conf.d/onnxruntime.conf
ldconfig
cd $TEMP_DIR
git clone --depth 1 https://github.com/kibae/onnxruntime-server
cd $TEMP_DIR/onnxruntime-server
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel 4
cmake --install build --prefix /usr/local/onnxruntime-server
cd $TEMP_DIR
git clone --depth 1 -b v1.15.1 https://github.com/microsoft/onnxruntime
cp /tmp/onnxruntime/include/onnxruntime/core/session/* /usr/local/onnxruntime/
cd $TEMP_DIR
git clone --depth 1 --recursive https://github.com/kibae/pg_onnx.git
cd $TEMP_DIR/pg_onnx
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build --target pg_onnx --parallel 4
cmake --install build/pg_onnx
cd $TEMP_DIR
# curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
# apt-get install -y git-lfs
for ((i=1;i>=0;i=1))
do
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
if [ $? -eq 0 ]; then
break
fi
done
for ((i=1;i>=0;i=1))
do
apt-get install -y git-lfs
if [ $? -eq 0 ]; then
break
fi
done
cd $TEMP_DIR
GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 https://github.com/onnx/models
cd $TEMP_DIR/models
git lfs install
cd $TEMP_DIR
git clone --depth 1 https://github.com/fboulnois/pg_uuidv7
cd $TEMP_DIR/pg_uuidv7
USE_PGXS=1 make install
# apt-get install -y libcurl4-openssl-dev uuid-dev libpulse-dev
# cd $TEMP_DIR
# # git clone --depth 1 -b apache-arrow-12.0.1 https://github.com/apache/arrow.git
# git clone --depth 1 -b apache-arrow-14.0.2 https://github.com/apache/arrow.git
# cd $TEMP_DIR/arrow/cpp
# mkdir build-release
# cd $TEMP_DIR/arrow/cpp/build-release
#
# # build选项: https://arrow.apache.org/docs/developers/cpp/building.html
# for ((i=1;i>=0;i=1))
# do
# # cmake -DARROW_DEPENDENCY_SOURCE=BUNDLED -DARROW_PARQUET=ON -DARROW_ORC=ON -DARROW_S3=ON -DARROW_WITH_LZ4=ON -DARROW_WITH_SNAPPY=ON -DARROW_WITH_ZLIB=ON -DARROW_WITH_ZSTD=ON -DPARQUET_REQUIRE_ENCRYPTION=ON ..
# cmake -DARROW_DEPENDENCY_SOURCE=BUNDLED -DARROW_PARQUET=ON ..
# if [ $? -eq 0 ]; then
# break
# fi
# done
#
# for ((i=1;i>=0;i=1))
# do
# make -j4
# if [ $? -eq 0 ]; then
# break
# fi
# done
#
# make install
# ldconfig
# https://arrow.apache.org/install/
cd $TEMP_DIR
apt-get install -y libcurl4-openssl-dev uuid-dev libpulse-dev
for ((i=1;i>=0;i=1))
do
apt-get update
if [ $? -eq 0 ]; then
break
fi
done
apt-get install -y -V ca-certificates lsb-release
for ((i=1;i>=0;i=1))
do
wget -T 36000 -t 0 --waitretry=5 https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
if [ $? -eq 0 ]; then
break
fi
done
apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
for ((i=1;i>=0;i=1))
do
apt-get update
if [ $? -eq 0 ]; then
break
fi
done
apt-get install -y -V libarrow-dev # For C++
apt-get install -y -V libarrow-glib-dev # For GLib (C)
apt-get install -y -V libarrow-dataset-dev # For Apache Arrow Dataset C++
apt-get install -y -V libarrow-dataset-glib-dev # For Apache Arrow Dataset GLib (C)
apt-get install -y -V libarrow-acero-dev # For Apache Arrow Acero
apt-get install -y -V libarrow-flight-dev # For Apache Arrow Flight C++
apt-get install -y -V libarrow-flight-glib-dev # For Apache Arrow Flight GLib (C)
apt-get install -y -V libarrow-flight-sql-dev # For Apache Arrow Flight SQL C++
apt-get install -y -V libarrow-flight-sql-glib-dev # For Apache Arrow Flight SQL GLib (C)
apt-get install -y -V libgandiva-dev # For Gandiva C++
apt-get install -y -V libgandiva-glib-dev # For Gandiva GLib (C)
apt-get install -y -V libparquet-dev # For Apache Parquet C++
apt-get install -y -V libparquet-glib-dev # For Apache Parquet GLib (C)
cd $TEMP_DIR
git clone --depth 1 https://github.com/adjust/parquet_fdw
cd $TEMP_DIR/parquet_fdw
# 这个bug 解决之前 (这个clang flag不支持arm平台)
# clang: error: unknown argument: '-moutline-atomics'
/usr/bin/clang-11 -xc++ -Wno-ignored-attributes -Wno-register -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -emit-llvm -c -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -std=c++17 -O3 -fPIC -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -o src/common.bc src/common.cpp
/usr/bin/clang-11 -xc++ -Wno-ignored-attributes -Wno-register -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -emit-llvm -c -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -std=c++17 -O3 -fPIC -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -o src/reader.bc src/reader.cpp
/usr/bin/clang-11 -xc++ -Wno-ignored-attributes -Wno-register -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -emit-llvm -c -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -std=c++17 -O3 -fPIC -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -o src/exec_state.bc src/exec_state.cpp
/usr/bin/clang-11 -xc++ -Wno-ignored-attributes -Wno-register -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -emit-llvm -c -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -std=c++17 -O3 -fPIC -I. -I./ -I/usr/include/postgresql/14/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -o src/parquet_impl.bc src/parquet_impl.cpp
make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/pgspider/sqlite_fdw
cd $TEMP_DIR/sqlite_fdw
USE_PGXS=1 make
USE_PGXS=1 make install
cd $TEMP_DIR
cp pg_search--0.8.4.sql /usr/share/postgresql/14/extension/
cp pg_search.control /usr/share/postgresql/14/extension/
cp pg_search.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
cp pg_lakehouse--0.8.4.sql /usr/share/postgresql/14/extension/
cp pg_lakehouse.control /usr/share/postgresql/14/extension/
cp pg_lakehouse.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
cp pg_analytics--0.6.2.sql /usr/share/postgresql/14/extension/
cp pg_analytics.control /usr/share/postgresql/14/extension/
cp pg_analytics.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
git clone --depth 1 -b 14.3 https://github.com/ossc-db/pg_statsinfo
cd $TEMP_DIR/pg_statsinfo
PG_LDFLAGS=-L/usr/lib/postgresql/14/lib make
PG_LDFLAGS=-L/usr/lib/postgresql/14/lib make install
cd /usr/lib/postgresql/14
git clone --depth 1 -b 14.0 https://github.com/ossc-db/pg_stats_reporter
cd $TEMP_DIR/
git clone --depth 1 https://gitlab.com/pg_proctab/pg_proctab
cd $TEMP_DIR/pg_proctab
USE_PGXS=1 make install
apt-get install -y libelf-dev
cd $TEMP_DIR/
git clone --depth 1 https://gitlab.com/pg_top/pg_top
cd $TEMP_DIR/pg_top
cmake CMakeLists.txt
USE_PGXS=1 make install
cd $TEMP_DIR/
wget https://golang.org/dl/go1.17.linux-arm64.tar.gz
tar -zxvf go1.17.linux-arm64.tar.gz -C /usr/local/
export PATH=/usr/local/go/bin:${PATH}
echo "export PATH=/usr/local/go/bin:\$PATH" >>/root/.bashrc
echo "export PATH=/usr/local/go/bin:\$PATH" >>/var/lib/postgresql/.bash_profile
cd $TEMP_DIR/
git clone -b v0.9.2 --depth 1 https://github.com/lesovsky/pgcenter
cd $TEMP_DIR/pgcenter
make dep
make build
make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/petere/pguint
cd $TEMP_DIR/pguint
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b v0.6.1 https://github.com/paradedb/paradedb
cd $TEMP_DIR/paradedb/pg_sparse
USE_PGXS=1 make install
chmod 644 ./sql/svector--0.6.1.sql
cp -n ./sql/svector--0.6.1.sql /usr/share/postgresql/14/extension/
cd $TEMP_DIR
git clone --depth 1 https://github.com/bdrouvot/pg_subtrans_infos
cd $TEMP_DIR/pg_subtrans_infos
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/bdrouvot/pg_subxact_counters
cd $TEMP_DIR/pg_subxact_counters/c
USE_PGXS=1 make install
cd $TEMP_DIR
cp pg_idkit--0.2.1.sql /usr/share/postgresql/14/extension/
cp pg_idkit.control /usr/share/postgresql/14/extension/
cp pg_idkit.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
apt-get install -y build-essential libproj-dev libjson-c-dev libgsl-dev libgeos-dev
git clone --depth 1 https://github.com/MobilityDB/MobilityDB
cd $TEMP_DIR/MobilityDB
mkdir build
cd $TEMP_DIR/MobilityDB/build
cmake ..
make -j 4
make install
cd $TEMP_DIR
cp pgdd--0.5.2.sql /usr/share/postgresql/14/extension/
cp pgdd.control /usr/share/postgresql/14/extension/
cp pgdd.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
git clone --depth 1 https://github.com/PGer/pipelinedb_pg14.git
cd $TEMP_DIR/pipelinedb_pg14
apt-get install -y libczmq4 libczmq-dev
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/jaiminpan/pg_nanoid.git
cd $TEMP_DIR/pg_nanoid
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/andrielfn/pg-ulid.git
cd $TEMP_DIR/pg-ulid
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/phillbaker/pg_migrate.git
cd $TEMP_DIR/pg_migrate/
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/df7cb/pg_filedump.git
cd $TEMP_DIR/pg_filedump/
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/petere/pgpcre
cd $TEMP_DIR/pgpcre
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://github.com/omniti-labs/pg_jobmon
cd $TEMP_DIR/pg_jobmon
USE_PGXS=1 make install
# cd $TEMP_DIR
# git clone --depth 1 https://github.com/pgpartman/pg_partman
# cd $TEMP_DIR/pg_partman
# USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 https://gitee.com/seanguo_007/plpgsql_pg4ml.git
cd $TEMP_DIR/plpgsql_pg4ml
. $TEMP_DIR/plpgsql_pg4ml/gen_sql_files.sh
USE_PGXS=1 make install
cd $TEMP_DIR
cp pgmq--1.1.1.sql /usr/share/postgresql/14/extension/
cp pgmq.control /usr/share/postgresql/14/extension/
cp pgmq.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
cp pg_later--0.0.14.sql /usr/share/postgresql/14/extension/
cp pg_later.control /usr/share/postgresql/14/extension/
cp pg_later.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
cp vectorize--0.15.0.sql /usr/share/postgresql/14/extension/
cp vectorize.control /usr/share/postgresql/14/extension/
cp vectorize.so /usr/lib/postgresql/14/lib/
cd $TEMP_DIR
git clone --depth 1 -b v2.0 https://github.com/pgEdge/snowflake
cd $TEMP_DIR/snowflake
USE_PGXS=1 make install
cd $TEMP_DIR
git clone --depth 1 -b walminer_3.0_stable https://gitee.com/movead/XLogMiner
cd $TEMP_DIR/XLogMiner/walminer/
USE_PGXS=1 MAJORVERSION=14 make install
# https://github.com/pgspider/influxdb_fdw
# InfluxDB Foreign Data Wrapper for PostgreSQL.
cd /tmp
git clone --depth 1 https://github.com/pgspider/influxdb_fdw
cd /tmp/influxdb_fdw
go get github.com/influxdata/influxdb1-client/v2
git clone --depth 1 https://github.com/pgspider/influxdb-cxx
cd /tmp/influxdb_fdw/influxdb-cxx
cmake . -DINFLUXCXX_WITH_BOOST=OFF -DINFLUXCXX_TESTING=OFF
make install
cd /tmp/influxdb_fdw
make CC=gcc CXX=g++ USE_PGXS=1 with_llvm=no GO_CLIENT=1 CXX_CLIENT=1
make install CC=gcc CXX=g++ USE_PGXS=1 with_llvm=no GO_CLIENT=1 CXX_CLIENT=1
# https://github.com/HexaCluster/pg_dbms_metadata
# pg_dbms_metadata v1.0.0 - Oracle's DBMS_METADATA Compatibility for PostgreSQL DDL Extraction
cd /tmp
git clone --depth 1 https://github.com/HexaCluster/pg_dbms_metadata
cd /tmp/pg_dbms_metadata
make install USE_PGXS=1
# https://github.com/viggy28/pg_savior
# pg_savior is a PostgreSQL extension designed to prevent accidental data loss due to non-parameterized DELETE queries without a WHERE clause.
# before bugfix use digoal's fork
cd /tmp
git clone --depth 1 https://github.com/digoal/pg_savior
cd /tmp/pg_savior
make install USE_PGXS=1
# https://github.com/dimitri/pgcopydb
# https://pgcopydb.readthedocs.io/en/latest/
apt-get install -y libgc-dev
cd /tmp
git clone --depth 1 https://github.com/dimitri/pgcopydb
cd /tmp/pgcopydb
make -s clean
make -s -j4 install
cd /tmp
git clone --depth 1 https://github.com/supabase/supa_audit
cd /tmp/supa_audit
USE_PGXS=1 make install
## plv8/Makefile
## ifeq ($(UNAME_S),Linux)
## SHLIB_LINK += -lrt -std=c++17
#cd /tmp
## apt-get install -y libtinfo5 build-essential pkg-config
#git clone --depth 1 -b v3.2.2 https://github.com/plv8/plv8
#cd /tmp/plv8
#export SHLIB_LINK = " -lrt -std=c++17 "
#EXECUTION_TIMEOUT=1 USE_ICU=1 USE_PGXS=1 PG_CONFIG=$(which pg_config) make
#EXECUTION_TIMEOUT=1 USE_ICU=1 USE_PGXS=1 PG_CONFIG=$(which pg_config) make install
# 安装HaloDB,
groupadd -r -g 3000 halo
useradd -r -u 3000 -g halo -m -d /home/halo -s /bin/bash halo
cd /tmp
tar -zxvf halo_14.debian11.aarch64.tar.gz -C /home/halo/
echo "# add by digoal" >> /home/halo/.bashrc
echo "alias rm='rm -i'" >> /home/halo/.bashrc
echo "alias cp='cp -i'" >> /home/halo/.bashrc
echo "alias ll='ls -larth'" >> /home/halo/.bashrc
echo "alias mv='mv -i'" >> /home/halo/.bashrc
echo "export HALO_HOME=/home/halo/product/dbms/14" >> /home/halo/.bashrc
echo "export LD_LIBRARY_PATH=\$HALO_HOME/lib" >> /home/halo/.bashrc
echo "export PGDATA=/home/halo/halodata" >> /home/halo/.bashrc
echo "export PGHOST=\$PGDATA" >> /home/halo/.bashrc
echo "export PGUSER=postgres" >> /home/halo/.bashrc
echo "export PATH=\$HALO_HOME/bin:\$PATH" >> /home/halo/.bashrc
echo "export PGPORT=1521" >> /home/halo/.bashrc
# 初始化halodata
su - halo -c "mkdir /home/halo/halodata"
su - halo -c "chmod 700 /home/halo/halodata"
su - halo -c "/home/halo/product/dbms/14/bin/initdb -D /home/halo/halodata -E UTF8 --lc-collate=C --lc-ctype=en_US.utf-8 -U postgres"
cd /home/halo/halodata
echo "host all all 0.0.0.0/0 scram-sha-256" >> ./pg_hba.conf
echo "host replication all 0.0.0.0/0 scram-sha-256" >> ./pg_hba.conf
echo "standard_parserengine_auxiliary = on" >> ./postgresql.auto.conf
echo "database_compat_mode = 'oracle'" >> ./postgresql.auto.conf
echo "oracle.use_datetime_as_date = true" >> ./postgresql.auto.conf
echo "transform_null_equals = off" >> ./postgresql.auto.conf
echo "listen_addresses = '0.0.0.0'" >> ./postgresql.auto.conf
echo "port = 1521" >> ./postgresql.auto.conf
echo "max_connections = 2000" >> ./postgresql.auto.conf
echo "unix_socket_directories = '.'" >> ./postgresql.auto.conf
echo "shared_buffers = 128MB" >> ./postgresql.auto.conf
echo "dynamic_shared_memory_type = posix" >> ./postgresql.auto.conf
echo "vacuum_cost_delay = 0" >> ./postgresql.auto.conf
echo "bgwriter_delay = 20ms" >> ./postgresql.auto.conf
echo "bgwriter_lru_maxpages = 500" >> ./postgresql.auto.conf
echo "bgwriter_lru_multiplier = 5.0" >> ./postgresql.auto.conf
echo "max_parallel_workers_per_gather = 0" >> ./postgresql.auto.conf
echo "synchronous_commit = off" >> ./postgresql.auto.conf
echo "wal_compression = on" >> ./postgresql.auto.conf
echo "wal_writer_delay = 10ms" >> ./postgresql.auto.conf
echo "max_wal_size = 1GB " >> ./postgresql.auto.conf
echo "min_wal_size = 80MB " >> ./postgresql.auto.conf
echo "random_page_cost = 1.1" >> ./postgresql.auto.conf
echo "log_destination = 'csvlog'" >> ./postgresql.auto.conf
echo "logging_collector = on" >> ./postgresql.auto.conf
echo "log_truncate_on_rotation = on" >> ./postgresql.auto.conf
echo "log_timezone = 'Etc/UTC' " >> ./postgresql.auto.conf
echo "autovacuum = on" >> ./postgresql.auto.conf
echo "autovacuum_vacuum_cost_delay = 0ms" >> ./postgresql.auto.conf
echo "vacuum_freeze_table_age = 750000000 " >> ./postgresql.auto.conf
echo "vacuum_multixact_freeze_table_age = 750000000 " >> ./postgresql.auto.conf
echo "datestyle = 'iso, mdy' " >> ./postgresql.auto.conf
echo "timezone = 'Etc/UTC' " >> ./postgresql.auto.conf
echo "lc_messages = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "lc_monetary = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "lc_numeric = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "lc_time = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "default_text_search_config = 'pg_catalog.english'" >> ./postgresql.auto.conf
# 启动halo, 创建Oracle兼容性
# su - halo
# pg_ctl start
# psql -c "create extension aux_oracle cascade;"
# databend [在宇宙最强数据库镜像中部署databend](../202402/20240201_03.md)
groupadd -r -g 3001 databend
useradd -r -u 3001 -g databend -m -d /home/databend -s /bin/bash databend
mkdir -p /var/log/databend
mkdir -p /var/lib/databend/raft
chown -R databend:databend /var/log/databend
chown -R databend:databend /var/lib/databend
# su - databend -c "curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 --proto '=https' --tlsv1.2 -sSf -L https://sh.rustup.rs | sh -s -- -y"
# su - databend -c "source /home/databend/.cargo/env"
# echo "[source.crates-io]" >> /home/databend/.cargo/config
# echo "replace-with = 'ustc'" >> /home/databend/.cargo/config
# echo " " >> /home/databend/.cargo/config
# echo "[source.ustc]" >> /home/databend/.cargo/config
# echo "registry = \"sparse+https://mirrors.ustc.edu.cn/crates.io-index/\"" >> /home/databend/.cargo/config
echo "# add by digoal" >> /home/databend/.bashrc
echo "alias rm='rm -i'" >> /home/databend/.bashrc
echo "alias cp='cp -i'" >> /home/databend/.bashrc
echo "alias ll='ls -larth'" >> /home/databend/.bashrc
echo "alias mv='mv -i'" >> /home/databend/.bashrc
# echo ". /home/databend/.cargo/env" >> /home/databend/.bashrc
cd /tmp
# tar -zxvf databend-v1.2.307-aarch64-unknown-linux-gnu.tar.gz -C /home/databend/
mkdir -p /home/databend/databend_software
tar -zxvf databend-aarch64.tar.gz -C /home/databend/databend_software
tar -zxvf bendsql-aarch64-unknown-linux-gnu.tar.gz -C /usr/local/bin/
cd /home/databend/databend_software
echo " " >> ./configs/databend-query.toml
echo "[[query.users]]" >> ./configs/databend-query.toml
echo "name = \"root\"" >> ./configs/databend-query.toml
echo "auth_type = \"no_password\"" >> ./configs/databend-query.toml
chown -R databend:databend /home/databend/databend_software
cd /tmp
# su - databend -c "cargo install bendsql"
# 启动databend
# su - databend
# cd /home/databend/databend_software
# ./scripts/start.sh
# 连接databend
# su - databend
# bendsql
# 停止databend
# su - databend
# cd /home/databend/databend_software
# ./scripts/stop.sh
cd $TEMP_DIR
cp plrust--1.1.sql /usr/share/postgresql/14/extension/
cp plrust.control /usr/share/postgresql/14/extension/
cp plrust.so /usr/lib/postgresql/14/lib/
cd /tmp
git clone --depth 1 https://github.com/okbob/pgmeminfo
cd /tmp/pgmeminfo
USE_PGXS=1 make install
cd /tmp
git clone --depth 1 https://github.com/lzlabs/pg_statement_rollback
cd /tmp/pg_statement_rollback
USE_PGXS=1 make install
cd /tmp
git clone --depth 1 https://github.com/lzlabs/pg_dumpbinary
cd /tmp/pg_dumpbinary
perl Makefile.PL
make
make install
# PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::HandleConfig->edit("pushy_https", 0); CPAN::HandleConfig->edit("urllist", "unshift", "https://developer.aliyun.com/mirror/CPAN/"); mkmyconfig'
# for ((i=1;i>=0;i=1))
# do
# # cpan加速: https://developer.aliyun.com/mirror/CPAN/
# echo "yes"|cpan -i IPC::Run
# if [ $? -eq 0 ]; then
# break
# fi
# done
useradd -r -b /home/polardb -m -d /home/polardb -s /bin/bash polardb
apt-get install -y libldap2-dev libxerces-c-dev gettext tcl tcl-dev libperl-dev
rm -f /usr/bin/python
ln -s /usr/bin/python3 /usr/bin/python
cd /tmp
git clone -b POLARDB_11_STABLE --depth 1 https://github.com/ApsaraDB/PolarDB-for-PostgreSQL
cd PolarDB-for-PostgreSQL
# LLVM_CONFIG=/usr/bin/llvm-config-13 ./polardb_build.sh --withpx --noinit --basedir=/home/polardb/polardb_11_home
LLVM_CONFIG=/usr/bin/llvm-config-13 ./polardb_build.sh --withpx --noinit --basedir=/home/polardb/polardb_11_home --user=polardb --debug=off --with-tde
echo "# add by digoal " >> /home/polardb/.bashrc
echo "alias rm='rm -i' " >> /home/polardb/.bashrc
echo "alias cp='cp -i' " >> /home/polardb/.bashrc
echo "alias ll='ls -larth' " >> /home/polardb/.bashrc
echo "alias mv='mv -i' " >> /home/polardb/.bashrc
echo "export PGHOME=/home/polardb/polardb_11_home " >> /home/polardb/.bashrc
echo "export PATH=\$PGHOME/bin:\$PATH " >> /home/polardb/.bashrc
echo "export LD_LIBRARY_PATH=\$PGHOME/lib:/usr/local/lib:/usr/lib/aarch64-linux-gnu:\$LD_LIBRARY_PATH " >> /home/polardb/.bashrc
echo "export PGDATA=/home/polardb/primary " >> /home/polardb/.bashrc
echo "export PGUSER=polardb " >> /home/polardb/.bashrc
echo "export PGHOST=127.0.0.1 " >> /home/polardb/.bashrc
echo "export PGPORT=5432 " >> /home/polardb/.bashrc
echo "export PGDATABASE=postgres " >> /home/polardb/.bashrc
echo "export LC_ALL=en_US.UTF-8 " >> /home/polardb/.bashrc
su - polardb -c " /home/polardb/polardb_11_home/bin/initdb -D /home/polardb/primary "
# /home/polardb/polardb_11_home/bin/pg_ctl -D /home/polardb/primary -l logfile start
# /home/polardb/polardb_11_home/bin/psql -h 127.0.0.1 -p 5432 -U polardb postgres
echo "listen_addresses = '0.0.0.0' " >> /home/polardb/primary/postgresql.auto.conf
echo "unix_socket_directories = '., /tmp' " >> /home/polardb/primary/postgresql.auto.conf
echo "random_page_cost = 1.1 " >> /home/polardb/primary/postgresql.auto.conf
echo "log_destination = 'csvlog' " >> /home/polardb/primary/postgresql.auto.conf
echo "logging_collector = on " >> /home/polardb/primary/postgresql.auto.conf
echo "polar_enable_physical_repl_non_super_wal_snd = on " >> /home/polardb/primary/postgresql.auto.conf
echo "polar_wal_snd_reserved_for_superuser = 3 " >> /home/polardb/primary/postgresql.auto.conf
echo "polar_logindex_mem_size = 0 " >> /home/polardb/primary/postgresql.auto.conf
echo "hot_standby = on " >> /home/polardb/primary/postgresql.auto.conf
echo "wal_receiver_timeout = 15s " >> /home/polardb/primary/postgresql.auto.conf
echo "wal_retrieve_retry_interval = 5s " >> /home/polardb/primary/postgresql.auto.conf
echo "port = 5432 " >> /home/polardb/primary/postgresql.auto.conf
echo "polar_hostid = 1 " >> /home/polardb/primary/postgresql.auto.conf
echo "primary_conninfo = 'host=localhost port=5432 user=polardb dbname=postgres application_name=standby1' " >> /home/polardb/primary/recovery.done
echo "# primary_slot_name = 'standby1' " >> /home/polardb/primary/recovery.done
echo "standby_mode = on " >> /home/polardb/primary/recovery.done
echo "recovery_target_timeline = 'latest' " >> /home/polardb/primary/recovery.done
echo "host all all 0.0.0.0/0 md5 " >> /home/polardb/primary/pg_hba.conf
echo "host replication all 0.0.0.0/0 md5 " >> /home/polardb/primary/pg_hba.conf
cd /tmp
git clone --depth 1 https://github.com/tvondra/sequential-uuids
cd /tmp/sequential-uuids
USE_PGXS=1 make install
cd /tmp
git clone --depth 1 https://github.com/enova/pgl_ddl_deploy
cd /tmp/pgl_ddl_deploy
USE_PGXS=1 make install
cd /tmp
git clone --depth 1 https://github.com/enterprisedb/system_stats
cd /tmp/system_stats
USE_PGXS=1 make install
# install ivorysql
apt-get install -y libxml2-utils libossp-uuid-dev
# PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::HandleConfig->edit("pushy_https", 0); CPAN::HandleConfig->edit("urllist", "unshift", "https://developer.aliyun.com/mirror/CPAN/"); mkmyconfig'
# for ((i=1;i>=0;i=1))
# do
# # cpan加速: https://developer.aliyun.com/mirror/CPAN/
# echo "yes"|cpan -i IPC::Run
# if [ $? -eq 0 ]; then
# break
# fi
# done
useradd -r -b /home/ivorysql -m -d /home/ivorysql -s /bin/bash ivorysql
cd /tmp
git clone --depth 1 -b IvorySQL_3.2 https://github.com/IvorySQL/IvorySQL
cd IvorySQL
# LLVM_CONFIG=/usr/bin/llvm-config-13 CC=clang-13 CXX=clang++-13 CPP=clang-cpp-13 ./configure --prefix=/home/ivorysql/ivorysql --with-llvm --with-openssl --with-lz4 --with-zstd --with-ossp-uuid --with-libxml --with-libxslt --with-libedit-preferred --with-ldap --with-python --enable-tap-tests --with-pgport=5281 --with-oraport=1621
LLVM_CONFIG=/usr/bin/llvm-config-13 CC=clang-13 CXX=clang++-13 CPP=clang-cpp-13 ./configure --prefix=/home/ivorysql/ivorysql --with-llvm --with-openssl --with-lz4 --with-zstd --with-ossp-uuid --with-libxml --with-libxslt --with-libedit-preferred --with-ldap --with-python --with-pgport=5281 --with-oraport=1621
make -j4
make install
cd contrib
make install
echo "# add by digoal " >> /home/ivorysql/.bashrc
echo "alias rm='rm -i' " >> /home/ivorysql/.bashrc
echo "alias cp='cp -i' " >> /home/ivorysql/.bashrc
echo "alias ll='ls -larth' " >> /home/ivorysql/.bashrc
echo "alias mv='mv -i' " >> /home/ivorysql/.bashrc
echo "export PGHOME=/home/ivorysql/ivorysql " >> /home/ivorysql/.bashrc
echo "export PATH=\$PGHOME/bin:\$PATH " >> /home/ivorysql/.bashrc
echo "export LD_LIBRARY_PATH=\$PGHOME/lib:/usr/local/lib:/usr/lib/aarch64-linux-gnu:\$LD_LIBRARY_PATH " >> /home/ivorysql/.bashrc
echo "export PGDATA=/home/ivorysql/primary " >> /home/ivorysql/.bashrc
echo "export PGUSER=ivorysql " >> /home/ivorysql/.bashrc
echo "export PGHOST=127.0.0.1 " >> /home/ivorysql/.bashrc
echo "export PGPORT=5281 " >> /home/ivorysql/.bashrc
echo "export PGDATABASE=postgres " >> /home/ivorysql/.bashrc
echo "export LC_ALL=en_US.UTF-8 " >> /home/ivorysql/.bashrc
su - ivorysql -c " /home/ivorysql/ivorysql/bin/initdb -D /home/ivorysql/primary -U ivorysql -E UTF8 --locale-provider=icu --icu-locale=en_US --lc-collate=C --lc-ctype=en_US.UTF8 "
# /home/ivorysql/ivorysql/bin/pg_ctl -D /home/ivorysql/primary -l logfile start
# /home/ivorysql/ivorysql/bin/psql -h 127.0.0.1 -p 5281 -U ivorysql postgres
echo "listen_addresses = '0.0.0.0' " >> /home/ivorysql/primary/postgresql.auto.conf
echo "unix_socket_directories = '., /tmp' " >> /home/ivorysql/primary/postgresql.auto.conf
echo "random_page_cost = 1.1 " >> /home/ivorysql/primary/postgresql.auto.conf
echo "log_destination = 'csvlog' " >> /home/ivorysql/primary/postgresql.auto.conf
echo "logging_collector = on " >> /home/ivorysql/primary/postgresql.auto.conf
echo "hot_standby = on " >> /home/ivorysql/primary/postgresql.auto.conf
echo "wal_receiver_timeout = 15s " >> /home/ivorysql/primary/postgresql.auto.conf
echo "wal_retrieve_retry_interval = 5s " >> /home/ivorysql/primary/postgresql.auto.conf
echo "port = 5281 " >> /home/ivorysql/primary/postgresql.auto.conf
echo "primary_conninfo = 'host=localhost port=5281 user=ivorysql dbname=postgres application_name=standby1' " >> /home/ivorysql/primary/postgresql.auto.conf
echo "# primary_slot_name = 'standby1' " >> /home/ivorysql/primary/postgresql.auto.conf
echo "recovery_target_timeline = 'latest' " >> /home/ivorysql/primary/postgresql.auto.conf
echo "host all all 0.0.0.0/0 scram-sha-256 " >> /home/ivorysql/primary/pg_hba.conf
echo "host replication all 0.0.0.0/0 scram-sha-256 " >> /home/ivorysql/primary/pg_hba.conf
cd /tmp
git clone --depth 1 -b simd https://github.com/pjungwir/aggs_for_arrays
cd aggs_for_arrays
USE_PGXS=1 make install
pgxn install dsef
cd /tmp
git clone --depth 1 https://github.com/dverite/permuteseq
cd /tmp/permuteseq
USE_PGXS=1 make install
cd /tmp
git clone --depth 1 https://github.com/digoal/gp_tpch
git clone --depth 1 https://github.com/electrum/tpch-dbgen
cd $TEMP_DIR
cp pg_bestmatch--0.0.0.sql /usr/share/postgresql/14/extension/
cp pg_bestmatch.control /usr/share/postgresql/14/extension/
cp pg_bestmatch.so /usr/lib/postgresql/14/lib/
cd /tmp
git clone --depth 1 https://github.com/bdrouvot/pg_orphaned
cd pg_orphaned
USE_PGXS=1 make install
cd /usr/lib/postgresql/14
git clone --depth 1 https://github.com/swida/sqlbench
cd /usr/lib/postgresql/14/sqlbench
autoreconf -if
./configure --with-postgresql="$PGHOME"
C_INCLUDE_PATH=/usr/include/postgresql make
C_INCLUDE_PATH=/usr/include/postgresql make install
apt-get install -y libpcap-dev libnl-genl-3-dev
cd /tmp
git clone --depth 1 -b 8.4.0-stable https://github.com/ntop/PF_RING
cd /tmp/PF_RING/userland/lib
./configure && make
make install
cd /tmp
git clone --depth 1 -b v5.0-4 https://github.com/heterodb/pg-strom
cd /tmp/pg-strom/arrow-tools
PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config C_INCLUDE_PATH=/tmp/PF_RING/kernel make
PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config C_INCLUDE_PATH=/tmp/PF_RING/kernel make install
cd /usr/lib/postgresql/14
git clone --depth 1 https://github.com/apache/madlib
cd /usr/lib/postgresql/14/madlib
mkdir build
cd /usr/lib/postgresql/14/madlib/build
cmake ..
make -j 4
# $BUILD_ROOT/src/bin/madpack -s madlib -p postgres -c [user[/password]@][host][:port][/database] install
# cd /tmp
# git clone --depth 1 -b apache-arrow-12.0.0 https://github.com/apache/arrow.git
# cd /tmp/arrow/cpp
# mkdir build-release
# cd /tmp/arrow/cpp/build-release
# cmake -DARROW_DEPENDENCY_SOURCE=BUNDLED ..
# make -j4
# make install
#
# cd /tmp
# apt-get install -y libcurl4-openssl-dev uuid-dev libpulse-dev
# git clone --depth 1 -b 1.11.91 https://github.com/aws/aws-sdk-cpp
# cd /tmp/aws-sdk-cpp
# git submodule update --init --recursive --depth 1
# mkdir build
# cd /tmp/aws-sdk-cpp/build
# cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;core"
# make -j4
# make install
#
# cd /tmp
# git clone --depth 1 -b v1.1.0 https://github.com/pgspider/parquet_s3_fdw
# cd /tmp/parquet_s3_fdw
# PG_CPPFLAGS="-Wno-register -D_GLIBCXX_USE_CXX11_ABI=0" USE_PGXS=1 make
# PG_CPPFLAGS="-std=c++17 -Wno-register -D_GLIBCXX_USE_CXX11_ABI=0" USE_PGXS=1 make
# PG_CPPFLAGS="-std=c++17 -Wno-register -D_GLIBCXX_USE_CXX11_ABI=0" USE_PGXS=1 make install
# echo "/usr/local/lib" >>/etc/ld.so.conf
# ldconfig
vi 4.sh
#!/bin/bash
set -vx
echo "* soft nofile 1024000" >> /etc/security/limits.conf
echo "* hard nofile 1024000" >> /etc/security/limits.conf
echo "* soft nproc unlimited" >> /etc/security/limits.conf
echo "* hard nproc unlimited" >> /etc/security/limits.conf
echo "* soft core unlimited" >> /etc/security/limits.conf
echo "* hard core unlimited" >> /etc/security/limits.conf
echo "* soft memlock unlimited" >> /etc/security/limits.conf
echo "* hard memlock unlimited" >> /etc/security/limits.conf
echo "vm.swappiness = 0" >> /etc/sysctl.d/99-sysctl.conf
vi 5.sh
#!/bin/bash
set -vx
export PG_HOME=/var/lib/postgresql
. $PG_HOME/.bash_profile
initdb -D $PGDATA -U postgres -E UTF8 --lc-collate=C --lc-ctype=en_US.UTF8
cd $PGDATA
echo "host all all 0.0.0.0/0 scram-sha-256" >> ./pg_hba.conf
echo "host replication all 0.0.0.0/0 scram-sha-256" >> ./pg_hba.conf
echo "listen_addresses = '0.0.0.0'" >> ./postgresql.auto.conf
echo "port = 1921" >> ./postgresql.auto.conf
echo "max_connections = 2000" >> ./postgresql.auto.conf
echo "unix_socket_directories = '., /var/run/postgresql'" >> ./postgresql.auto.conf
echo "shared_buffers = 128MB" >> ./postgresql.auto.conf
echo "dynamic_shared_memory_type = posix" >> ./postgresql.auto.conf
echo "vacuum_cost_delay = 0" >> ./postgresql.auto.conf
echo "bgwriter_delay = 20ms" >> ./postgresql.auto.conf
echo "bgwriter_lru_maxpages = 500" >> ./postgresql.auto.conf
echo "bgwriter_lru_multiplier = 5.0" >> ./postgresql.auto.conf
echo "max_parallel_workers_per_gather = 0" >> ./postgresql.auto.conf
echo "synchronous_commit = off" >> ./postgresql.auto.conf
echo "wal_compression = on" >> ./postgresql.auto.conf
echo "wal_writer_delay = 10ms" >> ./postgresql.auto.conf
echo "max_wal_size = 1GB " >> ./postgresql.auto.conf
echo "min_wal_size = 80MB " >> ./postgresql.auto.conf
echo "random_page_cost = 1.1" >> ./postgresql.auto.conf
echo "log_destination = 'csvlog'" >> ./postgresql.auto.conf
echo "logging_collector = on" >> ./postgresql.auto.conf
echo "log_truncate_on_rotation = on" >> ./postgresql.auto.conf
echo "log_timezone = 'Etc/UTC' " >> ./postgresql.auto.conf
echo "autovacuum = on" >> ./postgresql.auto.conf
echo "autovacuum_vacuum_cost_delay = 0ms" >> ./postgresql.auto.conf
echo "vacuum_freeze_table_age = 750000000 " >> ./postgresql.auto.conf
echo "vacuum_multixact_freeze_table_age = 750000000 " >> ./postgresql.auto.conf
echo "datestyle = 'iso, mdy' " >> ./postgresql.auto.conf
echo "timezone = 'Etc/UTC' " >> ./postgresql.auto.conf
echo "lc_messages = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "lc_monetary = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "lc_numeric = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "lc_time = 'en_US.UTF-8'" >> ./postgresql.auto.conf
echo "default_text_search_config = 'pg_catalog.english'" >> ./postgresql.auto.conf
vi 6.sh
#!/bin/bash
set -vx
# neon ...... 用法: 202403/20240319_01.md
apt-get install -y build-essential libtool libreadline-dev zlib1g-dev flex bison libseccomp-dev libssl-dev clang pkg-config libpq-dev cmake postgresql-client protobuf-compiler libcurl4-openssl-dev openssl lsof libicu-dev libseccomp-dev
cd /tmp
mkdir protoc
mv protoc-26.0-linux-aarch_64.zip /tmp/protoc
cd /tmp/protoc
unzip protoc-26.0-linux-aarch_64.zip
unalias cp
cp -f /tmp/protoc/bin/protoc /usr/local/bin/protoc
cd /tmp/protoc/include
cp -f -r google /usr/local/include/
pip3 install poetry
useradd -r -b /home/neon -m -d /home/neon -s /bin/bash neon
echo "# add by digoal " >>/home/neon/.bashrc
echo "alias rm='rm -i' " >>/home/neon/.bashrc
echo "alias cp='cp -i' " >>/home/neon/.bashrc
echo "alias ll='ls -larth' " >>/home/neon/.bashrc
echo "alias mv='mv -i' " >>/home/neon/.bashrc
echo "export PGHOME=/usr/lib/postgresql/14 " >>/home/neon/.bashrc
echo "export PATH=\$PGHOME/bin:\$PATH " >>/home/neon/.bashrc
echo "export LD_LIBRARY_PATH=\$PGHOME/lib:/usr/local/lib:/usr/lib/aarch64-linux-gnu:\$LD_LIBRARY_PATH " >>/home/neon/.bashrc
echo "export PGUSER=neon " >>/home/neon/.bashrc
echo "export PGHOST=127.0.0.1 " >>/home/neon/.bashrc
echo "export PGPORT=55432 " >>/home/neon/.bashrc
echo "export PGDATABASE=postgres " >>/home/neon/.bashrc
echo "export LC_ALL=en_US.UTF-8 " >>/home/neon/.bashrc
echo "export PATH=/tmp/cmake-3.27.9/bin:\$PATH " >>/home/neon/.bashrc
echo "export MANPATH=/tmp/cmake-3.27.9/man:\$MANPATH " >>/home/neon/.bashrc
echo "export PATH=/usr/local/go/bin:/home/neon/.cargo/bin:\$PATH " >>/home/neon/.bashrc
echo "export LD_LIBRARY_PATH=\$PGHOME/lib/oracle:\$LD_LIBRARY_PATH " >>/home/neon/.bashrc
echo ". /home/neon/.cargo/env " >>/home/neon/.bashrc
echo "export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static " >>/home/neon/.bashrc
echo "export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup " >>/home/neon/.bashrc
echo "export PATH=/home/neon/neon/target/debug:\$PATH " >>/home/neon/.bashrc
echo "# export PATH=/home/neon/neon/pg_install/v14/bin:\$PATH " >>/home/neon/.bashrc
echo "# export PATH=/home/neon/neon/pg_install/v15/bin:\$PATH " >>/home/neon/.bashrc
echo "export PATH=/home/neon/neon/pg_install/v16/bin:\$PATH " >>/home/neon/.bashrc
vi 7.sh
#!/bin/bash
set -vx
curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 --proto '=https' --tlsv1.2 -sSf -L https://sh.rustup.rs -o rustup-init.sh
chmod +x rustup-init.sh
./rustup-init.sh -y
source $HOME/.cargo/env
. /home/neon/.bashrc
cd /home/neon
git clone --depth 1 -b release-5090 https://github.com/neondatabase/neon.git
cd /home/neon/neon/vendor
git clone --depth 1 -b REL_16_STABLE_neon https://github.com/neondatabase/postgres.git postgres-v16
git clone --depth 1 -b REL_15_STABLE_neon https://github.com/neondatabase/postgres.git postgres-v15
git clone --depth 1 -b REL_14_STABLE_neon https://github.com/neondatabase/postgres.git postgres-v14
cd /home/neon/neon
make -j`nproc` -s
4、准备Dockerfile
cd ~/pg14
vi Dockerfile
FROM --platform=$TARGETPLATFORM debian:11.9
MAINTAINER digoal zhou "dege.zzz@alibaba-inc.com"
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
ENV DEBIAN_FRONTEND=noninteractive TEMP_DIR=/tmp ROOT_HOME=/root PG_HOME=/var/lib/postgresql PG_DATA=/var/lib/postgresql/14/pgdata PGHOME=/usr/lib/postgresql/14
STOPSIGNAL SIGINT
COPY --chmod=555 1.sh 2.sh 3.sh 4.sh 5.sh 6.sh 7.sh $TEMP_DIR/
COPY GraphBLAS-3.1.1.tar.gz libduckdb-linux-aarch64.zip duckdb_cli-linux-aarch64.zip cmake-3.27.4.tar.gz mongo-c-driver-1.17.3.tar.gz json-c-0.15-20200726.tar.gz pg_tiktoken--0.0.1.sql pg_tiktoken.control pg_tiktoken.so lantern_extras--0.1.5.sql lantern_extras.control lantern_extras.so lantern-cli onnxruntime-linux-aarch64-1.15.1.tgz node-v14.21.3.tar.gz pg_search.control pg_search.so pg_search--0.8.4.sql pg_lakehouse.so pg_lakehouse.control pg_lakehouse--0.8.4.sql pg_task.so pg_task.index.bc pg_task.control pg_task--1.0.sql pg_idkit--0.2.1.sql pg_idkit.control pg_idkit.so pgdd--0.5.2.sql pgdd.control pgdd.so pgroll pgmq.control pgmq--1.1.1.sql pgmq.so pg_later.control pg_later.so pg_later--0.0.14.sql vectorize.control vectorize.so vectorize--0.15.0.sql cmake-3.27.9-linux-aarch64.tar.gz libduckdb-src.zip datasketches-1.7.0.zip halo_14.debian11.aarch64.tar.gz proxysql_2.5.5-debian11_arm64.deb pg_analytics.so pg_analytics.control pg_analytics--0.6.2.sql databend-aarch64.tar.gz plrust--1.1.sql plrust.control plrust.so bendsql-aarch64-unknown-linux-gnu.tar.gz protoc-26.0-linux-aarch_64.zip pg_bestmatch.so pg_bestmatch.control pg_bestmatch--0.0.0.sql $TEMP_DIR/
RUN mkdir /tmp/pg_task
COPY pg_task /tmp/pg_task
RUN $TEMP_DIR/1.sh
RUN $TEMP_DIR/2.sh
RUN $TEMP_DIR/3.sh
# WORKDIR $TEMP_DIR
# RUN apt-get install -y libtinfo5 build-essential ninja-build python3
# RUN git clone --depth 1 -b v3.1.7 https://github.com/plv8/plv8
# WORKDIR $TEMP_DIR/plv8
# RUN USE_ICU=1 USE_PGXS=1 make
# RUN USE_ICU=1 USE_PGXS=1 make install
#
# WORKDIR $TEMP_DIR
# RUN git clone --depth 1 -b apache-arrow-12.0.1 https://github.com/apache/arrow.git
# WORKDIR $TEMP_DIR/arrow/cpp
# RUN mkdir build-release
# WORKDIR $TEMP_DIR/arrow/cpp/build-release
# RUN cmake -DARROW_DEPENDENCY_SOURCE=BUNDLED ..
# RUN make -j4
# RUN make install
#
# WORKDIR $TEMP_DIR
# RUN apt-get install -y libcurl4-openssl-dev uuid-dev libpulse-dev
# RUN git clone --depth 1 -b 1.9.263 https://github.com/aws/aws-sdk-cpp
# WORKDIR $TEMP_DIR/aws-sdk-cpp
# RUN git submodule update --init --recursive --depth 1
# RUN mkdir build
# WORKDIR $TEMP_DIR/aws-sdk-cpp/build
# RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;core"
# RUN make -j4
# RUN make install
#
# WORKDIR $TEMP_DIR
# RUN git clone --depth 1 -b v1.0.0 https://github.com/pgspider/parquet_s3_fdw
# WORKDIR $TEMP_DIR/parquet_s3_fdw
# RUN PG_CPPFLAGS="-Wno-register -D_GLIBCXX_USE_CXX11_ABI=0" USE_PGXS=1 make
# RUN PG_CPPFLAGS="-std=c++17 -Wno-register -D_GLIBCXX_USE_CXX11_ABI=0" USE_PGXS=1 make
# RUN PG_CPPFLAGS="-std=c++17 -Wno-register -D_GLIBCXX_USE_CXX11_ABI=0" USE_PGXS=1 make install
# RUN echo "/usr/local/lib" >>/etc/ld.so.conf
# RUN ldconfig
ENV ORACLE_BASE /usr/lib/postgresql/14/lib
WORKDIR $ORACLE_BASE
COPY instantclient_19_19/libclntsh.so.19.1 .
RUN ln -s libclntsh.so.19.1 libclntsh.so
RUN mkdir -p oracle/network/admin
COPY instantclient_19_19 ./oracle
RUN echo "export LD_LIBRARY_PATH=\$PGHOME/lib/oracle:\$LD_LIBRARY_PATH" >>$PG_HOME/.bash_profile
RUN echo "export ORACLE_HOME=\$PGHOME/lib/oracle" >>$PG_HOME/.bash_profile
RUN echo "export TNS_ADMIN=\$ORACLE_HOME/network/admin/" >>$PG_HOME/.bash_profile
RUN echo "export LD_LIBRARY_PATH=\$PGHOME/lib/oracle:\$LD_LIBRARY_PATH" >>$ROOT_HOME/.bashrc
RUN echo "export ORACLE_HOME=\$PGHOME/lib/oracle" >>$ROOT_HOME/.bashrc
RUN echo "export TNS_ADMIN=\$ORACLE_HOME/network/admin/" >>$ROOT_HOME/.bashrc
RUN . $ROOT_HOME/.bashrc
RUN echo "/usr/lib/postgresql/14/lib/oracle" >> /etc/ld.so.conf
RUN echo "/usr/local/lib" >> /etc/ld.so.conf
RUN echo "/usr/lib/postgresql/14/lib" >> /etc/ld.so.conf
RUN ldconfig
WORKDIR $TEMP_DIR
# RUN apt-get install -y libsqlite3-dev
RUN git clone --depth 1 https://github.com/ossc-db/dblink_plus
WORKDIR $TEMP_DIR/dblink_plus
RUN cp -r /usr/lib/postgresql/14/lib/oracle/sdk/include/* ./
RUN PG_CFLAGS=-I/usr/lib/postgresql/14/lib/oracle/sdk/include PG_LDFLAGS=-L/usr/lib/postgresql/14/lib/oracle USE_PGXS=1 make
RUN PG_CFLAGS=-I/usr/lib/postgresql/14/lib/oracle/sdk/include PG_LDFLAGS=-L/usr/lib/postgresql/14/lib/oracle USE_PGXS=1 make install
# RUN rm -rf $TEMP_DIR/*
RUN $TEMP_DIR/4.sh
# 安装neondatabase
# RUN $TEMP_DIR/6.sh
# RUN cp /tmp/7.sh /home/neon/
#
# USER neon
# WORKDIR /home/neon
# RUN /home/neon/7.sh
WORKDIR /tmp
USER postgres
RUN $TEMP_DIR/5.sh
WORKDIR $PG_HOME
# RUN wget -T 36000 -t 0 --waitretry=5 https://github.com/duckdb/duckdb/releases/download/v0.9.2/duckdb_cli-linux-aarch64.zip
# RUN curl -Z --connect-timeout 120 -m 36000 --retry 12000 --retry-delay 5 --retry-max-time 1200 -L https://github.com/duckdb/duckdb/releases/download/v0.9.2/duckdb_cli-linux-aarch64.zip -o duckdb_cli-linux-aarch64.zip
RUN cp $TEMP_DIR/duckdb_cli-linux-aarch64.zip $PG_HOME/
RUN unzip -d . duckdb_cli-linux-aarch64.zip
RUN cp $TEMP_DIR/pgroll $PG_HOME/
USER root
WORKDIR $ROOT_HOME
# PostgreSQL 1921, su - postgres, psql
EXPOSE 1921
#
EXPOSE 3000
# pghero 8080,
EXPOSE 8080
# pgadmin4 80, 查看 3.sh 内 pgadmin4 使用方法
EXPOSE 80
# MySQL 3306,
EXPOSE 3306
# PolarDB 5432, su - polardb, pg_ctl start, psql
EXPOSE 5432
# halo 1521, su - halo, pg_ctl start, psql
EXPOSE 1521
# databend, query 3307, Clickhouse(http) 8124, HTTP 8000
# 启动databend, su - databend, cd /home/databend/databend_software, ./scripts/start.sh
# 连接databend, su - databend, bendsql
# 停止databend, su - databend, cd /home/databend/databend_software, ./scripts/stop.sh
EXPOSE 3307
EXPOSE 8124
EXPOSE 8000
# ivorysql pg
EXPOSE 5281
# ivorysql oracle
EXPOSE 1621
ENTRYPOINT ["su", "-", "postgres", "-c", "/usr/lib/postgresql/14/bin/postgres -D \"/var/lib/postgresql/14/pgdata\""]
5、配置ignore文件
cd ~/pg14
mkdir logs
vi .dockerignore
logs/
6、制作镜像
6.1、确认已开启docker 实验属性: "experimental": true
. 在docker desktop setting: docker engine中配置. 例如:
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"dns": [
"8.8.8.8"
],
"experimental": true,
"registry-mirrors": [
"https://xxxxxx.mirror.aliyuncs.com"
]
}
下载debian arm64架构基础镜像
docker pull --platform=linux/arm64 debian:11.9
确认下载的debian 基础镜像 架构符合预期: arm64
当前打包镜像的是macbook m2芯片机器:
U-4G77XXWF-1921:pg14 digoal$ arch
arm64
下载的debian 基础镜像 架构符合预期: arm64 , 因为我们目标是打包 arm64 的镜像
U-4G77XXWF-1921:pg14 digoal$ docker image inspect debian:11.9|grep Archi
"Architecture": "arm64",
6.2、制作postgresql 14镜像:
cd ~/pg14
docker build --platform=linux/arm64 -t="digoal/pg14:with_exts_arm64" . 2>&1 | tee ./logs/build.log
# docker build --platform=linux/arm64 -t="digoal/pg14:with_exts_arm64" --no-cache . 2>&1 | tee ./logs/build.log
仔细检查是否有错误并解决, 例如:
grep Error ./logs/build.log
grep -i fail ./logs/build.log
grep -i fatal ./logs/build.log
grep ERROR ./logs/build.log
grep "ERR\!" ./logs/build.log
grep "E: " logs/build.log
grep error ./logs/build.log | grep -v "\-Werror"
修复问题后, 可以使用build好的镜像启动容器测试.
docker run -d -it -P --cap-add=SYS_PTRACE --cap-add SYS_ADMIN --privileged=true --name pg --shm-size=1g digoal/pg14:with_exts_arm64
docker exec -ti pg bash
psql
7、推送镜像到阿里云个人镜像服务
参考:
7.1、 将镜像推送到Registry
docker login --username=dig***@126.com registry.cn-hangzhou.aliyuncs.com
docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:[镜像版本号]
docker push registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:[镜像版本号]
根据实际镜像信息替换示例中的[ImageId]
和[镜像版本号]
参数, 例如:
docker tag d9ed34ee3c95 registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:pg14_with_exts_arm64
docker push registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:pg14_with_exts_arm64
7.2、 从阿里云Docker public Registry拉取image不需要login.
docker pull registry.cn-hangzhou.aliyuncs.com/digoal/opensource_database:pg14_with_exts_arm64
和这里一样:
amd64芯片参考: