首页 > 系统相关 >一键部署openGauss2.0.1 CentOS 7.6

一键部署openGauss2.0.1 CentOS 7.6

时间:2024-04-10 11:56:31浏览次数:26  
标签:CentOS etc completed echo openGauss2.0 7.6 conf openGauss MY

一键部署 openGauss2.0.1[CentOS 7.6]
本文档目的是为了帮助高校学生提供基于 CentOS7.6 操作系统,实现 openGauss 数据库一键式安装的脚本。

该脚本执行成功后,所有关于 openGauss 数据库的文件将保存在/gaussdb 目录中。

脚本内容中“...”请替换为服务器实际的私有 IP 地址。

脚本内容中“...”请替换为服务器实际的私有 IP 地址。

脚本内容中“...”请替换为服务器实际的私有 IP 地址。

!/bin/bash

Author: 贾军锋

Date: 2021-04-15

OS: CentOS7.6 [最小硬件配置:2c/4G]

Database:openGauss 2.0.1

Description:一键式实现操作系统环境配置、openGauss软件下载、openGauss软件安装等步骤,帮助大家提升安装openGauss数据库效率

Tips: 请确保操作系统可以连接外网

0.关闭virbr0网卡 [本地虚拟机标准化安装openEuler系统会默认存在virbr0网卡,删除该网卡以避免干扰数据库的安装]

virsh net-destroy default

virsh net-list

echo "Net device virbr0 is disabled."

1.定义主机信息[请根据实际情况修改]

export MY_HOSTNAME=node1 ## 主机名
export MY_HOSTIP=... ## IP地址
export MY_SOFTWARE_DIRECTORY=/soft/openGauss ## 软件包所在目录
export MY_XML=/soft/openGauss/clusterconfig.xml ## 集群配置文件XML
export openGauss_Download_url=https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.0.1/x86/openGauss-2.0.1-CentOS-64bit-all.tar.gz ## openGauss软件包下载地址

1. 设置主机名并配置hosts文件

hostnamectl set-hostname $MY_HOSTNAME
sed -i '/$MY_HOSTIP/d' /etc/hosts
echo "$MY_HOSTIP $MY_HOSTNAME #Gauss OM IP Hosts Mapping" >> /etc/hosts
cat /etc/hosts
echo "1.Configure /etc/hosts completed."
echo -e "\n"

2. 关闭防火墙

systemctl disable firewalld.service
systemctl stop firewalld.service
echo "Firewalld " systemctl status firewalld|grep Active
echo "2.Disable firewalld service completed."
echo -e "\n"

3. 关闭SELinux

sed -i '/^SELINUX=/d' /etc/selinux/config
echo "SELINUX=disabled" >> /etc/selinux/config
cat /etc/selinux/config|grep "SELINUX=disabled"
echo "3.Disable SELINUX completed."
echo -e "\n"

4. 设置操作系统字符集编码

echo "LANG=en_US.UTF-8" >> /etc/profile
source /etc/profile
echo $LANG
echo "4.Configure encoding completed."
echo -e "\n"

5. 设置操作系统时区

rm -fr /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date -R
hwclock
echo "5.Configure Timezone completed."
echo -e "\n"

6. 关闭SWAP分区 [对于2G内存的设备,建议待安装完毕后再打开SWAP以间接 “扩容内存容量”]

sed -i '/swap/s/^/#/' /etc/fstab
swapoff -a
free -m
echo "6.Close swap partition completed."
echo -e "\n"

7. 配置SSH服务,关闭Banner,允许root远程登录

sed -i '/Banner/s/^/#/' /etc/ssh/sshd_config
sed -i '/PermitRootLogin/s/^/#/' /etc/ssh/sshd_config
echo -e "\n" >> /etc/ssh/sshd_config
echo "Banner none " >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
cat /etc/ssh/sshd_config |grep -v ^#|grep -E 'PermitRoot|Banner'
echo "7.Configure SSH Service completed."
echo -e "\n"

8. 配置YUM源、安装依赖包、修改默认Python3版本

mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
yum clean all
yum install -y bzip2 python3
yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel net-tools tar
mv /usr/bin/python /usr/bin/python2_bak
ln -s /usr/bin/python3 /usr/bin/python
python -V
echo "8.Configure Install Packages and change default Python version completed."
echo -e "\n"

