培训PPT资料:轻松上手openGauss第2期(openGauss安装部署)_第1页
培训PPT资料:轻松上手openGauss第2期(openGauss安装部署)_第2页
已阅读5页,还剩39页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 轻松上手openGauss第二期 openGauss 安装部署 openGauss资料团队 贾军锋 2020.11.23openGauss 目 录 CONTENTSopenGaussopenGauss安装部署前瞻安装部署前瞻操作系统环境初始化操作系统环境初始化0102030405openGaussopenGaussopenGauss单单实例部署实例部署(CentOS 7.6)(CentOS 7.6)openGaussopenGauss源码编译源码编译( (openEuleropenEuler 20.3LTS) 2

2、0.3LTS)openGauss dockeropenGauss docker部署部署 PART 1openGauss安装部署前瞻安装部署前瞻openGauss openGauss支持单机部署和单机HA部署两种部署方式:单机部署时,可在一个主机部署一个或多个数据库实例单机HA部署时,支持一台主机和多台备机(14台)的配置方式openGauss安装流程官方文档关于部署流程的描述: openGauss硬件环境要求项目项目配置描述配置描述CPU功能调试最小18 核 2.0GHz。性

3、能测试和商业部署时,单实例部署建议116核 2.0GHz。CPU超线程和非超线程两种模式都支持。但是,openGauss各节点的设置需保持一致。内存内存功能调试建议32GB以上。性能测试和商业部署时,单实例部署建议128GB以上。复杂的查询对内存的需求量比较高,在高并发场景下,可能出现内存不足。此时建议使用大内存的机器,或使用负载管理限制系统的并发。硬盘硬盘至少需要1GB(openGauss的应用程序)+300MB(元数据存储)预留70%以上的磁盘剩余空间用于数据存储。建议系统盘配置为Raid1,数据盘配置为Raid5,且规划4组Raid5数据盘用于安装openGauss。硬件层面,设置Dis

4、k Cache Policy为Disabled,否则机器异常掉电后有数据丢失的风险。网络要求网络要求300兆以上以太网。建议网卡设置为双网卡冗余bond。openGauss网络如果配置bond,请保证bond模式一致,不一致的bond配置可能导致openGauss工作异常。 openGauss软件环境要求软件类型软件类型配置描述配置描述Linux操作系统操作系统ARM: openEuler 20.3LTS(推荐采用此操作系统) 麒麟V10X86: openEuler 20.3LTS CentOS 7.6说明:建议使用英文操作系统,当前安装包只能在英文操作

5、系统上安装使用。Linux文件系统文件系统剩余inode个数 15亿(推荐)工具工具bzip2、JDK 1.8.0PythonCentOS: 支持Python 3.6.XopenEuler:支持Python 3.7.X麒麟:麒麟: 支持Python 3.7.X说明:说明: python需要通过-enable-shared方式编译。 二进制安装包获取路径:/zh/download.htmlopenGauss获取安装包 源码安装包获取路径: https:/ openGauss支持

6、单机部署和单机HA部署两种部署方式:单机部署时,可在一个主机部署一个或多个数据库实例单机HA部署时,支持一台主机和多台备机(14台)的配置方式openGauss安装流程官方文档关于部署流程的描述: PART 2操作系统环境初始化操作系统环境初始化openGauss YUM源配置示例:mkdir -p /etc/yum.repos.d/repo_bak/mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/repo_bak/curl -o /etc/yum.repos.d/CentO

7、S-Base.repo http:/ #华为云内网YUM源或curl -o /etc/yum.repos.d/CentOS-Base.repo https:/ #华为云外网YUM源yum clean all #清除原有yum缓存yum makecache #刷新缓存安装依赖软件包:yum install -y java-1.8.0-openjdk* psmisc bzip2 python3 python3-devel lksctp*yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-

8、coreopenGauss安装依赖软件包Tips:如果系统环境无法使用外网时,则可以使用本地ISO系统镜像配置默认YUM源,但是该YUM源(CentOS 7.6)默认不包含python3,需要手动编译安装。详见Python 3.6 离线安装 编辑Hosts文件vi /etc/hosts-1 db1 #Gauss OM IP Hosts Mapping- 设置backupIP网卡的MTU值(建议8192)可选vi /etc/sysconfig/network-scripts/ifcfg-ens34-MTU=8192 # 可能需要网

