diff --git a/README.en.md b/README.en.md index 71552fe3e..1fd6f62c4 100644 --- a/README.en.md +++ b/README.en.md @@ -67,7 +67,7 @@ When the Xlog is transferred to the standby node, the standby node flushs the Xl **MOT Engine (beta release)** -The Memory-Optimized Tables (MOT) storage engine is a transactional rowstore optimized for many-core and large memory and delivering extreme OLTP performance and high resources utilization. With data and indexes stored totally in-memory, a NUMA-aware design, algorithms that eliminate lock and latch contention and query native compilation (JIT), MOT provides low latency data access and more efficient transaction execution. See [MOT Engine documentation](https://opengauss.org/en/docs/1.0.0/docs/Developerguide/mot.html). +The Memory-Optimized Tables (MOT) storage engine is a transactional rowstore optimized for many-core and large memory and delivering extreme OLTP performance and high resources utilization. With data and indexes stored totally in-memory, a NUMA-aware design, algorithms that eliminate lock and latch contention and query native compilation (JIT), MOT provides low latency data access and more efficient transaction execution. See [MOT Engine documentation](https://opengauss.org/en/docs/1.0.1/docs/Developerguide/mot.html). **Security** @@ -572,7 +572,7 @@ Installation package packaging log: **./package/make_package.log** ## Quick Start -See the [Quick Start](https://opengauss.org/en/docs/1.0.0/docs/Quickstart/Quickstart.html). +See the [Quick Start](https://opengauss.org/en/docs/1.0.1/docs/Quickstart/Quickstart.html). ## Docs @@ -596,7 +596,7 @@ Welcome contributions. See our [Contributor](https://opengauss.org/en/contributi ## Release Notes -For the release notes, see our [RELEASE](https://opengauss.org/en/docs/1.0.0/docs/Releasenotes/Releasenotes.html). +For the release notes, see our [RELEASE](https://opengauss.org/en/docs/1.0.1/docs/Releasenotes/Releasenotes.html). ## License diff --git a/README.md b/README.md index 4fc4ce3ae..05fe9640c 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ openGauss突破了多核CPU的瓶颈,实现两路鲲鹏128核150万tpmC,内 **MOT引擎(Beta发布)** -内存优化表(MOT)存储引擎是一个专为多核大内存优化的存储引擎,具有极高的联机事务处理(OLTP)性能和资源利用率。MOT的数据和索引完全存储在内存中,通过NUMA感知执行,算法消除闩锁争用以及查询JIT本地编译,提供低时延数据访问及高效事务执行。更多请参考[MOT引擎文档](https://opengauss.org/zh/docs/1.0.0/docs/Developerguide/%E5%86%85%E5%AD%98%E8%A1%A8%E7%89%B9%E6%80%A7.html)。 +内存优化表(MOT)存储引擎是一个专为多核大内存优化的存储引擎,具有极高的联机事务处理(OLTP)性能和资源利用率。MOT的数据和索引完全存储在内存中,通过NUMA感知执行,算法消除闩锁争用以及查询JIT本地编译,提供低时延数据访问及高效事务执行。更多请参考[MOT引擎文档](https://opengauss.org/zh/docs/1.0.1/docs/Developerguide/%E5%86%85%E5%AD%98%E8%A1%A8%E7%89%B9%E6%80%A7.html)。 **安全** @@ -577,7 +577,7 @@ sh build.sh -m debug -3rd /sdc/binarylibs -pkg # 生成debug版本的o ## 快速入门 -参考[快速入门](https://opengauss.org/zh/docs/1.0.0/docs/Quickstart/Quickstart.html)。 +参考[快速入门](https://opengauss.org/zh/docs/1.0.1/docs/Quickstart/Quickstart.html)。 ## 文档 @@ -601,7 +601,7 @@ sh build.sh -m debug -3rd /sdc/binarylibs -pkg # 生成debug版本的o ## 发行说明 -请参见[发行说明](https://opengauss.org/zh/docs/1.0.0/docs/Releasenotes/Releasenotes.html)。 +请参见[发行说明](https://opengauss.org/zh/docs/1.0.1/docs/Releasenotes/Releasenotes.html)。 ## 许可证 diff --git a/docker/README.md b/docker/README.md index 48d1dbe68..63a1bd204 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,5 +1,5 @@ # 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.0/docs/Quickstart/Quickstart.html). +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). diff --git a/docker/SingleInstance/dockerfiles/1.0.1/dockerfile_amd b/docker/SingleInstance/dockerfiles/1.0.1/dockerfile_amd new file mode 100644 index 000000000..22d14e71b --- /dev/null +++ b/docker/SingleInstance/dockerfiles/1.0.1/dockerfile_amd @@ -0,0 +1,45 @@ +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"] diff --git a/docker/SingleInstance/dockerfiles/1.0.1/dockerfile_arm b/docker/SingleInstance/dockerfiles/1.0.1/dockerfile_arm new file mode 100644 index 000000000..00a6e5bd7 --- /dev/null +++ b/docker/SingleInstance/dockerfiles/1.0.1/dockerfile_arm @@ -0,0 +1,48 @@ +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; \ +# 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 + + +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"] diff --git a/docker/SingleInstance/dockerfiles/1.0.1/entrypoint.sh b/docker/SingleInstance/dockerfiles/1.0.1/entrypoint.sh new file mode 100644 index 000000000..8985b6873 --- /dev/null +++ b/docker/SingleInstance/dockerfiles/1.0.1/entrypoint.sh @@ -0,0 +1,347 @@ +#!/usr/bin/env bash +set -Eeo pipefail + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) + +export GAUSSHOME=/usr/local/opengauss +export PATH=$GAUSSHOME/bin:$PATH +export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH + +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# check to see if this file is being run or sourced from another script +_is_sourced() { + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] +} + +# used to create initial opengauss directories and if run as root, ensure ownership belong to the omm user +docker_create_db_directories() { + local user; user="$(id -u)" + + mkdir -p "$PGDATA" + chmod 700 "$PGDATA" + + # ignore failure since it will be fine when using the image provided directory; + mkdir -p /var/run/opengauss || : + chmod 775 /var/run/opengauss || : + + # Create the transaction log directory before initdb is run so the directory is owned by the correct user + if [ -n "$POSTGRES_INITDB_XLOGDIR" ]; then + mkdir -p "$POSTGRES_INITDB_XLOGDIR" + if [ "$user" = '0' ]; then + find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' + + fi + chmod 700 "$POSTGRES_INITDB_XLOGDIR" + fi + + # allow the container to be started with `--user` + if [ "$user" = '0' ]; then + find "$PGDATA" \! -user omm -exec chown omm '{}' + + find /var/run/opengauss \! -user omm -exec chown omm '{}' + + fi +} + +# initialize empty PGDATA directory with new database via 'initdb' +# arguments to `initdb` can be passed via POSTGRES_INITDB_ARGS or as arguments to this function +# `initdb` automatically creates the "postgres", "template0", and "template1" dbnames +# this is also where the database user is created, specified by `GS_USER` env +docker_init_database_dir() { + # "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary + if ! getent passwd "$(id -u)" &> /dev/null && [ -e /usr/lib/libnss_wrapper.so ]; then + export LD_PRELOAD='/usr/lib/libnss_wrapper.so' + export NSS_WRAPPER_PASSWD="$(mktemp)" + export NSS_WRAPPER_GROUP="$(mktemp)" + echo "postgres:x:$(id -u):$(id -g):PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD" + echo "postgres:x:$(id -g):" > "$NSS_WRAPPER_GROUP" + fi + + if [ -n "$POSTGRES_INITDB_XLOGDIR" ]; then + set -- --xlogdir "$POSTGRES_INITDB_XLOGDIR" "$@" + fi + + if [ -n "$GS_NODENAME" ]; then + eval 'gs_initdb --pwfile=<(echo "$GS_PASSWORD") --nodename=$GS_NODENAME '"$POSTGRES_INITDB_ARGS"' "$@"' + else + eval 'gs_initdb --pwfile=<(echo "$GS_PASSWORD") --nodename=gaussdb '"$POSTGRES_INITDB_ARGS"' "$@"' + fi + # unset/cleanup "nss_wrapper" bits + if [ "${LD_PRELOAD:-}" = '/usr/lib/libnss_wrapper.so' ]; then + rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP" + unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP + fi +} + +# print large warning if GS_PASSWORD is long +# error if both GS_PASSWORD is empty and GS_HOST_AUTH_METHOD is not 'trust' +# print large warning if GS_HOST_AUTH_METHOD is set to 'trust' +# assumes database is not set up, ie: [ -z "$DATABASE_ALREADY_EXISTS" ] +docker_verify_minimum_env() { + # check password first so we can output the warning before postgres + # messes it up + if [ "${#GS_PASSWORD}" -ge 100 ]; then + cat >&2 <<-'EOWARN' + + WARNING: The supplied GS_PASSWORD is 100+ characters. + +EOWARN + fi + if [ -z "$GS_PASSWORD" ] && [ 'trust' != "$GS_HOST_AUTH_METHOD" ]; then + # The - option suppresses leading tabs but *not* spaces. :) + cat >&2 <<-'EOE' + Error: Database is uninitialized and superuser password is not specified. + You must specify GS_PASSWORD to a non-empty value for the + superuser. For example, "-e GS_PASSWORD=password" on "docker run". + + You may also use "GS_HOST_AUTH_METHOD=trust" to allow all + connections without a password. This is *not* recommended. + +EOE + exit 1 + fi + if [ 'trust' = "$GS_HOST_AUTH_METHOD" ]; then + cat >&2 <<-'EOWARN' + ******************************************************************************** + WARNING: GS_HOST_AUTH_METHOD has been set to "trust". This will allow + anyone with access to the opengauss port to access your database without + a password, even if GS_PASSWORD is set. + It is not recommended to use GS_HOST_AUTH_METHOD=trust. Replace + it with "-e GS_PASSWORD=password" instead to set a password in + "docker run". + ******************************************************************************** +EOWARN + fi +} + +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions and permissions +docker_process_init_files() { + # gsql here for backwards compatiblilty "${gsql[@]}" + gsql=( docker_process_sql ) + + echo + local f + for f; do + case "$f" in + *.sh) + if [ -x "$f" ]; then + echo "$0: running $f" + "$f" + else + echo "$0: sourcing $f" + . "$f" + fi + ;; + *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo + done +} + +# Execute sql script, passed via stdin (or -f flag of pqsl) +# usage: docker_process_sql [gsql-cli-args] +# ie: docker_process_sql --dbname=mydb <<<'INSERT ...' +# ie: docker_process_sql -f my-file.sql +# ie: docker_process_sql > "$PGDATA/pg_hba.conf" +} + +# append parameter to postgres.conf for connections +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" + echo "listen_addresses = '*'" + fi + } >> "$PGDATA/postgresql.conf" +} + +opengauss_setup_mot_conf() { + echo "enable_numa = false" >> "$PGDATA/mot.conf" +} + +# start socket-only postgresql server for setting up or running scripts +# all arguments will be passed along as arguments to `postgres` (via pg_ctl) +docker_temp_server_start() { + if [ "$1" = 'gaussdb' ]; then + shift + fi + + # internal start of server in order to allow setup using gsql client + # does not listen on external TCP/IP and waits until start finishes + set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}" + + PGUSER="${PGUSER:-$GS_USER}" \ + gs_ctl -D "$PGDATA" \ + -o "$(printf '%q ' "$@")" \ + -w start +} + +# stop postgresql server after done setting up user and running scripts +docker_temp_server_stop() { + PGUSER="${PGUSER:-postgres}" \ + gs_ctl -D "$PGDATA" -m fast -w stop +} + +# check arguments for an option that would cause opengauss to stop +# return true if there is one +_opengauss_want_help() { + local arg + for arg; do + case "$arg" in + # postgres --help | grep 'then exit' + # leaving out -C on purpose since it always fails and is unhelpful: + # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory + -'?'|--help|--describe-config|-V|--version) + return 0 + ;; + esac + done + return 1 +} + +_main() { + # if first arg looks like a flag, assume we want to run postgres server + if [ "${1:0:1}" = '-' ]; then + set -- gaussdb "$@" + fi + + if [ "$1" = 'gaussdb' ] && ! _opengauss_want_help "$@"; then + docker_setup_env + # setup data directories and permissions (when run as root) + docker_create_db_directories + if [ "$(id -u)" = '0' ]; then + # then restart script as postgres user + exec gosu omm "$BASH_SOURCE" "$@" + fi + + # only run initialization on an empty data directory + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + + docker_init_database_dir + opengauss_setup_hba_conf + opengauss_setup_postgresql_conf + opengauss_setup_mot_conf + + # PGPASSWORD is required for gsql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless + # e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS + export PGPASSWORD="${PGPASSWORD:-$GS_PASSWORD}" + docker_temp_server_start "$@" + + docker_setup_db + docker_setup_user + docker_process_init_files /docker-entrypoint-initdb.d/* + + docker_temp_server_stop + unset PGPASSWORD + + echo + echo 'openGauss init process complete; ready for start up.' + echo + else + echo + echo 'openGauss Database directory appears to contain a database; Skipping initialization' + echo + fi + fi + + exec "$@" +} + +if ! _is_sourced; then + _main "$@" +fi diff --git a/docker/SingleInstance/dockerfiles/1.0.1/md5_file_amd64 b/docker/SingleInstance/dockerfiles/1.0.1/md5_file_amd64 new file mode 100644 index 000000000..3703866e1 --- /dev/null +++ b/docker/SingleInstance/dockerfiles/1.0.1/md5_file_amd64 @@ -0,0 +1 @@ +eb9f3dc1dae1119d2c50944b2ba4ca20 openGauss-1.0.1-CentOS-64bit.tar.bz2 \ No newline at end of file diff --git a/docker/SingleInstance/dockerfiles/1.0.1/md5_file_arm64 b/docker/SingleInstance/dockerfiles/1.0.1/md5_file_arm64 new file mode 100644 index 000000000..8537c459b --- /dev/null +++ b/docker/SingleInstance/dockerfiles/1.0.1/md5_file_arm64 @@ -0,0 +1 @@ +e6026b2806c96c18ae82da9efe891a37 openGauss-1.0.1-openEuler-64bit.tar.bz2 \ No newline at end of file diff --git a/docker/SingleInstance/dockerfiles/buildDockerImage.sh b/docker/SingleInstance/dockerfiles/buildDockerImage.sh index 3b2704568..46562619b 100755 --- a/docker/SingleInstance/dockerfiles/buildDockerImage.sh +++ b/docker/SingleInstance/dockerfiles/buildDockerImage.sh @@ -61,7 +61,7 @@ checkDockerVersion() { ############## # Parameters -VERSION="1.0.0" +VERSION="1.0.1" SKIPMD5=0 DOCKEROPS="" MIN_DOCKER_VERSION="17.09"