Fixed ease of use issues
(cherry picked from commit e77658c53bdf09c7ddf842e9bc2a6ee98ee8f1f4)
This commit is contained in:
parent
69c8c7394b
commit
aaa7918a97
@ -1,5 +1,3 @@
|
|||||||
[ -f /etc/profile ] && source /etc/profile
|
|
||||||
|
|
||||||
export GAUSSHOME=/usr/local/opengauss/
|
export GAUSSHOME=/usr/local/opengauss/
|
||||||
export LD_LIBRARY_PATH=/usr/local/opengauss/lib:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=/usr/local/opengauss/lib:$LD_LIBRARY_PATH
|
||||||
export PATH=/usr/local/opengauss/bin:$PATH
|
export PATH=/usr/local/opengauss/bin:$PATH
|
||||||
|
|||||||
@ -188,15 +188,28 @@ install -m 644 %{SOURCE6} %{buildroot}/%{apppath}/script/opengauss.service
|
|||||||
install -m 700 %{SOURCE7} %{buildroot}/%{apppath}/script/autostart.sh
|
install -m 700 %{SOURCE7} %{buildroot}/%{apppath}/script/autostart.sh
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
/usr/sbin/groupadd -g 39 -o -r opengauss >/dev/null 2>&1 || :
|
/usr/sbin/groupadd opengauss >/dev/null 2>&1 || :
|
||||||
/usr/sbin/useradd -M -N -g opengauss -o -r -d %{datapath} -s /bin/bash \
|
/usr/sbin/useradd -M -N -g opengauss -d %{datapath} -s /bin/bash \
|
||||||
-c "openGauss Server" -u 39 opengauss >/dev/null 2>&1 || :
|
-c "openGauss Server" opengauss >/dev/null 2>&1 || :
|
||||||
|
|
||||||
|
# for install step
|
||||||
|
if [ $1 = 1 ]; then
|
||||||
|
portinfo=$(lsof -i:%{port})
|
||||||
|
if [ "${portinfo}" != "" ]; then
|
||||||
|
echo "The port[%{port}] is occupied. Please use command 'lsof -i:%{port} to check it.'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
%post
|
%post
|
||||||
# set opengauss mini config parameters
|
# set opengauss mini config parameters
|
||||||
set_mini_configparam(){
|
set_mini_configparam(){
|
||||||
config_mini_file=%{apppath}/share/postgresql/opengauss_config_file_mini
|
config_mini_file=%{apppath}/share/postgresql/opengauss_config_file_mini
|
||||||
|
|
||||||
|
# set guc parameters
|
||||||
echo "port = %{port}" >> ${config_mini_file}
|
echo "port = %{port}" >> ${config_mini_file}
|
||||||
|
echo "synchronous_commit = off" >> ${config_mini_file}
|
||||||
|
echo "listen_addresses = '127.0.0.1'" >> ${config_mini_file}
|
||||||
|
|
||||||
config_sample_file=%{apppath}/share/postgresql/postgresql.conf.sample
|
config_sample_file=%{apppath}/share/postgresql/postgresql.conf.sample
|
||||||
if [[ -f $config_mini_file ]]
|
if [[ -f $config_mini_file ]]
|
||||||
@ -231,13 +244,13 @@ start_opengauss(){
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=`su - opengauss -c "source ~/.bash_profile; gs_initdb -D /var/lib/opengauss/data -U opengauss --nodename=single_node"`
|
result=`su - opengauss -c "source /var/lib/opengauss/.bash_profile; gs_initdb -D /var/lib/opengauss/data -U opengauss --nodename=single_node"`
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Init openGauss database failed."
|
echo "Init openGauss database failed."
|
||||||
echo $result
|
echo $result
|
||||||
else
|
else
|
||||||
echo "Init openGauss database success."
|
echo "Init openGauss database success."
|
||||||
result=`su - opengauss -c "source ~/.bash_profile; gs_ctl start -D /var/lib/opengauss/data"`
|
result=`su - opengauss -c "source /var/lib/opengauss/.bash_profile; gs_ctl start -D /var/lib/opengauss/data"`
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Start openGauss database failed."
|
echo "Start openGauss database failed."
|
||||||
echo $result
|
echo $result
|
||||||
@ -268,7 +281,7 @@ remove_service(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear_database(){
|
clear_database(){
|
||||||
pid=$(ps -ef | grep /var/lib/opengauss/data | grep -v grep | awk '{print $2}')
|
pid=$(ps -ef | grep /usr/local/opengauss/bin/gaussdb | grep -v grep | awk '{print $2}')
|
||||||
if [ "$pid" != "" ]; then
|
if [ "$pid" != "" ]; then
|
||||||
kill -9 $pid
|
kill -9 $pid
|
||||||
fi
|
fi
|
||||||
@ -292,11 +305,16 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Mon Aug 14 2023 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-5
|
* Mon Aug 14 2023 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-7
|
||||||
- Fix bugs: #I7QJRO
|
- Fix bugs: #I7QJRO
|
||||||
|
|
||||||
* Sat Feb 11 2023 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-4
|
* Sat Feb 11 2023 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-6
|
||||||
- Fix bugs: #I6ED94
|
- Fix bugs: #I6ED94
|
||||||
|
* Sat Mar 12 2022 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-5
|
||||||
|
- Fix bugs: #I4VDYQ #I4V624 #I4UOUU #I4TCDB #I4TCB8
|
||||||
|
|
||||||
|
* Thu Jan 27 2022 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-4
|
||||||
|
- Fix bugs: #I4SDWX
|
||||||
|
|
||||||
* Sat Jan 22 2022 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-3
|
* Sat Jan 22 2022 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-3
|
||||||
- Fix bugs: #I4RVNX
|
- Fix bugs: #I4RVNX
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user