9. 配置 sysctl.conf 和 performance.sh

cat >> /etc/sysctl.conf << EOF
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.sctp.path_max_retrans = 10
net.sctp.max_init_retransmits = 10
EOF
sysctl -p
echo "9.Configure sysctl.conf and performance.sh completed."
echo -e "\n"

10. 配置资源限制

echo "* soft stack 3072" >> /etc/security/limits.conf
echo "* hard stack 3072" >> /etc/security/limits.conf
echo "* soft nofile 1000000" >> /etc/security/limits.conf
echo "* hard nofile 1000000" >> /etc/security/limits.conf
echo "* soft nproc unlimited" >> /etc/security/limits.d/90-nproc.conf
tail -n 4 /etc/security/limits.conf
tail -n 1 /etc/security/limits.d/90-nproc.conf
echo "10.Configure resource limits completed."
echo -e "\n"

11. 关闭透明大页[Only for CentOS]

cat >>/etc/rc.d/rc.local<<EOF
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
chmod +x /etc/rc.d/rc.local
/usr/bin/sh /etc/rc.d/rc.local
cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/defrag
echo "11.Close transparent_hugepage completed."
echo -e "\n"

12. 禁用RemoveIPC[Only for openEuler]

sed -i '/^RemoveIPC/d' /etc/systemd/logind.conf

sed -i '/^RemoveIPC/d' /usr/lib/systemd/system/systemd-logind.service

echo "RemoveIPC=no" >> /etc/systemd/logind.conf

echo "RemoveIPC=no" >> /usr/lib/systemd/system/systemd-logind.service

systemctl daemon-reload

systemctl restart systemd-logind

loginctl show-session | grep RemoveIPC

systemctl show systemd-logind | grep RemoveIPC

echo "12.Disable RemoveIPC completed."

echo -e "\n"

13. 下载openGauss软件包

mkdir -p $MY_SOFTWARE_DIRECTORY
cd $MY_SOFTWARE_DIRECTORY
wget $openGauss_Download_url
echo "13.openGauss software download completed."
echo -e "\n"

14. 配置XML文件

rm -fr $MY_XML
cat >> $MY_XML <<EOF

    <!--dbnode-->
    <PARAM name="dataNum" value="1"/>
    <PARAM name="dataPortBase" value="26000"/>
    <PARAM name="dataNode1" value="/gaussdb/data/db1"/>
    </DEVICE>
</DEVICELIST>
EOF cat $MY_XML echo "14.Configure XML file completed." echo -e "\n"

15. 解压安装包并修改目录权限

echo "Begin to Uncompress openGauss Package and Modify directory permissions:"
cd $MY_SOFTWARE_DIRECTORY
tar -zxvf *all.tar.gz
tar -zxvf *om.tar.gz
ls -l
chmod -R 777 $MY_SOFTWARE_DIRECTORY/../
echo "15.Uncompress openGauss Package completed."
echo -e "\n"

16. 执行 gs_preinstall

echo "Begin to execute openGauss preinstall:"
python $MY_SOFTWARE_DIRECTORY/script/gs_preinstall -U omm -G dbgrp -X $MY_XML
echo "16.openGauss preinstall completed."
echo -e "\n"

17. 检查预安装环境

echo "Begin to Check OS environment:"
$MY_SOFTWARE_DIRECTORY/script/gs_checkos -i A -h $MY_HOSTNAME --detail

18. 执行 gs_install

echo "Begin to execute openGauss install:"
touch /home/omm/install_db
cat >> /home/omm/install_db <<EOF
source ~/.bashrc
gs_install -X $MY_XML --gsinit-parameter="--encoding=UTF8" --dn-guc="max_process_memory=3GB" --dn-guc="shared_buffers=128MB" --dn-guc="cstore_buffers=16MB"
EOF
chown -R omm:dbgrp /home/omm/install_db
su - omm -c "sh /home/omm/install_db"
echo "17.openGauss install completed."
echo -e "\n"

安装完毕!

echo "openGauss Install completed.congratulations"
echo "Congratulations!!!"

