#openGauss #入门 #安装 #数据库 #开源
知识来源:docs-opengauss.osinfra.cn/zh/
操作步骤说明:
-
安装带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 cmrestapiPath−eenvFile >> 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"resName is not running."
exit 1
fi
state=cat /proc/$pid/status | grep "State" | awk '{print $2}'
if [ "state"=="T"];thenif[!−fphony_dead_time_file ]; then
touch ./phonydeadtimefileecho"exportfirstphonytime=′′">./{phony_dead_time_file}
fi
source ./phonydeadtimefile;curtime=(date +%s);
if [ "firstphonytime"==""];thenecho"exportfirstphonytime=curtime" > ./phonydeadtimefile;exit0;fideadtime=(( curtime−firstphonytime ));
if [ deadtime−gePHONY_MAX_TIME ]; then
echo "resNameisdetectedinastateofphonydead(T)andwillbeforciblykilled!"kill−9pid
rm ./phonydeadtimefile−fexecstartelseexit0fielif["state" == "S" ]; then
rm ./phonydeadtimefile−fecho"resName is running normally."
exit 0
fi
}
if [ 1==′−start′];thenexecstart2
elif [ 1==′−stop′];thenexecstop2
elif [ 1==′−check′];thenexeccheck2
elif [ 1==′−clean′];thenexecstop2
elif [ 1==′−reg′];thenexit0elif[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/