9、络工程师协助修改网络设备端口MTU配置- 网卡参数配置(配置万兆业务网卡backIp1)可选rx = 4096 # 预安装时是否由脚本自动设置tx = 4096 # 预安装时是否由脚本自动设置openGauss配置网络 关闭SELinuxvi /etc/selinux/config-SELINUX=disabled-# SELinux的配置文件需要重启操作系统才可以生效,可以使用setenforce 0 使SELinux临时变更为Permissive状态,降低SELinux的影响。 关闭防火墙systemctl status firewalldsyste

10、mctl disable firewalld.servicesystemctl stop firewalld.serviceopenGauss关闭安全策略 修改用户字符集vi /.bash_profile-export LANG=en_US.UTF-8-source /.bash_profile 配置SSH服务vi /etc/ssh/sshd_config-#Banner none # 注释ssh登录的欢迎信息PermitRootLogin yes # 允许root用户远程登录-systemctl restart sshd.serviceopenGaus

11、s配置用户相关选项 禁用RemoveIPC(openEuler环境)vi /etc/systemd/logind.conf-RemoveIPC=no-vi /usr/lib/systemd/system/systemd-logind.service-RemoveIPC=no-systemctl daemon-reloadsystemctl restart systemd-logind 关闭SWAPvi /etc/fstab # 注释掉swap分区挂载swapoff -a # 关闭swap 关闭透明页vi /etc/default/grub-GRUB_CM

12、DLINE_LINUX=rhgb quiet transparent_hugepage=never-grub2-mkconfig -o /boot/grub2/grub.cfg # 重新编译grub,关闭透明页cat /proc/meminfo |grep Huge # 检查透明页是否已禁用#可选临时关闭透明页方法echo never /sys/kernel/mm/transparent_hugepage/enabledecho never /sys/kernel/mm/transparent_hugepage/defragopenGauss内存相关配置

13、 时区配置#查看时区配置rootdb1 # ll /etc/localtimelrwxrwxrwx. 1 root root 35 Apr 27 22:06 /etc/localtime - ./usr/share/zoneinfo/Asia/Shanghai#如果时区不正确,则重新创建时区模板的软链接为/etc/localtime(此处以上海时间为例)rootdb1 # rm -fr /etc/localtimerootdb1 # ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 时间的查看与配置参考命令查看系统时间:date设置系

14、统时间:date -s 2020-05-21 14:09:00 (示例)同步系统时间至硬件:hwclock wTips:建议生产环境开启NTP服务,从NTP服务器同步正确的时间openGauss操作系统时间配置 # vi /etc/security/limits.conf-* soft stack 3072* hard stack 3072* soft nofile 1000000 # gs_preinstall脚本自动设置,可以不手动设置* hard nofile 1000000 # gs_preinstall脚本自动设置,可以不手动设置 -# vi

15、/etc/security/limits.d/90-nproc.conf-* soft nproc unlimited # 系统支持的最大进程数-Tips:使用gs_preinstall脚本后,limits资源虽然已经设置,但可能存在暂时不生效的情况,需要重启系统使之生效。openGauss操作系统资源限制 openGauss内核参数配置# vi /etc/sysctl.conf# sysctl -p # 使内核参数生效内核参数详见官方文档初始化安装环境内核参数详见官方文档初始化安装环境 PART 3openGau

16、ss单实例安装部署单实例安装部署(CentOS 7.6) openGauss创建XML配置文件安装openGauss前需要创建cluster_config.xml文件,该文件包含部署openGauss的服务器信息、安装路径、IP地址以及端口号等,用于告知openGauss如何部署。用户需根据不同场配置对应的XML文件。# vi cluster_config.xml- - openGauss创建目录并解压安装包创建创建相关目录相关目录# mkdir /gauss# chmod 775 -R /gauss# mkdir

17、 -p /soft/openGauss# chmod 775 -R /soft解解压数据库安装包压数据库安装包# mv cluster_config.xml /soft/openGauss# mv openGauss-1.0.1-CentOS-64bit.tar.gz /soft/openGauss# cd /soft/openGauss# tar -zxvf openGauss-1.0.1-CentOS-64bit.tar.gz# ls -ltotal 113768-rwxrwxr-x 1 omm dbgrp 2719 Jul 22 18:42 cluster_config.xmldrwxr