标签:CentOS,etc,completed,echo,openGauss2.0,7.6,conf,openGauss,MY
From: https://www.cnblogs.com/helloopenGauss/p/18125729

相关文章

  • 2-1、dockerfile之centos7
    docker基础及dockerfile1、docker组件(C/S)dockerclient:docker客户端dockerserver:dockerdaemon的主要组成部分,接受用户通过dockerclient发送的请求,并按照相应的路由规则实现路由分发docker镜像:docker镜像运行之后变成容器(dockerrun)dockerregistry:镜像仓库,registry......
  • CentOS8 安装adb调试工具
    1、在opt目录下新建AndroidSdk文件夹,用于存放工具cdopt/mkdirAndroidSdk2、进入AndroidSdk下载工具包cdAndroidSdk/wgethttps://dl.google.com/android/repository/sdk-tools-linux-3859397.zip3、解压工具包,并删除源文件unzipsdk-tools-linux-3859397.ziprm-rfsdk......
  • CentOs8 安装python3.11.9
    1、在opt目录下新建一个Python文件目录存放cd/optmkdirPython>如果显示权限不够需要用su命令进入管理员模式下载python3.11.9目前最新版本wgethttps://mirrors.huaweicloud.com/python/3.11.9/Python-3.11.9.tgz解压tgz文件tar-zxvfPython-3.11.9.tgz>个人倾向于用-......
  • centos 7 vsftp
    添加test用户:useraddtestpasswdtest usermod-s/sbin/nologintest//限定用户test不能telnet,不能ssh登录服务器,只能ftp。注意:vsftp默认会检查用户的shell,如果用户的shell没有在/etc/shells里,拒绝连接。vim/etc/shells,添加/sbin/nologin。usermod-s/sbin/bashtest/......
  • 使用U盘安装centos 8 遇到的问题
    1出现dracut-initqueuetimeout说明是找不到系统盘了可以先进入dev目录找到sdc+数字或sdb+数字的文件,这个文件名看可能就是你U盘的文件重启系统,进入页面 然后按“e”,会进入另一个界面,忘记截图了将linuxefi/images/pxeboot/vmlinuzinst.stage2=hd:LABEL=CentOS\x......
  • CentOS 下性能测试工具 wrk 安装
    前言:使用ab 工具无法压测到性能极限时,就可以使用wrk来压测,但wrk 只支持linux,因此本文记录一下安装过程。1、安装Git:yuminstallgit2、下载wrk:gitclonehttps://github.com/wg/wrk.git3、安装工具:yuminstallunzip4、安装编绎工具:yuminstallgcc5、......
  • Centos 7 yum 安装nginx
    要在Centos7上使用yum安装nginx,您可以按照以下步骤操作:打开终端或SSH连接到您的Centos7服务器。确保您具有sudo权限或root权限。运行以下命令更新yum包管理器的软件包索引:sudoyumupdate运行以下命令安装nginx:sudoyuminstallnginx确认安装过程中会提示您是否......
  • VMware下CentOS7.6安装openGauss
    VMware下CentOS7.6(7.9)安装openGausscentos安装这里我使用的是vmwareworkstationPro15虽然官网了解了一下openGauss最适合的centos版本为centos7.6但是因为centos7.6版本已经停更,所以我这里下载的是7.9版本的镜像文件下载完成后打开vmware,创建新的虚拟机......
  • 在CentOS7上搭建hadoop集群
    hadoop官方下载地址https://hadoop.apache.org/releases.html用到的命令/root/hadoop-3.4.0/bin/hdfsnamenode-format,start-all.sh,stop-all.sh1.三台虚拟机分别设置静态ip2.设置免密登录(更改主机名、添加映射)3.配置hadoop(添加环境变量)core-site.xmlhdfs-site.......
  • 在centos上离线安装k8s
    测试环境中很多是没有连外网的,在这种环境下安装k8s相对麻烦一点,本篇展示一下如何在没有外网的环境当中安装k8s。为了在离线环境当中安装,需要额外准备一台可以连接外网的机器,且这台机器可以向离线机器传输文件,以下称之为外网机器。安装k8s大致分为两步,安装binary文件包括kubectl,k......