Table of Contents
安装redhat-server7.9
下载镜像
https://pan.baidu.com/s/1eSYuljc2Bt9OXZmWdZQ96A 提取码: cqfu
配置虚拟机
选择配置的虚拟网卡:
安装操作系统
选择系统语言:
关闭KDump:
系统分区:
建立快照
关闭虚拟机->右键虚拟机->快照->快照管理器:
通过shh连接虚拟机
Mobaxterm:https://download.mobatek.net/2212022060563542/MobaXterm_Portable_v22.1.zip
下载->解压->打开即用
MogDB环境准备
查看IP
[root@192-168-56-103 ~]# ip a
查看内存
[root@192-168-56-103 ~]# free -m
查看系统环境
[root@192-168-56-103 ~]# df -hl
修改主机名
# 如果在安装虚拟机过程中未修改主机名的,可以用以下方式修改主机名
[root@192-168-56-103 ~]#cat /etc/hostname
[root@192-168-56-103 ~]#hostnamectl set-hostname %主机名
# 检查主机名和IP地址是否配置正确,需要配置主机名和IP
hostname && ifconfig |grep broadcast|awk '{print $2}'
# 添加主机IP到hosts文件
[root@192-168-56-103 ~]# echo “192.168.56.103 192-168-56-103 ##mogdb OM IP Hosts Mapping” >>/etc/hosts
# 检查增加的记录
cat /etc/hosts|grep mogdb
# 检查主机名和IP地址是否配置正确
hostname && ifconfig |grep broadcast|awk '{print $2}'
cat /etc/hosts
关闭防火墙
# 查看防火墙状态
[root@192-168-56-103 ~]# systmctl status firewalld.service
# 停止防火墙
[root@192-168-56-103 ~]# systmctl stop firewalld.service
# 禁用防火墙
[root@192-168-56-103 ~]# systmctl disable firewalld.service
[root@192-168-56-103 ~]# systmctl status firewalld.service
禁用selinux
[root@192-168-56-103 ~]# vi /etc/selinux/config
配置本地yum源
# 挂载镜像
[root@192-168-56-103 ~]# mkdir -p /mnt/cdrom
[root@192-168-56-103 ~]# mount /dev/sr0 /mnt/cdrom
# 编辑yum源文件
[root@192-168-56-103 ~]# cd /etc/yum.repos.d/
[root@redhat yum.repos.d]# vi yum.repo
[base]
name=base
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@redhat yum.repos.d]# yum clean all
设置字符集参数
# 修改字符集
[root@redhat yum.repos.d]# cat>> /etc/profile<<EOF
export LANG=en_US.UTF-8
EOF
# 检查
[root@redhat yum.repos.d]# cat /etc/profile | grep LANG
设置时区和时间
[root@192-168-56-103 ~]# rm -fr /etc/localtime
[root@192-168-56-103 ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@192-168-56-103 ~]# ll /etc/localtime
设置root用户远程登陆
[root@192-168-56-103 ~]# sed -i ‘/Banner/s/^/#/’ /etc/ssh/sshd_config
[root@192-168-56-103 ~]# sed -i ‘/PermitRootLogin/s/^/#/’ /etc/ssh/sshd_config
[root@192-168-56-103 ~]# echo -e “\n” >> /etc/ssh/sshd_config
[root@192-168-56-103 ~]# echo "Banner none " >> /etc/ssh/sshd_config
[root@192-168-56-103 ~]# echo “PermitRootLogin yes” >> /etc/ssh/sshd_config
[root@192-168-56-103 ~]# cat /etc/ssh/sshd_config |grep -v ^#|grep -E 'PermitRootLogin|Banner’
关闭透明页
# 关闭透明页
echo never > /sys/kernel/mm/transparent_hugepage/enabled
#检查:
cat /sys/kernel/mm/transparent_hugepage/enabled
修改限制参数
vim /etc/security/limits.conf
root soft nofile 1000000
root hard nofile 1000000
omm soft nofile 1000000
omm hard nofile 1000000
root soft nproc unlimited
root hard nproc unlimited
omm soft nproc unlimited
omm hard nproc unlimited
配置操作系统参数
cat >> /etc/sysctl.conf << EOF
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_fin_timeout = 60
EOF
创建相关目录
mkdir -p /opt/software/mogdb
chmod 755 -R /opt/software
安装相关软件包
yum install -y lksctp*
yum install -y java-1.8.0-openjdk* psmisc bzip2 python3 python3-devel
yum install libaio-devel flex bison ncurses-devel glibc-devel patch readline-devel redhat-lsb-core openssh expect
# 检查
rpm -qa libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel bzip2 python3 java-1.8.0-openjdk* openssh psmisc expect
MogDb单机安装
下载MogDB
上传压缩包
借助Mobaxterm上传文件到虚拟机
解压
cd /opt/software/mogdb
tar -zxvf MogDB-3.0.1-CentOS-x86_64.tar.gz
tar -zxvf MogDB-3.0.1-CentOS-64bit-om.tar.gz
创建XML文件
cd /opt/software/mogdb
cat > clusterconfig.xml<<EOF
EOF
配置环境变量
cat>> /etc/profile<<EOF
export LD_LIBRARY_PATH=/opt/software/mogdb/script/gspylib/clib:$LD_LIBRARY_PATH
EOF
source /etc/profile
echo $LD_LIBRARY_PATH
交互式检查
cd /opt/software/mogdb/script
./gs_preinstall -U omm -G dbgrp -X /opt/software/mogdb/clusterconfig.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Generate cluster user password files successfully.
Successfully created [omm] user on all nodes.
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster’s path.
Successfully created cluster’s path.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by “/opt/software/mogdb/script/gs_checkos -i A -h 192-168-56-103 --detail”.
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
交互模式安装MogDB DBMS和创建数据库
# 授权文件夹
chown -R omm:dbgrp /opt/software/mogdb/lib
chown -R omm:dbgrp /opt/software/mogdb/script
# 安装MogDB
su - omm
/opt/software/mogdb/script/gs_install -X /opt/software/mogdb/clusterconfig.xml --gsinit-parameter="–locale=en_US.UTF-8" --gsinit-parameter="–encoding=UTF-8"
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy…
Installing the cluster.
begin prepare Install Cluster…
Checking the installation environment on all nodes.
begin install Cluster…
Installing applications on all nodes.
Successfully installed APP.
begin init Instance…
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
[GAUSS-50322] : Failed to encrypt the password for databaseError:
Try “gs_guc --help” for more information.
Invalid password,it must contain at least eight characters
# 设置数据库密码格式要求:大写+小写+数字+特殊字符(任选3类,至少8 位)
Please enter password for database: huawei@1234
Please repeat for database: huawei@1234
begin to create CA cert files
The sslcert will be generated in /opt/mogdb/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
Successfully started cluster.
Successfully installed application.
end deploy…
登陆数据库
gsql -d postgres -p 26000 -r
show server_version;