18、-xr-x 14 root root 303 Jun 30 18:27 lib-rw-r-r- 1 root root 65 Jun 30 18:27 openGauss-1.0.1-CentOS-64bit.sha256-rw-r-r- 1 root root 54059724 Jun 30 18:27 openGauss-1.0.1-CentOS-64bit.tar.bz2-rwxrwxr-x. 1 omm dbgrp 62419226 Jul 19 17:50 openGauss-1.0.1-CentOS-64bit.tar.gzdrwxr-xr-x 5 root root 321 Ju

19、n 30 18:27 script-rw-r-r- 1 root root 32 Jun 30 18:27 version.cfg openGauss针对openEuler环境需要额外修改的参数修改修改Python版本检查脚本版本检查脚本# cd /soft/openGauss/script/gspylib/common/# vi CheckPythonVersion.py-修改if not pythonVersion = = (3, 6): - if not pythonVersion = (3, 6):-修改性能相关脚本修改性能相关脚本# vi /e

20、tc/profile.d/performance.sh-使用”#”号注释sysctl -w vm.min_free_kbytes=112640 & /dev/null- openGauss执行交互式预安装rootdb1 # export LD_LIBRARY_PATH=/soft/openGauss/script/gspylib/clib:$LD_LIBRARY_PATHrootdb1 script# cd /soft/openGauss/scriptrootdb1 script#./gs_preinstall -U omm -G dbgrp -

21、X /soft/openGauss/cluster_config.xml -sep-env-file=/gauss/db1_env 创建root互信创建omm互信系统检查与设置 openGauss检查参数配置情况 重启操作系统,使预安装的部分参数配置生效(如:open files参数、max user processes参数等)# reboot 根据提示,执行检查命令”/soft/openGauss/script/gs_checkos -i A -h -detail” openGauss检查预安装产生的文件检查环境

22、变量文件检查环境变量文件# cat /gauss/db1_env使用使用treetree命令查看预安装产生的目录文件命令查看预安装产生的目录文件# yum install tree y# tree -L 2 /gauss/ openGauss执行数据库安装 修改目录权限修改目录权限rootdb1 # chown -R omm:dbgrp /soft/rootdb1 # chown -R omm:dbgrp /gauss 执行数据库安装脚本执行数据库安装脚本rootdb1 # su - ommommdb1 $ source /gauss/db1_envom

23、mdb1 $ gs_install -X /soft/openGauss/cluster_config.xml请记住此处设置的数据请记住此处设置的数据库初始用户的初始密码库初始用户的初始密码 openGauss数据库登录测试 数据库状态检查数据库状态检查rootdb1 # su - ommommdb1 $ source /gauss/db1_envommdb1 $ gs_om -t status -detail 登录数据库测试登录数据库测试ommdb1 $ gsql -d postgres -p 26000 rpostgres=# alter role

24、omm identified by gauss12345 replace gauss321;postgres=# lpostgres=# select version(); openGauss实验环境清理1.1.卸载数据库卸载数据库rootdb1 # su - ommommdb1 $ source /gauss/db1_envommdb1 $ gs_uninstall -delete-dataChecking uninstallation.Successfully checked uninstallation.Stopping the cluster.S

25、uccessfully stopped cluster.Successfully deleted instances.Uninstalling application.Successfully uninstalled application.Uninstallation succeeded.2.2.清理系统环境配置清理系统环境配置rootdb1 # source /gauss/db1_envrootdb1 # gs_postuninstall -U omm -X /soft/openGauss/cluster_config.xml -delete-user -delete-groupParsi

26、ng the configuration file.Successfully parsed the configuration file.Check log file path.Successfully checked log file path.Checking unpreinstallation.Successfully checked unpreinstallation.Deleting the instances directory.Successfully deleted the instances directory.Deleting the temporary directory

27、.Successfully deleted the temporary directory.Deleting software packages and environmental variables of the local node.Successfully deleted software packages and environmental variables of the local nodes.Deleting local OS user.Successfully deleted local OS user.Warning: There are other users in the

28、 group dbgrp on , skip to delete group.Deleting local nodes logs.Successfully deleted local nodes logs.Successfully cleaned environment.3 3. .删除残留目录删除残留目录rootdb1 # ll /gauss/total 0drwx- 2 1001 dbgrp 6 Oct 11 17:23 app_0bd0ce80drwxr-x- 2 1001 dbgrp 6 Oct 11 17:10 corefiledrwx- 3 1001 dbgrp 17 Oct 11

