m6米乐安卓版下载-米乐app官网下载
5

从源码解析mogdb/opengauss容器制作教程 -m6米乐安卓版下载

李宏达 2022-09-09
381

1. clone代码库

[root@ecs-lee lee]# git clone https://gitee.com/enmotech/enmotech-docker-mogdb 
cloning into 'enmotech-docker-mogdb'
... 
remote: enumerating objects: 173, done. 
remote: counting objects: 100% (18/18), done. 
remote: compressing objects: 100% (16/16), done. 
remote: total 173 (delta 6), reused 9 (delta 2), pack-reused 155 receiving objects: 100% (173/173), 2.00 mib | 688.00 kib/s, done. 
resolving deltas: 100% (87/87), done. 

2. 文件结构及用意

[root@ecs-lee enmotech-docker-mogdb]# ls -lrt 
total 112 
drwxr-xr-x 2 root root 4096 sep 8 09:30 1.0.0 
drwxr-xr-x 2 root root 4096 sep 8 09:30 1.0.1 
drwxr-xr-x 2 root root 4096 sep 8 09:30 1.1.0 
drwxr-xr-x 2 root root 4096 sep 8 09:30 2.0.0 
drwxr-xr-x 2 root root 4096 sep 8 09:30 2.0.1 
drwxr-xr-x 2 root root 4096 sep 8 09:30 2.0.3 
drwxr-xr-x 2 root root 4096 sep 8 09:30 3.0.1 
drwxr-xr-x 2 root root 4096 sep 8 09:30 3.0.0 
drwxr-xr-x 2 root root 4096 sep 8 09:30 2.1.1 
drwxr-xr-x 2 root root 4096 sep 8 09:30 2.1.0 
-rw-r--r-- 1 root root 10147 sep 8 09:30 readme.md 
-rw-r--r-- 1 root root 8699 sep 8 09:30 origin-opengauss-text.png 
-rw-r--r-- 1 root root 35149 sep 8 09:30 license 
-rwxr-xr-x 1 root root 3755 sep 8 09:30 create_master_slave.sh 
-rwxr-xr-x 1 root root 4337 sep 8 09:30 builddockerimage.sh 
  • 1.0.0 1.1.0 … 3.0.1 为对应的数据库版本目录
  • readme.md readme文件
  • origin-opengauss-text.png opengauss图片
  • license “gnu general public license”
  • create_master_slave.sh 主备创建脚本
  • builddockerimage.sh 创建镜像脚本
[root@ecs-lee enmotech-docker-mogdb]# tree 3.0.1 
3.0.1
├── dockerfile_amd
├── dockerfile_arm
├── entrypoint.sh
├── k8s_amd.yaml
├── k8s_arm.yaml
├── md5_file_amd64
└── md5_file_arm64
0 directories, 8 files
  • dockerfile_amd dockerfile文件 amd架构下
  • dockerfile_arm dockerfile文件 arm架构下
  • entrypoint.sh endpoint 文件用于创建db及一些定制化功能
  • k8s_amd.yaml k8s amd架构yaml文件
  • k8s_arm.yaml k8s arm架构yaml文件
  • md5_file_amd64 用于校验amd架构下数据库安装包
  • md5_file_arm64 用于校验arm架构下数据库安装包

3. 关键文件内容解读

a. dockerfile_amd

[root@ecs-lee 3.0.1]# cat dockerfile_amd
from ubuntu:18.04 as builder
run set -eux; \
    apt-get update && apt-get install -y \
    wget && \
    wget https://gitee.com/lee1002/gosu/attach_files/943635/download/gosu-amd64  && \
    wget https://cdn-mogdb.enmotech.com/mogdb-media/3.0.1/plugins-3.0.1-centos-x86_64.tar.gz && \
    wget https://gitee.com/enmotech/compat-tools/attach_files/1110114/download/compat-tools-v2022.06.28.tar && \
    wget https://gitee.com/enmotech/mogila/attach_files/954052/download/mogila-v1.0.0.bz2
