add master/slave, add 1.0.1

This commit is contained in:
lee1002 2020-10-01 22:33:09 +08:00
parent e9da9fb9de
commit 62ee2723b7
26 changed files with 432 additions and 123 deletions

View File

@ -1,5 +1,11 @@
# openGauss on Docker
Sample Docker build files to facilitate installation, configuration, and environment setup for DevOps users. For more information about openGasuss please see the [openGauss Online Documentation](https://opengauss.org/zh/docs/1.0.1/docs/Quickstart/Quickstart.html).
## SingleInstance
Provides Docker build files to create an openGasuss Single Instance Docker image. For more details, see [SingleInstance/README.md](./SingleInstance/README.md).
# About Opengauss
openGauss is an open source relational database management system that is released with the Mulan PSL v2. with the kernel derived from PostgreSQL, openGauss is built on Huawei's years of experience in the database field and continuously provides competitive features tailored to enterprise-class scenarios. In addition, openGauss is an open source database platform that encourages community contribution and collaboration.
# How To Run openGauss On Docker
You may read the English installation guide [openGauss-in-Docker-container-installation-guide.md](https://gitee.com/opengauss/docs/blob/master/content/en/docs/installation/openGauss-in-Docker-container-installation-guide.md), and [中文安装指南](https://gitee.com/opengauss/docs/blob/master/content/zh/docs/installation/%E5%AE%B9%E5%99%A8%E5%AE%89%E8%A3%85.md) for details.

View File

@ -1,8 +0,0 @@
# About Opengauss
openGauss is an open source relational database management system that is released with the Mulan PSL v2. with the kernel derived from PostgreSQL, openGauss is built on Huawei's years of experience in the database field and continuously provides competitive features tailored to enterprise-class scenarios. In addition, openGauss is an open source database platform that encourages community contribution and collaboration.
# How To Run Opengauss On Docker
You may read the English installation guide [openGauss-in-Docker-container-installation-guide.md](https://gitee.com/lee1002/docs/blob/master/content/en/docs/installation/openGauss-in-Docker-container-installation-guide.md
), and [中文安装指南](https://gitee.com/lee1002/docs/blob/master/content/zh/docs/installation/openGauss容器版本安装指南.md) for details.

View File

@ -1,45 +0,0 @@
FROM centos:7.6.1810
COPY openGauss-1.0.0-CentOS-64bit.tar.bz2 .
COPY gosu-amd64 /usr/local/bin/gosu
ENV LANG en_US.utf8
#RUN yum install -y epel-release
RUN set -eux; \
groupadd -g 70 omm; \
useradd -u 70 -g omm -d /home/omm omm; \
yum install -y bzip2 bzip2-devel curl libaio && \
mkdir -p /var/lib/opengauss && \
mkdir -p /usr/local/opengauss && \
tar -jxvf openGauss-1.0.0-CentOS-64bit.tar.bz2 -C /usr/local/opengauss && \
mkdir -p /var/run/opengauss && chown -R omm:omm /var/run/opengauss && chown -R omm:omm /usr/local/opengauss && chmod 2777 /var/run/opengauss && \
rm -rf openGauss-1.0.0-CentOS-64bit.tar.bz2 && yum clean all
RUN set -eux; \
echo "export GAUSSHOME=/usr/local/opengauss" >> /home/omm/.bashrc && \
echo "export PATH=\$GAUSSHOME/bin:\$PATH " >> /home/omm/.bashrc && \
echo "export LD_LIBRARY_PATH=\$GAUSSHOME/lib:\$LD_LIBRARY_PATH" >> /home/omm/.bashrc
ENV GOSU_VERSION 1.12
RUN set -eux; \
# dpkgArch=`case $(uname -m) in i386) echo "386" ;; i686) echo "386" ;; x86_64) echo "amd64";; aarch64)echo "arm64";; esac`; \
# gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
# && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
# && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
# && gpg --verify /usr/local/bin/gosu.asc \
# && rm /usr/local/bin/gosu.asc \
# && rm -r /root/.gnupg/ \
chmod +x /usr/local/bin/gosu
RUN mkdir /docker-entrypoint-initdb.d
ENV PGDATA /var/lib/opengauss/data
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh;ln -s /usr/local/bin/entrypoint.sh / # backwards compat
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 5432
CMD ["gaussdb"]

View File

@ -1 +0,0 @@
8fad749031cb79b6de6d0b861ffd453c openGauss-1.0.0-CentOS-64bit.tar.bz2

View File

@ -1 +0,0 @@
241a8f1c8499138e16105e6947f64355 openGauss-1.0.0-openEuler-64bit.tar.bz2

View File

@ -1,45 +0,0 @@
FROM centos:7.6.1810
COPY openGauss-1.0.1-CentOS-64bit.tar.bz2 .
COPY gosu-amd64 /usr/local/bin/gosu
ENV LANG en_US.utf8
#RUN yum install -y epel-release
RUN set -eux; \
groupadd -g 70 omm; \
useradd -u 70 -g omm -d /home/omm omm; \
yum install -y bzip2 bzip2-devel curl libaio && \
mkdir -p /var/lib/opengauss && \
mkdir -p /usr/local/opengauss && \
tar -jxvf openGauss-1.0.1-CentOS-64bit.tar.bz2 -C /usr/local/opengauss && \
mkdir -p /var/run/opengauss && chown -R omm:omm /var/run/opengauss && chown -R omm:omm /usr/local/opengauss && chmod 2777 /var/run/opengauss && \
rm -rf openGauss-1.0.1-CentOS-64bit.tar.bz2 && yum clean all
RUN set -eux; \
echo "export GAUSSHOME=/usr/local/opengauss" >> /home/omm/.bashrc && \
echo "export PATH=\$GAUSSHOME/bin:\$PATH " >> /home/omm/.bashrc && \
echo "export LD_LIBRARY_PATH=\$GAUSSHOME/lib:\$LD_LIBRARY_PATH" >> /home/omm/.bashrc
ENV GOSU_VERSION 1.12
RUN set -eux; \
# dpkgArch=`case $(uname -m) in i386) echo "386" ;; i686) echo "386" ;; x86_64) echo "amd64";; aarch64)echo "arm64";; esac`; \
# gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
# && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
# && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
# && gpg --verify /usr/local/bin/gosu.asc \
# && rm /usr/local/bin/gosu.asc \
# && rm -r /root/.gnupg/ \
chmod +x /usr/local/bin/gosu
RUN mkdir /docker-entrypoint-initdb.d
ENV PGDATA /var/lib/opengauss/data
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh;ln -s /usr/local/bin/entrypoint.sh / # backwards compat
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 5432
CMD ["gaussdb"]

View File

@ -1 +0,0 @@
eb9f3dc1dae1119d2c50944b2ba4ca20 openGauss-1.0.1-CentOS-64bit.tar.bz2

View File

@ -1 +0,0 @@
e6026b2806c96c18ae82da9efe891a37 openGauss-1.0.1-openEuler-64bit.tar.bz2

View File

@ -1,24 +1,24 @@
FROM openeuler-20.03-lts:latest
FROM centos:7.6.1810
COPY openGauss-1.0.0-CentOS-64bit.tar.bz2 .
COPY gosu-amd64 /usr/local/bin/gosu
COPY openGauss-1.0.1-openEuler-64bit.tar.bz2 .
COPY gosu-arm64 /usr/local/bin/gosu
COPY openEuler_aarch64.repo /etc/yum.repos.d/openEuler_aarch64.repo
ENV LANG en_US.utf8
#RUN yum install -y epel-release
RUN set -eux; \
yum install -y bzip2 curl libaio shadow tar&& \
groupadd -g 70 omm; \
useradd -u 70 -g omm -d /home/omm omm; \
yum install -y bzip2 bzip2-devel curl libaio&& \
groupadd -g 70 omm; \
useradd -u 70 -g omm -d /home/omm omm; \
mkdir -p /var/lib/opengauss && \
mkdir -p /usr/local/opengauss && \
mkdir -p /var/run/opengauss && \
mkdir -p /var/run/opengauss && \
mkdir /docker-entrypoint-initdb.d && \
tar -jxvf openGauss-1.0.1-openEuler-64bit.tar.bz2 -C /usr/local/opengauss && \
tar -jxvf openGauss-1.0.0-CentOS-64bit.tar.bz2 -C /usr/local/opengauss && \
chown -R omm:omm /var/run/opengauss && chown -R omm:omm /usr/local/opengauss && chown -R omm:omm /var/lib/opengauss && chown -R omm:omm /docker-entrypoint-initdb.d && \
chmod 2777 /var/run/opengauss && \
rm -rf openGauss-1.0.1-openEuler-64bit.tar.bz2 && yum clean all
rm -rf openGauss-1.0.0-CentOS-64bit.tar.bz2 && yum clean all
RUN set -eux; \
echo "export GAUSSHOME=/usr/local/opengauss" >> /home/omm/.bashrc && \

View File

@ -99,12 +99,21 @@ docker_init_database_dir() {
docker_verify_minimum_env() {
# check password first so we can output the warning before postgres
# messes it up
if [ "${#GS_PASSWORD}" -ge 100 ]; then
if [[ "$GS_PASSWORD" =~ ^(.{8,}).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[a-z]+).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[A-Z]).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[0-9]).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[#?!@$%^&*-]).*$ ]]; then
cat >&2 <<-'EOWARN'
WARNING: The supplied GS_PASSWORD is 100+ characters.
Message: The supplied GS_PASSWORD is meet requirements.
EOWARN
else
cat >&2 <<-'EOWARN'
Error: The supplied GS_PASSWORD is not meet requirements.
Please Check if the password contains uppercase, lowercase, numbers, special characters, and password length(8).
At least one uppercase, lowercase, numeric, special character.
Example: Enmo@123
EOWARN
exit 1
fi
if [ -z "$GS_PASSWORD" ] && [ 'trust' != "$GS_HOST_AUTH_METHOD" ]; then
# The - option suppresses leading tabs but *not* spaces. :)
@ -172,13 +181,15 @@ docker_process_sql() {
if [ -n "$GS_DB" ]; then
query_runner+=( --dbname "$GS_DB" )
fi
echo "Execute SQL: ${query_runner[@]} $@"
"${query_runner[@]}" "$@"
}
# create initial database
# uses environment variables for input: GS_DB
docker_setup_db() {
echo "GS_DB = $GS_DB"
if [ "$GS_DB" != 'postgres' ]; then
GS_DB= docker_process_sql --dbname postgres --set db="$GS_DB" --set passwd="$GS_PASSWORD" --set passwd="$GS_PASSWORD" <<-'EOSQL'
CREATE DATABASE :"db" ;
@ -199,6 +210,15 @@ EOSQL
fi
}
docker_setup_rep_user() {
if [ -n "$SERVER_MODE" ] && [ "$SERVER_MODE" = "primary" ]; then
GS_DB= docker_process_sql --dbname postgres --set passwd="RepUser@2020" --set user="repuser" <<-'EOSQL'
create user :"user" SYSADMIN REPLICATION password :"passwd" ;
EOSQL
else
echo " default no repuser created"
fi
}
# Loads various settings that are used elsewhere in the script
# This should be called before any other functions
@ -227,6 +247,9 @@ opengauss_setup_hba_conf() {
echo '# warning trust is enabled for all connections'
fi
echo "host all all 0.0.0.0/0 $GS_HOST_AUTH_METHOD"
if [ -n "$SERVER_MODE" ]; then
echo "host replication repuser $OG_SUBNET trust"
fi
} >> "$PGDATA/pg_hba.conf"
}
@ -236,13 +259,34 @@ opengauss_setup_postgresql_conf() {
echo
if [ -n "$GS_PORT" ]; then
echo "password_encryption_type = 0"
echo "listen_addresses = '*'"
echo "port = $GS_PORT"
else
echo '# use default port 5432'
echo "password_encryption_type = 0"
fi
if [ -n "$SERVER_MODE" ]; then
echo "listen_addresses = '0.0.0.0'"
echo "most_available_sync = on"
echo "remote_read_mode = non_authentication"
echo "pgxc_node_name = '$NODE_NAME'"
# echo "application_name = '$NODE_NAME'"
if [ "$SERVER_MODE" = "primary" ]; then
echo "max_connections = 100"
else
echo "max_connections = 100"
fi
echo -e "$REPL_CONN_INFO"
if [ -n "$SYNCHRONOUS_STANDBY_NAMES" ]; then
echo "synchronous_standby_names=$SYNCHRONOUS_STANDBY_NAMES"
fi
else
echo "listen_addresses = '*'"
fi
if [ -n "$OTHER_PG_CONF" ]; then
echo -e "$OTHER_PG_CONF"
fi
} >> "$PGDATA/postgresql.conf"
}
@ -273,10 +317,15 @@ docker_temp_server_stop() {
gs_ctl -D "$PGDATA" -m fast -w stop
}
docker_slave_full_backup() {
gs_ctl build -D "$PGDATA" -b full
}
# check arguments for an option that would cause opengauss to stop
# return true if there is one
_opengauss_want_help() {
local arg
count=1
for arg; do
case "$arg" in
# postgres --help | grep 'then exit'
@ -286,6 +335,12 @@ _opengauss_want_help() {
return 0
;;
esac
if [ "$arg" == "-M" ]; then
SERVER_MODE=${@:$count+1:1}
echo "openGauss DB SERVER_MODE = $SERVER_MODE"
shift
fi
count=$[$count + 1]
done
return 1
}
@ -322,10 +377,18 @@ _main() {
export PGPASSWORD="${PGPASSWORD:-$GS_PASSWORD}"
docker_temp_server_start "$@"
if [ -z "$SERVER_MODE" ] || [ "$SERVER_MODE" = "primary" ]; then
docker_setup_db
docker_setup_user
docker_setup_rep_user
docker_process_init_files /docker-entrypoint-initdb.d/*
fi
if [ -n "$SERVER_MODE" ] && [ "$SERVER_MODE" != "primary" ]; then
docker_slave_full_backup
fi
docker_temp_server_stop
unset PGPASSWORD

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
834b6f425cae8a23073967bf66a3f935 openGauss-1.0.0-CentOS-64bit.tar.bz2

View File

@ -0,0 +1 @@
2c8feb1c9b6212e8d0ae43cd4be9bf24 openGauss-1.0.0-openEuler-64bit.tar.bz2

View File

@ -0,0 +1,50 @@
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler

View File

@ -0,0 +1,41 @@
FROM centos:7.6.1810
COPY openGauss-1.0.1-CentOS-64bit.tar.bz2 .
COPY gosu-amd64 /usr/local/bin/gosu
ENV LANG en_US.utf8
#RUN yum install -y epel-release
RUN set -eux; \
yum install -y bzip2 bzip2-devel curl libaio&& \
groupadd -g 70 omm; \
useradd -u 70 -g omm -d /home/omm omm; \
mkdir -p /var/lib/opengauss && \
mkdir -p /usr/local/opengauss && \
mkdir -p /var/run/opengauss && \
mkdir /docker-entrypoint-initdb.d && \
tar -jxvf openGauss-1.0.1-CentOS-64bit.tar.bz2 -C /usr/local/opengauss && \
chown -R omm:omm /var/run/opengauss && chown -R omm:omm /usr/local/opengauss && chown -R omm:omm /var/lib/opengauss && chown -R omm:omm /docker-entrypoint-initdb.d && \
chmod 2777 /var/run/opengauss && \
rm -rf openGauss-1.0.1-CentOS-64bit.tar.bz2 && yum clean all
RUN set -eux; \
echo "export GAUSSHOME=/usr/local/opengauss" >> /home/omm/.bashrc && \
echo "export PATH=\$GAUSSHOME/bin:\$PATH " >> /home/omm/.bashrc && \
echo "export LD_LIBRARY_PATH=\$GAUSSHOME/lib:\$LD_LIBRARY_PATH" >> /home/omm/.bashrc
ENV GOSU_VERSION 1.12
RUN set -eux; \
chmod +x /usr/local/bin/gosu
ENV PGDATA /var/lib/opengauss/data
COPY entrypoint.sh /usr/local/bin/
RUN chmod 755 /usr/local/bin/entrypoint.sh;ln -s /usr/local/bin/entrypoint.sh / # backwards compat
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 5432
CMD ["gaussdb"]

View File

@ -0,0 +1,41 @@
FROM openeuler-20.03-lts:latest
COPY openGauss-1.0.1-openEuler-64bit.tar.bz2 .
COPY gosu-arm64 /usr/local/bin/gosu
COPY openEuler_aarch64.repo /etc/yum.repos.d/openEuler_aarch64.repo
ENV LANG en_US.utf8
#RUN yum install -y epel-release
RUN set -eux; \
yum install -y bzip2 curl libaio shadow tar&& \
groupadd -g 70 omm; \
useradd -u 70 -g omm -d /home/omm omm; \
mkdir -p /var/lib/opengauss && \
mkdir -p /usr/local/opengauss && \
mkdir -p /var/run/opengauss && \
mkdir /docker-entrypoint-initdb.d && \
tar -jxvf openGauss-1.0.1-openEuler-64bit.tar.bz2 -C /usr/local/opengauss && \
chown -R omm:omm /var/run/opengauss && chown -R omm:omm /usr/local/opengauss && chown -R omm:omm /var/lib/opengauss && chown -R omm:omm /docker-entrypoint-initdb.d && \
chmod 2777 /var/run/opengauss && \
rm -rf openGauss-1.0.1-openEuler-64bit.tar.bz2 && yum clean all
RUN set -eux; \
echo "export GAUSSHOME=/usr/local/opengauss" >> /home/omm/.bashrc && \
echo "export PATH=\$GAUSSHOME/bin:\$PATH " >> /home/omm/.bashrc && \
echo "export LD_LIBRARY_PATH=\$GAUSSHOME/lib:\$LD_LIBRARY_PATH" >> /home/omm/.bashrc
ENV GOSU_VERSION 1.12
RUN set -eux; \
chmod +x /usr/local/bin/gosu
ENV PGDATA /var/lib/opengauss/data
COPY entrypoint.sh /usr/local/bin/
RUN chmod 755 /usr/local/bin/entrypoint.sh;ln -s /usr/local/bin/entrypoint.sh / # backwards compat
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 5432
CMD ["gaussdb"]

View File

@ -99,12 +99,21 @@ docker_init_database_dir() {
docker_verify_minimum_env() {
# check password first so we can output the warning before postgres
# messes it up
if [ "${#GS_PASSWORD}" -ge 100 ]; then
if [[ "$GS_PASSWORD" =~ ^(.{8,}).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[a-z]+).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[A-Z]).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[0-9]).*$ ]] && [[ "$GS_PASSWORD" =~ ^(.*[#?!@$%^&*-]).*$ ]]; then
cat >&2 <<-'EOWARN'
WARNING: The supplied GS_PASSWORD is 100+ characters.
Message: The supplied GS_PASSWORD is meet requirements.
EOWARN
else
cat >&2 <<-'EOWARN'
Error: The supplied GS_PASSWORD is not meet requirements.
Please Check if the password contains uppercase, lowercase, numbers, special characters, and password length(8).
At least one uppercase, lowercase, numeric, special character.
Example: Enmo@123
EOWARN
exit 1
fi
if [ -z "$GS_PASSWORD" ] && [ 'trust' != "$GS_HOST_AUTH_METHOD" ]; then
# The - option suppresses leading tabs but *not* spaces. :)
@ -172,13 +181,15 @@ docker_process_sql() {
if [ -n "$GS_DB" ]; then
query_runner+=( --dbname "$GS_DB" )
fi
echo "Execute SQL: ${query_runner[@]} $@"
"${query_runner[@]}" "$@"
}
# create initial database
# uses environment variables for input: GS_DB
docker_setup_db() {
echo "GS_DB = $GS_DB"
if [ "$GS_DB" != 'postgres' ]; then
GS_DB= docker_process_sql --dbname postgres --set db="$GS_DB" --set passwd="$GS_PASSWORD" --set passwd="$GS_PASSWORD" <<-'EOSQL'
CREATE DATABASE :"db" ;
@ -199,6 +210,15 @@ EOSQL
fi
}
docker_setup_rep_user() {
if [ -n "$SERVER_MODE" ] && [ "$SERVER_MODE" = "primary" ]; then
GS_DB= docker_process_sql --dbname postgres --set passwd="RepUser@2020" --set user="repuser" <<-'EOSQL'
create user :"user" SYSADMIN REPLICATION password :"passwd" ;
EOSQL
else
echo " default no repuser created"
fi
}
# Loads various settings that are used elsewhere in the script
# This should be called before any other functions
@ -227,6 +247,9 @@ opengauss_setup_hba_conf() {
echo '# warning trust is enabled for all connections'
fi
echo "host all all 0.0.0.0/0 $GS_HOST_AUTH_METHOD"
if [ -n "$SERVER_MODE" ]; then
echo "host replication repuser $OG_SUBNET trust"
fi
} >> "$PGDATA/pg_hba.conf"
}
@ -236,13 +259,34 @@ opengauss_setup_postgresql_conf() {
echo
if [ -n "$GS_PORT" ]; then
echo "password_encryption_type = 0"
echo "listen_addresses = '*'"
echo "port = $GS_PORT"
else
echo '# use default port 5432'
echo "password_encryption_type = 0"
fi
if [ -n "$SERVER_MODE" ]; then
echo "listen_addresses = '0.0.0.0'"
echo "most_available_sync = on"
echo "remote_read_mode = non_authentication"
echo "pgxc_node_name = '$NODE_NAME'"
# echo "application_name = '$NODE_NAME'"
if [ "$SERVER_MODE" = "primary" ]; then
echo "max_connections = 100"
else
echo "max_connections = 100"
fi
echo -e "$REPL_CONN_INFO"
if [ -n "$SYNCHRONOUS_STANDBY_NAMES" ]; then
echo "synchronous_standby_names=$SYNCHRONOUS_STANDBY_NAMES"
fi
else
echo "listen_addresses = '*'"
fi
if [ -n "$OTHER_PG_CONF" ]; then
echo -e "$OTHER_PG_CONF"
fi
} >> "$PGDATA/postgresql.conf"
}
@ -273,10 +317,15 @@ docker_temp_server_stop() {
gs_ctl -D "$PGDATA" -m fast -w stop
}
docker_slave_full_backup() {
gs_ctl build -D "$PGDATA" -b full
}
# check arguments for an option that would cause opengauss to stop
# return true if there is one
_opengauss_want_help() {
local arg
count=1
for arg; do
case "$arg" in
# postgres --help | grep 'then exit'
@ -286,6 +335,12 @@ _opengauss_want_help() {
return 0
;;
esac
if [ "$arg" == "-M" ]; then
SERVER_MODE=${@:$count+1:1}
echo "openGauss DB SERVER_MODE = $SERVER_MODE"
shift
fi
count=$[$count + 1]
done
return 1
}
@ -322,10 +377,18 @@ _main() {
export PGPASSWORD="${PGPASSWORD:-$GS_PASSWORD}"
docker_temp_server_start "$@"
if [ -z "$SERVER_MODE" ] || [ "$SERVER_MODE" = "primary" ]; then
docker_setup_db
docker_setup_user
docker_setup_rep_user
docker_process_init_files /docker-entrypoint-initdb.d/*
fi
if [ -n "$SERVER_MODE" ] && [ "$SERVER_MODE" != "primary" ]; then
docker_slave_full_backup
fi
docker_temp_server_stop
unset PGPASSWORD

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
aa09ef9621f49c6a80350e6996ccbe46 openGauss-1.0.1-CentOS-64bit.tar.bz2

View File

@ -0,0 +1 @@
2c8feb1c9b6212e8d0ae43cd4be9bf24 openGauss-1.0.0-openEuler-64bit.tar.bz2

View File

@ -0,0 +1,50 @@
#generic-repos is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler
[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler
[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/source/RPM-GPG-KEY-openEuler
[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler

View File

@ -25,6 +25,7 @@ if [ $arch = "amd64" ]; then
else
md5_file="md5_file_arm64"
fi
if hash md5sum 2>/dev/null; then
echo "Checking if required packages are present and valid..."
if ! md5sum -c "$md5_file"; then
@ -61,7 +62,7 @@ checkDockerVersion() {
##############
# Parameters
VERSION="1.0.1"
VERSION="1.0.0"
SKIPMD5=0
DOCKEROPS=""
MIN_DOCKER_VERSION="17.09"

View File

@ -0,0 +1,92 @@
#!/bin/bash -e
# Parameters
#!/bin/bash
#set OG_SUBNET,GS_PASSWORD,MASTER_IP,SLAVE_1_IP,MASTER_HOST_PORT,MASTER_LOCAL_PORT,SLAVE_1_HOST_PORT,SLAVE_1_LOCAL_PORT,MASTER_NODENAME,SLAVE_NODENAME
read -p "Please input OG_SUBNET (容器所在网段) [172.11.0.0/24]: " OG_SUBNET
OG_SUBNET=${OG_SUBNET:-172.11.0.0/24}
echo "OG_SUBNET set $OG_SUBNET"
read -p "Please input GS_PASSWORD (定义数据库密码)[Enmo@123]: " GS_PASSWORD
GS_PASSWORD=${GS_PASSWORD:-Enmo@123}
echo "GS_PASSWORD set $GS_PASSWORD"
read -p "Please input MASTER_IP (主库IP)[172.11.0.101]: " MASTER_IP
MASTER_IP=${MASTER_IP:-172.11.0.101}
echo "MASTER_IP set $MASTER_IP"
read -p "Please input SLAVE_1_IP (备库IP)[172.11.0.102]: " SLAVE_1_IP
SLAVE_1_IP=${SLAVE_1_IP:-172.11.0.102}
echo "SLAVE_1_IP set $SLAVE_1_IP"
read -p "Please input MASTER_HOST_PORT (主库数据库服务端口)[5432]: " MASTER_HOST_PORT
MASTER_HOST_PORT=${MASTER_HOST_PORT:-5432}
echo "MASTER_HOST_PORT set $MASTER_HOST_PORT"
read -p "Please input MASTER_LOCAL_PORT (主库通信端口)[5434]: " MASTER_LOCAL_PORT
MASTER_LOCAL_PORT=${MASTER_LOCAL_PORT:-5434}
echo "MASTER_LOCAL_PORT set $MASTER_LOCAL_PORT"
read -p "Please input SLAVE_1_HOST_PORT (备库数据库服务端口)[6432]: " SLAVE_1_HOST_PORT
SLAVE_1_HOST_PORT=${SLAVE_1_HOST_PORT:-6432}
echo "SLAVE_1_HOST_PORT set $SLAVE_1_HOST_PORT"
read -p "Please input SLAVE_1_LOCAL_PORT (备库通信端口)[6434]: " SLAVE_1_LOCAL_PORT
SLAVE_1_LOCAL_PORT=${SLAVE_1_LOCAL_PORT:-6434}
echo "SLAVE_1_LOCAL_PORT set $SLAVE_1_LOCAL_PORT"
read -p "Please input MASTER_NODENAME [opengauss_master]: " MASTER_NODENAME
MASTER_NODENAME=${MASTER_NODENAME:-opengauss_master}
echo "MASTER_NODENAME set $MASTER_NODENAME"
read -p "Please input SLAVE_NODENAME [opengauss_slave1]: " SLAVE_NODENAME
SLAVE_NODENAME=${SLAVE_NODENAME:-opengauss_slave1}
echo "SLAVE_NODENAME set $SLAVE_NODENAME"
read -p "Please input openGauss VERSION [1.0.1]: " VERSION
VERSION=${VERSION:-1.0.1}
echo "openGauss VERSION set $VERSION"
echo "starting "
docker network create --subnet=$OG_SUBNET opengaussnetwork \
|| {
echo ""
echo "ERROR: OpenGauss Database Network was NOT successfully created."
echo "HINT: opengaussnetwork Maybe Already Exsist Please Execute 'docker network rm opengaussnetwork' "
exit 1
}
echo "OpenGauss Database Network Created."
docker run --network opengaussnetwork --ip $MASTER_IP --privileged=true \
--name $MASTER_NODENAME -h $MASTER_NODENAME -p $MASTER_HOST_PORT:$MASTER_HOST_PORT -d \
-e GS_PORT=$MASTER_HOST_PORT \
-e OG_SUBNET=$OG_SUBNET \
-e GS_PASSWORD=$GS_PASSWORD \
-e NODE_NAME=$MASTER_NODENAME \
-e REPL_CONN_INFO="replconninfo1 = 'localhost=$MASTER_IP localport=$MASTER_LOCAL_PORT localservice=$MASTER_HOST_PORT remotehost=$SLAVE_1_IP remoteport=$SLAVE_1_LOCAL_PORT remoteservice=$SLAVE_1_HOST_PORT'\n" \
opengauss:$VERSION -M primary \
|| {
echo ""
echo "ERROR: OpenGauss Database Master Docker Container was NOT successfully created."
exit 1
}
echo "OpenGauss Database Master Docker Container created."
sleep 30s
docker run --network opengaussnetwork --ip $SLAVE_1_IP --privileged=true \
--name $SLAVE_NODENAME -h $SLAVE_NODENAME -p $SLAVE_1_HOST_PORT:$SLAVE_1_HOST_PORT -d \
-e GS_PORT=$SLAVE_1_HOST_PORT \
-e OG_SUBNET=$OG_SUBNET \
-e GS_PASSWORD=$GS_PASSWORD \
-e NODE_NAME=$SLAVE_NODENAME \
-e REPL_CONN_INFO="replconninfo1 = 'localhost=$SLAVE_1_IP localport=$SLAVE_1_LOCAL_PORT localservice=$SLAVE_1_HOST_PORT remotehost=$MASTER_IP remoteport=$MASTER_LOCAL_PORT remoteservice=$MASTER_HOST_PORT'\n" \
opengauss:$VERSION -M standby \
|| {
echo ""
echo "ERROR: OpenGauss Database Slave1 Docker Container was NOT successfully created."
exit 1
}
echo "OpenGauss Database Slave1 Docker Container created."