29、 17:10 datadrwxr-x- 2 1001 dbgrp 6 Oct 11 17:28 logdrwx- 2 1001 dbgrp 6 Oct 11 17:28 omrootdb1 # rm -fr /gauss PART 4openGaussopenGauss docker部署部署 openGaussDocker简介Docker三个主要组件:三个主要组件: 镜像镜像(Image) 镜像包含一个完整的操作系统环境和用户需要的其它应用程序。docker的镜像是只可读的,一个镜像可以创建多个容器。 容器容器(C

30、ontainer) 容器是镜像创建的实例,它可以被启动、开始、停止、删除。docker利用容器来开发、运行应用。 仓库仓库(Repository) 仓库是集中存放镜像文件的场所。最大的公开仓库是DockerHub,存放了数量庞大的镜像供用户下载。当然,用户也可以在本地网络内创建一个私有仓库。 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器或Windows 机器上,也可以实现虚拟化,容器是完全使用沙箱机制,相互之间不会有任何接口。 openGaussDocker软件部署实

31、验环境CPU: 2c内存:8GB硬盘:40GB操作系统:CentOS 7.61.卸载旧版本docker # yum remove docker-client docker-client-latest docker docker-common docker-engine docker-latest docker-latest-logrotate docker-logrotate 2.配置docker的YUM源# yum install yum-utils -y# yum-config-manager -add-repo http:/ yum install docker-ce docker-ce

32、-cli containerd.io4.检查docker版本# docker -versionDocker version 19.03.13, build 4484c46d9d openGauss下载软件并解压 openGauss 1.0.1 二进制包下载路径:二进制包下载路径:https:/-south- openGauss 1.0.1 源码包下载路径:源码包下载路径:https:/ 解压软件包:解压软件包:# ls/soft/openGauss-1.0.1-CentOS-64bit.tar.gz opengauss-openGauss-server-

33、master.zip# cd /soft/# unzip opengauss-openGauss-server-master.zip# tar -zxvf openGauss-1.0.1-CentOS-64bit.tar.gz# mv openGauss-1.0.1-CentOS-64bit.tar.bz2 /soft/openGauss-server/docker/dockerfiles/1.0.1 openGauss启动docker进程并构建openGauss镜像 启动docker进程# systemctl start docker 修改md5校验文

34、件内容# cd /soft/openGauss-server/docker/dockerfiles/1.0.1# md5sum openGauss-1.0.1-CentOS-64bit.tar.bz258b9a029719f2d9d32b7d619c850735c openGauss-1.0.1-CentOS-64bit.tar.bz2# echo 58b9a029719f2d9d32b7d619c850735c openGauss-1.0.1-CentOS-64bit.tar.bz2 md5_file_amd64 构建openGauss镜像# cd /soft/openGauss-serve

35、r/docker/dockerfiles# ./buildDockerImage.sh -v 1.0.1 查看构建的openGauss相关镜像 openGauss创建并启动容器 创建容器# docker run -name opengaussdb1 -privileged=true -d -p 26000:5432 -env=GS_PASSWORD=Gauss123 opengauss:1.0.1 创建容器(数据持久化至/gauss目录)# docker run -name opengaussdb2 -privileged=true -d -p 2610

36、0:5432 -env GS_PASSWORD=Gauss123 -v /gauss:/var/lib/opengauss opengauss:1.0.1 openGauss登录openGauss数据库 容器内登录# docker exec -it 872ff600caf0 /bin/bash# su - omm$ gsql -d postgres -p 5432 -r 容器外登录# gsql -d postgres -U gaussdb -WGauss123 -h xxx.xxx.xxx.xxx -p26000

37、openGaussDocker其他基本操作- 启动/停止容器# docker start ec5ea6e5116e# docker stop ec5ea6e5116e# docker restart ec5ea6e5116e- 导出容器$ docker export 1e560fca3906 openGaussdb1.tar- 导入容器$ cat openGaussdb1.tar | docker import - openGaussdb1/openGauss:1.0.1- 登录容器# docker exec -it 872ff600caf0 /bin/bash- 删除容器# docker r