from ubuntu:18.04
add  mogdb-3.0.1-centos-64bit.tar.gz /usr/local/mogdb
copy --from=builder /gosu-amd64  /usr/local/bin/gosu
copy --from=builder /plugins-3.0.1-centos-x86_64.tar.gz  /tmp
copy --from=builder /compat-tools-v2022.06.28.tar  /tmp
copy --from=builder /mogila-v1.0.0.bz2  /tmp
copy entrypoint.sh /usr/local/bin/
env lang en_us.utf8
env pgdata /var/lib/mogdb/data
run set -eux; \
    apt-get update && apt-get install -y \
    libaio-dev \
    libkeyutils-dev \
    libnuma-dev \
    locales \
    libreadline-dev \
    vim  \
    procps && \
    rm -rf /var/lib/apt/lists/*; \
    ln -s /lib/x86_64-linux-gnu/libreadline.so.7 /lib/x86_64-linux-gnu/libreadline.so.6; \
    groupadd -g 70 omm;  \
    useradd -u 70 -g omm -m -s /bin/bash omm;  \
    mkdir -p /var/lib/mogdb && \
    mkdir -p /usr/local/mogdb && \
    mkdir -p /var/run/mogdb  && \
    mkdir /docker-entrypoint-initdb.d && \
    mkdir -p  /usr/local/mogdb/share/postgresql/contrib && \
    tar -xf /tmp/compat-tools-v2022.06.28.tar -c /home/omm && \
    mv /home/omm/compat-tools-v2022.06.28 /home/omm/compat-tools && \
    tar -xf /tmp/mogila-v1.0.0.bz2 -c /home/omm && \
    tar -xf /tmp/plugins-3.0.1-centos-x86_64.tar.gz -c /usr/local/mogdb && \
    rm -rf /usr/local/mogdb/plugin/postgis && \
    rm -f /tmp/compat-tools-v2022.06.28.tar && \
    rm -f /tmp/plugins-3.0.1-centos-x86_64.tar.gz && \
    rm -f /tmp/mogila-v1.0.0.bz2 && \
    chown omm:omm /var/lib/mogdb /home/omm /var/run/mogdb /docker-entrypoint-initdb.d /usr/local/mogdb/ /usr/local/mogdb/lib /usr/local/mogdb/lib/postgresql /usr/local/mogdb/share/postgresql/contrib /usr/local/mogdb/share/postgresql/extension /usr/local/mogdb/bin && \
    locale-gen en_us.utf-8 && \
    echo "export gausshome=/usr/local/mogdb"  >> /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 && \
    echo "export gausslog=/var/lib/mogdb/data/pg_log" >> /home/omm/.bashrc && \
    echo "export pgdata=/var/lib/mogdb/data" >> /home/omm/.bashrc && \
    echo "\set prompt1 'mogdb%r%#'" >> /home/omm/.gsqlrc && \
    echo "\set prompt2 '#'" >> /home/omm/.gsqlrc && \
    echo "\set prompt3 '>'" >> /home/omm/.gsqlrc && \
    chown -r omm:omm /home/omm && \
    chmod  x /usr/local/bin/gosu && \
    chmod 755 /usr/local/bin/entrypoint.sh /usr/local/mogdb/plugins && \
    cp `find /usr/local/mogdb/plugins -name *.so` /usr/local/mogdb/lib/postgresql/ && \
    cp `find /usr/local/mogdb/plugins -name "*.control" -or -name "*.sql"` /usr/local/mogdb/share/postgresql/extension/ && \
    cp `find /usr/local/mogdb/plugins -name pg_repack -type f -or -name pg_bulkload -type f -or -name postgresql` /usr/local/mogdb/bin/ && \
    cp `find /usr/local/mogdb/plugins -name pg_timestamp.sql -or -name uninstall_pg_timestamp.sql` /usr/local/mogdb/share/postgresql/contrib/ && \
    rm -rf /usr/local/mogdb/plugins && \
    chmod 755 /usr/local/mogdb/lib/postgresql/* /usr/local/mogdb/share/postgresql/extension/* /usr/local/mogdb/bin/pg_repack /usr/local/mogdb/share/postgresql/contrib/pg_timestamp.sql && \
    ln -s /usr/local/bin/entrypoint.sh /
entrypoint ["entrypoint.sh"]
expose 5432
cmd ["mogdb"]
  • from ubuntu:18.04 as builder
    • 两阶段构建,第一阶段准备安装包及依赖环境,
  • from ubuntu:18.04
    • 第二阶段从第一阶段去包及依赖环境,可以减少最终镜像大小。
  • wget
    • 下载安装包
  • copy
    • 从第一阶段镜像导入
  • env
    • 配置环境变量
  • run
    • 准备数据库依赖环境及清理中间产物。
  • apt
    • 安装依赖包及基础环境
  • rm -rf
    • 清理依赖环境
  • mkdir
    • 创建相关目录
  • groupadd useradd
    • 增加所需用户及用户组
  • ehco
    • 配置环境变量及gsqlrc
  • chown chmod
    • 更改用户owner及权限
  • cp
    • 安装相关插件
  • locale-gen en_us.utf-8
    • 安装语言依赖
  • entrypoint cmd
    • 组合传入mogdb参数会运entrypoint.sh

b. dockerfile_arm 文件内容和amd版本类似

c. k8s_arm.yaml

[root@ecs-lee 3.0.1]# cat k8s_arm.yaml
apiversion: v1 --k8s api
kind: pod -- k8s 运行种类
metadata:
  name: mogdb
spec:
  containers: --容器定义
  - name: mogdb
    image: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:3.0.1 --容器地址
    env: -- 环境变量
    - name: gs_password -- key
      value: "enmo@123" -- value
    command: ["/bin/bash"] -- 执行的命令
    args: ["-c", "--", "/usr/local/bin/entrypoint.sh mogdb"] -- 执行的参数
    imagepullpolicy: ifnotpresent
    ports:
    - containerport: 5432 -- 容器端口
      name: mogdb
      protocol: tcp
    volumemounts:
    - mountpath: /mogdb
      name: data
  imagepullsecrets:
  - name: default-secret
  volumes:
  - name: data
    emptydir: {}

d. md5_file_arm64

[root@ecs-lee 3.0.1]# cat md5_file_arm64 b726902ab90c1f8f1f0c0f9886de914f mogdb-3.0.1-openeuler-64bit.tar.gz 

e. entrypoint.sh

[root@ecs-lee 3.0.1]# cat entrypoint.sh
#!/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/mogdb
export path=$gausshome/bin:$path
export ld_library_path=$gausshome/lib:$ld_library_path
export lang=en_us.utf-8
# 文件环境变量
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 mogdb 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/mogdb || :
        chmod 775 /var/run/mogdb || :
        # 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/mogdb \! -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
# 自定义变量,逻辑为若有传入则使用,没有则使用默认,其中包括 gs_nodename、encoding、locale、dbcompatibility 
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
        cmdbase="gs_initdb --pwfile=<(echo "$gs_password")"
        if [ -n "$gs_nodename" ]; then
                cmdbase="$cmdbase --nodename=$gs_nodename"
        else
                cmdbase="$cmdbase --nodename=mogdb"
        fi
        if [ -n "$encoding" ]; then
                cmdbase="$cmdbase --encoding=$encoding"
        else
                cmdbase="$cmdbase --encoding=utf-8"
        fi
        if [ -n "$locale" ]; then
                cmdbase="$cmdbase --locale=$locale"
        else
                cmdbase="$cmdbase --no-locale"
        fi
        if [ -n "$dbcompatibility" ]; then
                cmdbase="$cmdbase --dbcompatibility=$dbcompatibility"
        else
                cmdbase="$cmdbase --dbcompatibility=pg"
        fi
        cmdbase="$cmdbase -d $pgdata"
        eval $cmdbase
        # 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" =~  ^(.{8,}).*$ ]] &&  [[ "$gs_password" =~ ^(.*[a-z] ).*$ ]] && [[                                                                                        "$gs_password" =~ ^(.*[a-z]).*$ ]] &&  [[ "$gs_password" =~ ^(.*[0-9]).*$ ]] && [[ "$gs_password"                                                                                        =~ ^(.*[#?!@$%^&*-]).*$ ]]; then
                cat >&2 <<-'eowarn'
                        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, spec                                                                                       ial 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. :)
                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 mogdb port to access your database wit                                                                                       hout
                                 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; ech                                                                                       o ;;
                        *.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
# 配置文件定制
mogdb_setup_postgresql_conf() {
        {
                echo
                if [ -n "$gs_port" ]; then
                    echo "password_encryption_type = 1"
                    echo "port = $gs_port"
                    echo "wal_level = logical"
                else
                    echo '# use default port 5432'
                    echo "password_encryption_type = 1"
                    echo "wal_level = logical"
                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"
}
mogdb_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" = 'mogdb' ]; 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='127.0.0.1' -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
}
docker_slave_full_backup() {
        gs_ctl build -d "$pgdata" -b full
}
# check arguments for an option that would cause mogdb to stop
# return true if there is one
# 数据库插件安装
docker_setup_plugin(){
                gs_db= docker_process_sql <<-'eosql'
                        create extension dblink;
                        create extension orafce;
                        create extension pg_bulkload;
                        create extension pg_prewarm;
                        create extension pg_repack;
                        create extension pg_trgm;
eosql
}
docker_setup_compat_tools(){
        cd /home/omm/compat-tools
                 docker_process_sql <<-'eosql'
                        \o /home/omm/compat-tools.log;
                        \i runme.sql;
--                       update pg_database set datallowconn = true where datname = 'template0';
--                      \c template0
--                       \i runme.sql;
--                       update pg_database set datallowconn = false where datname = 'template0';
eosql
}
# moglia安装
docker_setup_mogila(){
  echo "gs_db = $gs_db"
        cd /home/omm/mogila-v1.0.0
                 docker_process_sql  --dbname mogila <<-'eosql'
                        \o /home/omm/mogila.log;
                        \i mogila-insert-data.sql;
eosql
}
# wal2json测试
docker_setup_slot() {
                docker_process_sql  <<-'eosql'
                        select * from pg_create_logical_replication_slot('wal2json', 'wal2json');
                        create table mogdb.test (id int primary key, name varchar2(20));
                        insert into mogdb.test values(1,'yun');
                        insert into mogdb.test values(2,'he');
                        insert into mogdb.test values(3,'enmo');
                        alter table mogdb.test replica identity full;
eosql
}
# 帮助
_mogdb_want_help() {
        local arg
        count=1
        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/post                                                                                       gresql/data/postgresql.conf": no such file or directory
                        -'?'|--help|--describe-config|-v|--version)
                                return 0
                                ;;
                esac
                if [ "$arg" == "-m" ]; then
                        server_mode=${@:$count 1:1}
                        echo "mogdb db server_mode = $server_mode"
                        shift
                fi
                count=$[$count   1]
        done
        return 1
}
# 执行函数主题,从上到下。
_main() {
        # if first arg looks like a flag, assume we want to run postgres server
        if [ "${1:0:1}" = '-' ]; then
                set -- mogdb "$@"
        fi
        if [ "$1" = 'mogdb' ] && ! _mogdb_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
                        mogdb_setup_hba_conf
                        mogdb_setup_postgresql_conf
                        mogdb_setup_mot_conf
                        # pgpassword is required for gsql when authentication is required for 'lo                                                                                       cal' 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 "$@"
                        if [ -z "$server_mode" ] || [ "$server_mode" = "primary" ]; then
                        docker_setup_user
                        docker_setup_rep_user
                        docker_setup_plugin
                        docker_setup_compat_tools
                        docker_setup_db
                        docker_setup_mogila
                        docker_setup_slot
                        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
                        echo
                        echo 'mogdb  init process complete; ready for start up.'
                        echo
                else
                        echo
                        echo 'mogdb database directory appears to contain a database; skipping in                                                                                       itialization'
                        echo
                fi
        fi
        exec "$@"
}
if ! _is_sourced; then
        _main "$@"
fi

1. 下载安装包

[root@ecs-lee 3.0.1]# wget https://cdn-mogdb.enmotech.com/mogdb-media/3.0.1/mogdb-3.0.1-centos-x86_64.tar.gz  ^c
[root@ecs-lee 3.0.1]# tar -xf mogdb-3.0.1-centos-64bit.tar.gz

2. 打包

[root@ecs-lee enmotech-docker-mogdb]# ls
1.0.0  1.0.1  1.1.0  2.0.0  2.0.1  2.0.3  2.1.0  2.1.1  3.0.0  3.0.1  builddockerimage.sh  create_master_slave.sh  license  origin-opengauss-text.png  readme.md
[root@ecs-lee enmotech-docker-mogdb]# ./builddockerimage.sh -v 3.0.1 -i
ignored md5 checksum.
==========================
docker info:
client:
 context:    default
 debug mode: false
 plugins:
  app: docker app (docker inc., v0.9.1-beta3)
  buildx: docker buildx (docker inc., v0.7.1-docker)
  scan: docker scan (docker inc., v0.12.0)
server:
 containers: 54
  running: 26
  paused: 0
  stopped: 28
 images: 65
 server version: 20.10.12
 storage driver: overlay2
  backing filesystem: extfs
  supports d_type: true
  native overlay diff: true
  userxattr: false
 logging driver: json-file
 cgroup driver: cgroupfs
 cgroup version: 1
 plugins:
  volume: local
  network: bridge host ipvlan macvlan null overlay
  log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 swarm: inactive
 runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 default runtime: runc
 init binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 security options:
  seccomp
   profile: default
 kernel version: 3.10.0-1160.15.2.el7.x86_64
 operating system: centos linux 7 (core)
 ostype: linux
 architecture: x86_64
 cpus: 4
 total memory: 15.51gib
 name: ecs-lee
 id: gyme:4qya:d4qf:rjot:fbo3:cgbj:bwct:7imp:3tiu:4tua:r33l:6w3z
 docker root dir: /var/lib/docker
 debug mode: false
 username: 15501059069
 registry: https://index.docker.io/v1/
 labels:
 experimental: false
 insecure registries:
  127.0.0.0/8
 registry mirrors:
  http://hub-mirror.c.163.com/
  https://registry.docker-cn.com/
  https://pee6w651.mirror.aliyuncs.com/
 live restore enabled: false
==========================
building image 'swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:3.0.1_amd' ...
sending build context to docker daemon  107.2mb
step 1/15 : from ubuntu:18.04 as builder
 ---> dcf4d4bef137
step 2/15 : run set -eux;     apt-get update && apt-get install -y     wget &&     wget https://gitee.com/lee1002/gosu/attach_files/943635/download/gosu-amd64  &&     wget https://cdn-mogdb.enmotech.com/mogdb-media/3.0.1/plugins-3.0.1-centos-x86_64.tar.gz &&     wget https://gitee.com/enmotech/compat-tools/attach_files/1110114/download/compat-tools-v2022.06.28.tar &&     wget https://gitee.com/enmotech/mogila/attach_files/954052/download/mogila-v1.0.0.bz2
 ---> running in 2c9fa8155580
...
2022-09-09 06:27:40 (139 kb/s) - 'mogila-v1.0.0.bz2' saved [955694/955694]
removing intermediate container 2c9fa8155580
 ---> aec8dfcb94d4
step 3/15 : from ubuntu:18.04
 ---> dcf4d4bef137
step 4/15 : add  mogdb-3.0.1-centos-64bit.tar.gz /usr/local/mogdb
 ---> 3d918fecd300
step 5/15 : copy --from=builder /gosu-amd64  /usr/local/bin/gosu
 ---> 31924dad711c
step 6/15 : copy --from=builder /plugins-3.0.1-centos-x86_64.tar.gz  /tmp
 ---> 19cf1715733c
step 7/15 : copy --from=builder /compat-tools-v2022.06.28.tar  /tmp
 ---> a67c2b892f92
step 8/15 : copy --from=builder /mogila-v1.0.0.bz2  /tmp
 ---> 629ed723ad41
step 9/15 : copy entrypoint.sh /usr/local/bin/
 ---> e22ac8b04195
step 10/15 : env lang en_us.utf8
 ---> running in 449596bdbfc7
removing intermediate container 449596bdbfc7
 ---> 4bb6adc4abbc
step 11/15 : env pgdata /var/lib/mogdb/data
 ---> running in 90f445deb780
removing intermediate container 90f445deb780
 ---> c64779467abb
step 12/15 : run set -eux;     apt-get update && apt-get install -y     libaio-dev     libkeyutils-dev     libnuma-dev     locales     libreadline-dev     vim      procps &&     rm -rf /var/lib/apt/lists/*;     ln -s /lib/x86_64-linux-gnu/libreadline.so.7 /lib/x86_64-linux-gnu/libreadline.so.6;     groupadd -g 70 omm;      useradd -u 70 -g omm -m -s /bin/bash omm;      mkdir -p /var/lib/mogdb &&     mkdir -p /usr/local/mogdb &&     mkdir -p /var/run/mogdb  &&     mkdir /docker-entrypoint-initdb.d &&     mkdir -p  /usr/local/mogdb/share/postgresql/contrib &&     tar -xf /tmp/compat-tools-v2022.06.28.tar -c /home/omm &&     mv /home/omm/compat-tools-v2022.06.28 /home/omm/compat-tools &&     tar -xf /tmp/mogila-v1.0.0.bz2 -c /home/omm &&     tar -xf /tmp/plugins-3.0.1-centos-x86_64.tar.gz -c /usr/local/mogdb &&     rm -rf /usr/local/mogdb/plugin/postgis &&     rm -f /tmp/compat-tools-v2022.06.28.tar &&     rm -f /tmp/plugins-3.0.1-centos-x86_64.tar.gz &&     rm -f /tmp/mogila-v1.0.0.bz2 &&     chown omm:omm /var/lib/mogdb /home/omm /var/run/mogdb /docker-entrypoint-initdb.d /usr/local/mogdb/ /usr/local/mogdb/lib /usr/local/mogdb/lib/postgresql /usr/local/mogdb/share/postgresql/contrib /usr/local/mogdb/share/postgresql/extension /usr/local/mogdb/bin &&     locale-gen en_us.utf-8 &&     echo "export gausshome=/usr/local/mogdb"  >> /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 &&     echo "export gausslog=/var/lib/mogdb/data/pg_log" >> /home/omm/.bashrc &&     echo "export pgdata=/var/lib/mogdb/data" >> /home/omm/.bashrc &&     echo "\set prompt1 'mogdb%r%#'" >> /home/omm/.gsqlrc &&     echo "\set prompt2 '#'" >> /home/omm/.gsqlrc &&     echo "\set prompt3 '>'" >> /home/omm/.gsqlrc &&     chown -r omm:omm /home/omm &&     chmod  x /usr/local/bin/gosu &&     chmod 755 /usr/local/bin/entrypoint.sh /usr/local/mogdb/plugins &&     cp `find /usr/local/mogdb/plugins -name *.so` /usr/local/mogdb/lib/postgresql/ &&     cp `find /usr/local/mogdb/plugins -name "*.control" -or -name "*.sql"` /usr/local/mogdb/share/postgresql/extension/ &&     cp `find /usr/local/mogdb/plugins -name pg_repack -type f -or -name pg_bulkload -type f -or -name postgresql` /usr/local/mogdb/bin/ &&     cp `find /usr/local/mogdb/plugins -name pg_timestamp.sql -or -name uninstall_pg_timestamp.sql` /usr/local/mogdb/share/postgresql/contrib/ &&     rm -rf /usr/local/mogdb/plugins &&     chmod 755 /usr/local/mogdb/lib/postgresql/* /usr/local/mogdb/share/postgresql/extension/* /usr/local/mogdb/bin/pg_repack /usr/local/mogdb/share/postgresql/contrib/pg_timestamp.sql &&     ln -s /usr/local/bin/entrypoint.sh /
 ---> running in a323b79e8ad3
...
removing intermediate container a323b79e8ad3
 ---> f55ce41f7e90
step 13/15 : entrypoint ["entrypoint.sh"]
 ---> running in cf2e22f83941
removing intermediate container cf2e22f83941
 ---> 12272e02e627
step 14/15 : expose 5432
 ---> running in 6effe6ad1ee8
removing intermediate container 6effe6ad1ee8
 ---> 969e80e978c1
step 15/15 : cmd ["mogdb"]
 ---> running in cdf7bc12e544
removing intermediate container cdf7bc12e544
 ---> 98be66283571
successfully built 98be66283571
successfully tagged swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:3.0.1_amd
  mogdb docker image  3.0.1 is ready to be extended:
    --> swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:3.0.1_amd
  build completed in 180 seconds.
[root@ecs-lee enmotech-docker-mogdb]# docker image ls 
repository                                      tag     image id     created size 
swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb 3.0.1_amd 2a74132455e2 36 seconds ago 727mb 
[root@ecs-lee enmotech-docker-mogdb]# docker image ls 
repository                                      tag     image id     created size 
swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb 3.0.1_amd 2a74132455e2 36 seconds ago 727mb 
[root@ecs-lee enmotech-docker-mogdb]# docker run --name mogdb --privileged=true -d swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:3.0.1_amd 12b8ed3e37e874bde7c0df5c247e43dda0eb1b72a13e247aa4d70f533fed9670 
[root@ecs-lee 3.0.1]# docker logs -f mogdb
                        message: the supplied gs_password is meet requirements.
the files belonging to this database system will be owned by user "omm".
this user must also own the server process.
the database cluster will be initialized with locale "c".
the default text search configuration will be set to "english".
fixing permissions on existing directory /var/lib/mogdb/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32mb
creating configuration files ... ok
begin init undo subsystem meta.
[init undo] init undo subsystem meta successfully.
creating template1 database in /var/lib/mogdb/data/base/1 ... the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
2022-09-08 02:56:56.938 [unknown] [unknown] localhost 139708980549824 0[0:0#0]  [backend] warning:  macaddr is 578/2886795268, sysidentifier is 37923857/284257, randomnum is 3140245089
ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
initializing pg_authid ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
setting password ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
initializing dependencies ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading pl/pgsql server-side language ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
creating system views ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
creating performance views ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading system objects' descriptions ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
creating collations ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
creating conversions ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
creating dictionaries ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
setting privileges on built-in objects ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
initialize global configure for bucketmap length ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
creating information schema ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading foreign-data wrapper for distfs access ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading foreign-data wrapper for hdfs access ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading foreign-data wrapper for log access ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading hstore extension ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading foreign-data wrapper for mot access ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
loading security plugin ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
update system tables ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
creating snapshots catalog ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
vacuuming database template1 ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
copying template1 to template0 ... ok
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok
warning: enabling "trust" authentication for local connections
you can change this by editing pg_hba.conf or using the option -a, or
--auth-local and --auth-host, the next time you run gs_initdb.
success. you can now start the database server of single node using:
    mogdb -d /var/lib/mogdb/data --single_node
or
    gs_ctl start -d /var/lib/mogdb/data -z single_node -l logfile
[2022-09-08 02:57:11.586][182][][gs_ctl]: gs_ctl started,datadir is /var/lib/mogdb/data
[2022-09-08 02:57:11.653][182][][gs_ctl]: waiting for server to start...
.0 log:  [alarm module]can not read gauss_warning_type env.
0 log:  [alarm module]host name: 12b8ed3e37e8
0 log:  [alarm module]host ip: 172.17.0.4
0 log:  [alarm module]get env gs_cluster_name failed!
0 warning:  failed to open feature control file, please check whether it exists: filename=gaussdb.version, errno=2, errmessage=no such file or directory.
0 warning:  failed to parse feature control file: gaussdb.version.
0 warning:  failed to load the product control file, so gaussdb cannot distinguish product version.
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
2022-09-08 02:57:11.792 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  when starting as multi_standby mode, we couldn't support data replicaton.
gaussdb.state does not exist, and skipt setting since it is optional.2022-09-08 02:57:11.799 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  [alarm module]can not read gauss_warning_type env.
2022-09-08 02:57:11.799 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  [alarm module]host name: 12b8ed3e37e8
2022-09-08 02:57:11.799 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  [alarm module]host ip: 172.17.0.4
2022-09-08 02:57:11.799 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  [alarm module]get env gs_cluster_name failed!
2022-09-08 02:57:11.804 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  loaded library "security_plugin"
2022-09-08 02:57:11.804 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] warning:  could not create any ha tcp/ip sockets
2022-09-08 02:57:11.804 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] warning:  could not create any ha tcp/ip sockets
2022-09-08 02:57:11.810 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] warning:  no explicit ip is configured for listen_addresses guc.
2022-09-08 02:57:11.810 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  initnuma numanodenum: 1 numa_distribute_mode: none inheritthreadpool: 0.
2022-09-08 02:57:11.810 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  reserved memory for backend threads is: 220 mb
2022-09-08 02:57:11.810 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  reserved memory for wal buffers is: 128 mb
2022-09-08 02:57:11.810 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  set max backend reserve memory is: 348 mb, max dynamic memory is: 11064 mb
2022-09-08 02:57:11.810 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  shared memory 363 mbytes, memory context 11412 mbytes, max process memory 12288 mbytes
2022-09-08 02:57:11.838 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [cache] log:  set data cache  size(402653184)
2022-09-08 02:57:11.855 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [cache] log:  set metadata cache  size(134217728)
2022-09-08 02:57:11.894 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [segment_page] log:  segment-page constants: df_map_size: 8156, df_map_bit_cnt: 65248, df_map_group_extents: 4175872, ipblock_size: 8168, extents_per_ipblock: 1021, ipblock_group_size: 4090, bmt_header_level0_total_pages: 8323072, bktmapentrynumberperblock: 2038, bktmapblocknumber: 25, bktbitmaxmapcnt: 512
2022-09-08 02:57:11.926 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  mogdb: fsync file "/var/lib/mogdb/data/gaussdb.state.temp" success
2022-09-08 02:57:11.926 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  create gaussdb state file success: db state(starting_state), server mode(normal), connection index(1)
2022-09-08 02:57:11.958 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  max_safe_fds = 978, usable_fds = 1000, already_open = 12
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
2022-09-08 02:57:11.960 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  user configure file is not found, it will be created.
2022-09-08 02:57:11.965 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  the configure file /usr/local/mogdb/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. please create it by root user!
2022-09-08 02:57:11.965 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [backend] log:  failed to parse cgroup config file.
2022-09-08 02:57:11.988 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] warning:  failed to obtain environment value $gausslog!
2022-09-08 02:57:11.988 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] detail:  n/a
2022-09-08 02:57:11.988 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] cause:  incorrect environment value.
2022-09-08 02:57:11.988 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] action:  please refer to backend log for more details.
2022-09-08 02:57:11.989 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] warning:  failed to obtain environment value $gausslog!
2022-09-08 02:57:11.989 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] detail:  n/a
2022-09-08 02:57:11.989 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] cause:  incorrect environment value.
2022-09-08 02:57:11.989 [unknown] [unknown] localhost 139814390462656 0[0:0#0]  0 [executor] action:  please refer to backend log for more details.
[2022-09-08 02:57:12.657][182][][gs_ctl]:  done
[2022-09-08 02:57:12.657][182][][gs_ctl]: server started (/var/lib/mogdb/data)
 default user is mogdb
 default no repuser created
execute sql: gsql -v on_error_stop=1 --username omm --dbname postgres
create extension
create extension
create extension
create extension
create extension
create extension
execute sql: gsql -v on_error_stop=1 --username omm --dbname postgres
gsql:runme.sql:152: notice:
gsql:runme.sql:152: notice:  -- =====================================================================
gsql:runme.sql:152: notice:  -- compat object list:
gsql:runme.sql:152: notice:  -- =====================================================================
gsql:runme.sql:152: notice:     | type      | name                                                                        | version | language        | operation                        |
gsql:runme.sql:152: notice:     |-----------|-----------------------------------------------------------------------------|---------|-----------------|----------------------------------|
gsql:runme.sql:152: notice:     | function  | compat_tools.mg_sequence()                                                  | 1.0     |                 | initial creation                 |
gsql:runme.sql:152: notice:     | view      | compat_tools.dba_sequences                                                  | 2.0     |                 | initial creation                 |
creation                 |
gsql:runme.sql:152: notice:     | function  | pg_catalog.digits(numeric)                                                  | 1.0     | sql             | initial creation                 |
gsql:runme.sql:152: notice:
gsql:runme.sql:152: notice:  -- =====================================================================
gsql:runme.sql:152: notice:  -- test summary:
gsql:runme.sql:152: notice:  -- =====================================================================
gsql:runme.sql:152: notice:     | result_type | case_count | start_time          | complete_time       |
gsql:runme.sql:152: notice:     |-------------|------------|---------------------|---------------------|
gsql:runme.sql:152: notice:     | passed      |        521 | 2022-09-08 02:57:13 | 2022-09-08 02:57:15 |
gsql:runme.sql:152: notice:
gsql:runme.sql:152: notice:  -- =====================================================================
gsql:runme.sql:152: notice:  -- test detail (failed or null):
gsql:runme.sql:152: notice:  -- =====================================================================
gsql:runme.sql:152: notice:  -- <<< all succeed >>>
execute sql: gsql -v on_error_stop=1 --username omm --dbname postgres --set passwd=enmo@123
notice:  the encrypted password contains md5 ciphertext, which is not secure.
create role
create database
create database
alter role
alter role
gs_db = omm
execute sql: gsql -v on_error_stop=1 --username omm --dbname postgres --dbname mogila
gsql:mogila-insert-data.sql:47673: warning:  trigger function with non-plpgsql type is not recommended.
detail:  non-plpgsql trigger function are not shippable by default.
hint:  unshippable trigger may lead to bad performance.
execute sql: gsql -v on_error_stop=1 --username omm --dbname postgres
 slotname | xlog_position
---------- ---------------
 wal2json | 0/40e5998
(1 row)
notice:  create table / primary key will create implicit index "test_pkey" for table "test"
create table
insert 0 1
insert 0 1
insert 0 1
alter table
/usr/local/bin/entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
[2022-09-08 02:57:56.882][296][][gs_ctl]: gs_ctl stopped ,datadir is /var/lib/mogdb/data
waiting for server to shut down........... done
server stopped
mogdb  init process complete; ready for start up.
0 log:  [alarm module]can not read gauss_warning_type env.
0 log:  [alarm module]host name: 12b8ed3e37e8
0 log:  [alarm module]host ip: 172.17.0.4
0 log:  [alarm module]get env gs_cluster_name failed!
0 warning:  failed to open feature control file, please check whether it exists: filename=gaussdb.version, errno=2, errmessage=no such file or directory.
0 warning:  failed to parse feature control file: gaussdb.version.
0 warning:  failed to load the product control file, so gaussdb cannot distinguish product version.
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
2022-09-08 02:58:05.040 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  when starting as multi_standby mode, we couldn't support data replicaton.
2022-09-08 02:58:05.046 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  [alarm module]can not read gauss_warning_type env.
2022-09-08 02:58:05.046 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  [alarm module]host name: 12b8ed3e37e8
2022-09-08 02:58:05.046 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  [alarm module]host ip: 172.17.0.4
2022-09-08 02:58:05.046 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  [alarm module]get env gs_cluster_name failed!
2022-09-08 02:58:05.050 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  loaded library "security_plugin"
2022-09-08 02:58:05.050 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] warning:  could not create any ha tcp/ip sockets
2022-09-08 02:58:05.050 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] warning:  could not create any ha tcp/ip sockets
2022-09-08 02:58:05.056 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] warning:  no explicit ip is configured for listen_addresses guc.
2022-09-08 02:58:05.056 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  initnuma numanodenum: 1 numa_distribute_mode: none inheritthreadpool: 0.
2022-09-08 02:58:05.056 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  reserved memory for backend threads is: 220 mb
2022-09-08 02:58:05.056 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  reserved memory for wal buffers is: 128 mb
2022-09-08 02:58:05.056 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  set max backend reserve memory is: 348 mb, max dynamic memory is: 11064 mb
2022-09-08 02:58:05.056 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  shared memory 363 mbytes, memory context 11412 mbytes, max process memory 12288 mbytes
2022-09-08 02:58:05.084 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [cache] log:  set data cache  size(402653184)
2022-09-08 02:58:05.101 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [cache] log:  set metadata cache  size(134217728)
2022-09-08 02:58:05.139 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [segment_page] log:  segment-page constants: df_map_size: 8156, df_map_bit_cnt: 65248, df_map_group_extents: 4175872, ipblock_size: 8168, extents_per_ipblock: 1021, ipblock_group_size: 4090, bmt_header_level0_total_pages: 8323072, bktmapentrynumberperblock: 2038, bktmapblocknumber: 25, bktbitmaxmapcnt: 512
2022-09-08 02:58:05.172 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  mogdb: fsync file "/var/lib/mogdb/data/gaussdb.state.temp" success
2022-09-08 02:58:05.172 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  create gaussdb state file success: db state(starting_state), server mode(normal), connection index(1)
2022-09-08 02:58:05.192 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  max_safe_fds = 977, usable_fds = 1000, already_open = 13
the core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/opt/mogdb/corefile/
2022-09-08 02:58:05.195 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  the configure file /usr/local/mogdb/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. please create it by root user!
2022-09-08 02:58:05.195 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [backend] log:  failed to parse cgroup config file.
2022-09-08 02:58:05.219 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] warning:  failed to obtain environment value $gausslog!
2022-09-08 02:58:05.219 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] detail:  n/a
2022-09-08 02:58:05.219 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] cause:  incorrect environment value.
2022-09-08 02:58:05.219 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] action:  please refer to backend log for more details.
2022-09-08 02:58:05.220 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] warning:  failed to obtain environment value $gausslog!
2022-09-08 02:58:05.220 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] detail:  n/a
2022-09-08 02:58:05.220 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] cause:  incorrect environment value.
2022-09-08 02:58:05.220 [unknown] [unknown] localhost 140198371371200 0[0:0#0]  0 [executor] action:  please refer to backend log for more details.

[root@ecs-lee 3.0.1]# docker exec -it mogdb bash
root@12b8ed3e37e8:/# su - omm
omm@12b8ed3e37e8:~$ gsql -d postgres -p5432 -r
gsql ((mogdb 3.0.1 build 1a363ea9) compiled at 2022-08-05 17:31:04 commit 0 last mr  )
non-ssl connection (ssl connection is recommended when requiring high-security)
type "help" for help.
mogdb=#select version();
                                                                     version
--------------------------------------------------------------------------------------------------------------------------------------------------
 (mogdb 3.0.1 build 1a363ea9) compiled at 2022-08-05 17:31:04 commit 0 last mr   on x86_64-unknown-linux-gnu, compiled by g   (gcc) 7.3.0, 64-bit
(1 row)
mogdb=#
最后修改时间:2022-09-29 13:14:09
「喜欢文章,快来给作者赞赏墨值吧」
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

网站地图