openGauss这么多工具?到底要选哪个?(601)

33 阅读1分钟

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/

操作步骤说明:

  1. 安装带cm的数据库集群,配置资源脚本和自定义资源文件,资源脚本示例如下:
    cmrestapi.sh

    #!/bin/bash #set -ex #资源名称 resName=CM-RestAPI #资源binpath cmrestapiPath=/home/cmrestapi/cmrestapi-3.1.0-RELEASE.jar #资源启动命令关键词 cmdKey=cmrestapi-3.1.0-RELEASE.jar #用于保存首次检测到资源假死时间的文件 phony_dead_time_file=.cmrestapi_phony_dead_time #最长假死时间,单位为s PHONY_MAX_TIME=20 envFile=/home/cmrestapi/envfile #appWhiteListFile=/home/cmrestapi/appWhiteListFile source $envFile

    function exec_start { nohup java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=56m -Xms128m -Xmx128m -Xmn32m -Xss328k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -Dserver.port=8080 cmrestapiPathecmrestapiPath -e envFile >> GAUSSLOG/cm/cmrestapi/cmrestapi.log 2>&1 & exit ? }

    function exec_stop { ps x | grep "cmdKey" | grep -v grep | awk '{print 1}' | xargs kill -9; exit $? }

    function exec_check { pid=ps x | grep "$cmdKey" | grep -v grep | awk '{print $1}' if [ "pid"==""];thenecho"{pid}" == "" ]; then echo "resName is not running." exit 1 fi state=cat /proc/$pid/status | grep "State" | awk '{print $2}' if [ "state"=="T"];thenif[!fstate" == "T" ]; then if [ ! -f phony_dead_time_file ]; then touch ./phonydeadtimefileecho"exportfirstphonytime=">./{phony_dead_time_file} echo "export firstphonytime=''" > ./{phony_dead_time_file} fi source ./phonydeadtimefile;curtime=phony_dead_time_file; curtime=(date +%s); if [ "firstphonytime"==""];thenecho"exportfirstphonytime=firstphonytime" == "" ]; then echo "export firstphonytime=curtime" > ./phonydeadtimefile;exit0;fideadtime=phony_dead_time_file; exit 0; fi dead_time=(( curtimecurtime - firstphonytime )); if [ deadtimegedead_time -ge PHONY_MAX_TIME ]; then echo "resNameisdetectedinastateofphonydead(T)andwillbeforciblykilled!"kill9resName is detected in a state of phony dead(T) and will be forcibly killed!" kill -9 pid rm ./phonydeadtimefilefexecstartelseexit0fielif["{phony_dead_time_file} -f exec_start else exit 0 fi elif [ "state" == "S" ]; then rm ./phonydeadtimefilefecho"{phony_dead_time_file} -f echo "resName is running normally." exit 0 fi }

    if [ 1==start];thenexecstart1 == '-start' ]; then exec_start 2 elif [ 1==stop];thenexecstop1 == '-stop' ]; then exec_stop 2 elif [ 1==check];thenexeccheck1 == '-check' ]; then exec_check 2 elif [ 1==clean];thenexecstop1 == '-clean' ]; then exec_stop 2 elif [ 1==reg];thenexit0elif[1 == '-reg' ]; then exit 0 elif [ 1 == '-unreg' ]; then exit 0 elif [ $1 == '-isreg' ]; then exit 11 else echo "Please confirm the input parameters." exit 1 fi

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/