38、m ec5ea6e5116e- 查看容器清单# docker ps -a PART 5openGaussopenGauss源码编译源码编译(openEuler 20.3LTS) openGauss源码编译前瞻openGauss 源码编译流程源码编译流程硬件要求:硬件要求:CPU: 4c内存:8GB硬盘:40GB操作系统版本:操作系统版本:CentOS 7.6_x86_64openEuler 20.03LTS相关软件下载路径:相关软件下载路径:https:/ https:/ openGauss安装软件依赖包roote

39、cs-f2e2 #yum install -y autoconf gcc gcc-c+ libaio-devel ncurses-devel pam-devel libffi-devel libtool rootecs-f2e2 #yum install -y java-1.8.0-openjdk* psmisc bzip2 cmake rsync python3 python3-devel pythonrootecs-f2e2 #yum install -y flex bison readline readline-devel glibc-devel patch lksctp*rootecs

40、-f2e2 #yum install wget net-tools dwz zip unzip libtirpc -yrootecs-f2e2 #yum install perl-parent perl-HTTP-Tiny perl-podlators perl-Pod-Perldoc perl-Pod-Escapes perl-Text-ParseWords perl-Encode perl-Pod-Usage perl-libs perl-macros perl-Time-HiRes perl-constant perl-Socket perl-Time-Local perl-Carp p

41、erl-Storable perl-PathTools perl-Scalar-List-Utils perl-Exporter perl-threads-shared perl-threads perl-Filter perl-File-Temp perl-File-Path perl-Pod-Simple perl-Getopt-Long perl-srpm-macros perl -y华为华为YUM源地址:源地址:https:/ openGauss修改默认python版本为python3- 查看Python版本rootecs-f2e2 # pyth

42、on3 -VPython 3.7.4rootecs-f2e2 # python -VPython 2.7.16- 修改默认Python版本rootecs-f2e2 # mv /usr/bin/python /usr/bin/python_bak2rootecs-f2e2 # ln -s /usr/bin/python3 /usr/bin/pythonrootecs-f2e2 # python -VPython 3.7.4Tips:由于YUM命令需要调用python2的软件包,修改默认的Python版本后,可能会造成YUM无法使用,当使用YUM时请提前变更默认的Python版本。https:/o

43、 openGauss获取软件包- 创建软件包存放目录创建软件包存放目录rootecs-f2e2 # mkdir /softrootecs-f2e2 # chown 775 /softrootecs-f2e2 # cd /soft- 下载下载openGauss源码包源码包(当前版本源码约当前版本源码约149MB)rootecs-f2e2 # wget https:/ rootecs-f2e2 # tail -fn 200 wget-log # 查看查看wget下载进度下载进度rootecs-f2e2 # mv master.zip?ref=master opengauss

44、-openGauss-server-master.zip # 重命名重命名openGauss源码包名称源码包名称- 下载第三方软件源码包下载第三方软件源码包(约约482MB)rootecs-f2e2 # wget https:/ # tail -fn 200 wget-log # 查看查看wget下载进度下载进度rootecs-f2e2 # mv master.zip?ref=master opengauss-openGauss-third_party-master.zip # 重命名第三方源码包名称重命名第三方源码包名称- 下载下载gcc-8.2.0(约约109MB) rootecs-f2e

45、2 #wget http:/ # (官网文档连接的官网文档连接的github速度太慢,速度太慢,建议使用华中科大的建议使用华中科大的gcc源下载源下载) openGauss解压并编译第三方软件包- 解压源码包,移动解压源码包,移动gcc源码包源码包rootecs-f2e2 # cd /soft/rootecs-f2e2 # unzip opengauss-openGauss-server-master.ziprootecs-f2e2 # unzip opengauss-openGauss-third_party-master.ziprootecs-f2e

46、2 # cp gcc-8.2.0.tar.gz /soft/openGauss-third_party/buildtools/gcc/- 编译第三方软件源码包编译第三方软件源码包1.修正修正boost模块编译脚本模块编译脚本(为了使编译支持Python 3.8,开发人员添加了错误代码,这里需要更正,否则boost编译报错)rootecs-f2e2 # vi /soft/openGauss-third_party/dependency/boost/build.sh-删除113115行并替换为以下两行: if $python_version = 3 ; then log Notice python version is 3.x, change python.jam to find python 3.x include directory.-2.降低降低LLVM编译时的并行度编译时的并行度rootecs-f2e2 # vi /soft/openGauss-third

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论