单机规范安装详解(进阶)

适用范围:Linux,其他操作系统仅参考(AIX,HP-UX等) 本文亦适用于技术支持人员
1、安装前准备
数据库安装部署前需要对先决条件进行准备配置,包括操作系统的安装、参数配置、网络配置、存储配置和数据库安装介质的准备。
1.1、硬件要求
服务器要求
GBase 8s为集中式OLTP数据库,单机需要1台服务器,共享磁盘集群需要2台服务器,主备集群需要2台服务器,共享磁盘+主备两地三中心集群需要3台服务器,支持在物理服务器或虚拟化服务器上部署,物理服务器稳定性和性能均要强于虚拟机,条件允许或对稳定性要求较高的业务系统,要求使用物理服务器,不建议在DOCKER环境部署生产数据库。
如使用虚拟机,在创建虚拟机时,要求创建为1物理cpu多核,而不是多物理cpu单核(可在虚拟机创建好后使用lscpu命令查看,Socket(s)为物理cpu个数),多物理cpu可能会导致虚拟机的numa架构在使用完一个节点内存后使用swap,从而导致性能问题。
使用虚拟机情况下,要求配置CPU内核数不小于8,内存不小于16GB。
CPU芯片要求
GBase 8s数据库支持以下CPU型号:
序号 | CPU架构 | CPU型号 |
---|---|---|
1 | x86 | intel、amd、海光、兆芯 |
2 | POWER | IBM POWER系列 |
3 | Itanium | HP-UX Itanium系列 |
4 | SPARC | Solaris SPARC系列 |
5 | ARM | 飞腾系列、鲲鹏系列 |
6 | MIPS | 龙芯3A、龙芯3B系列 |
内存要求
内存配置要求不小于CPU内核数*2,swap配置不小于4GB。
存储要求
数据库为高IO基础软件,对存储IO性能要求较高,建议使用中高端存储(随机读写IOPS在5000以上),如有SSD存储,优先考虑使用SSD存储,RAID采用RAID5或者RAID10模式,数据盘存储容量分配500GB以上,可使用裸设备或文件系统,如使用文件系统,采用xfs格式文件系统。如数据库部署在云主机,划分磁盘应选择高IO高性能类型磁盘。
如计划配置SSC共享磁盘数据库集群,必须有独立的存储设备,映射到两台服务器以实现磁盘共享。
网络要求
数据库网络要求千兆以上网卡,服务网络应当使用不少于两条物理线路的双网卡绑定,如配置了数据库集群,要求配置独立于服务器网络的专用心跳网络(可直连),同样使用双网卡绑定。网卡硬件厂商应提供网卡相应操作系统的网卡驱动,保证ethtool查看网卡信息可正常显示网卡状态信息。
单机数据库服务器需要配置一个物理IP,要求网络防火墙开放应用与数据库服务器之间的端口9088长连接。
数据库集群每台服务器需要配置两个物理IP(一个服务IP,一个心跳IP),网络防火墙开放数据库集群节点之间及应用与数据库节点之间端口9088、9099、9200、9300长连接。
备份要求
优先使用第三方备份软件进行统一备份策略管理,GBase 8s支持NBU、爱数、鼎甲等备份软件。如没有第三方备份软件,要求准备独立于数据存储以外的存储设备对数据库进行备份,确保生产数据及备份数据不存储于同一存储设备。备份存储可使用中低端存储。
1.2、操作系统版本要求
GBase 8s数据库支持以下操作系统:
序号 | 系统 | 版本要求 | 依赖包要求 |
---|---|---|---|
1 | AIX | 6.02以上 | - |
2 | HP-UX | 11.23以上 | - |
3 | Solaris | 11以上 | - |
4 | CentOS | 7.0以上 | 依赖包版本不低于以下版本: unzip 6.00 java 1.8.0_181 libaio-0.3.107-10.el6.x86_64 libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64 ncurses-5.7-3.20090208.el6.x86_64 pam-1.1.1-10.el6.x86_64 |
5 | RedHat | 7.0以上 | |
6 | SUSE | 11以上 | |
7 | Asianux | 9.0以上 | |
8 | Debian | 10以上 | |
9 | Ubuntu | 16以上 | |
10 | Kylin | V10以上 | |
11 | UOS | V20以上 |
使用以下命令检查是否设少相关包:
rpm -qa |grep unzip
rpm -qa |grep java
rpm -qa |grep libaio
rpm -qa |grep libgcc
rpm -qa |grep libstdc
rpm -qa |grep ncurses
rpm -qa |grep pam
如果缺少相应的,在有apt源或者yum源时,可直接安装。如,使用yum安装:
yum -y install unzip java-1.8.0-openjdk glibc-devel ncurses-libs libnsl libaio
1.3、系统配置要求
内核参数要求
root用户执行ipcs -l检查系统内核参数,输出要求不小于以下值:
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 4294967296
max total shared memory (kbytes) = 4398046511104
min seg size (bytes) = 1
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
如小于以上配置,修改/etc/sysctl.conf,修改完成后sysctl -p生效:
cat <<! >>/etc/sysctl.conf
kernel.shmmax=4398046511104
kernel.shmall=4294967296
kernel.shmmin=4096
kernel.sem=250 32000 32 128
!
sysctl -p
调整ulimit相关参数:
cat <<! >>/etc/security/limits.conf
* soft nproc 65536
* hard nproc 65536
* soft nofile 1048576
* hard nofile 1048576
!
如果用户nofile和nproc设置值不生效,需要修改/etc/systemd/system.conf配置文件:
sed -i "s/#DefaultLimitNOFILE.*/DefaultLimitNOFILE=1048576/g" /etc/systemd/system.conf
sed -i "s/#DefaultLimitNPROC.*/DefaultLimitNPROC=65536/g" /etc/systemd/system.conf
系统防火墙要求
系统防火墙需关闭或放开数据库监听端口9088,关闭系统防火墙:
systemctl stop firewalld.service
systemctl disable firewalld.service
如系统要求不可关闭防火墙,执行以下命令放开相关端口,单机放开9088,集群放开9088、9099、9200、9300:
firewall-cmd --permanent --zone=public --add-port=9088/tcp
firewall-cmd --permanent --zone=public --add-port=9099/tcp
firewall-cmd --permanent --zone=public --add-port=9200/tcp
firewall-cmd --permanent --zone=public --add-port=9300/tcp
firewall-cmd --reload
系统DNS配置要求
如无特殊需求,要求修改系统DNS配置,避免出现数据库连接缓慢现象:
sed -i "s#^hosts.*#hosts: files#g" /etc/nsswitch.conf
如不存在/etc/nsswitch.conf文件,则忽略此步。
emoveIPC配置要求
RemoveIPC在7.x以上部分版本Linux默认配置为yes,要求配置为no,避免出现信号量被删除导致数据库宕机:
#检查当前配置,如显示为yes需修改配置关闭RemoveIPC
loginctl show-session | grep RemoveIPC
#修改配置文件
sed -i "s/^#RemoveIPC.*/RemoveIPC=no/g" /etc/systemd/logind.conf
#重启服务
systemctl daemon-reload
systemctl restart systemd-logind
主机名配置
数据库日志归档及数据库备份文件命名均依赖系统主机名称,如现场主机命名无已有规范,数据库服务器命名参照dbhost[xx]规则命名,xx为两位数字序号,如:
echo "dbhost01">/etc/hostname
hostname dbhost01
同时修改/etc/hosts文件,修改对应IP的机器名,如:
10.10.10.10 dbhost01
如计划配置集群心跳,集群心跳机器名参照dbhahost[xx]规则命名,xx为两位数字序号,如在/etc/hosts中配置:
192.168.1.1 dbhahost01
统时钟同步
配置时钟同步,修改对应IP(10.10.10.10)为NTP服务器IP:
sed -i "s/^server.*/#&/g" /etc/chrony.conf
sed -i "s/#hwtimestamp.*/hwtimestamp */g" /etc/chrony.conf
sed -i "s/#local stratum.*/local stratum 10/g" /etc/chrony.conf
sed -i "/#server 3.*/a server 10.10.10.10 iburst" /etc/chrony.conf
启动时钟同步服务:
systemctl enable chronyd.service
systemctl start chronyd.service
查看同步状态:
systemctl status chronyd.service
timedatectl && date && hwclock
ELINUX配置要求
修改/etc/selinux/config配置文件,修改SELINUX的值为disabled,重启系统:
sed -i "s#^SELINUX=.*#SELINUX=disabled#g" /etc/selinux/config
reboot
改系统时钟
#修改硬件时间
hwclock --set --date “2023-02-22 19:10:30”
#同步系统时间和硬件时间
hwclock --hctosys
#保存时钟
clock -w
#重启系统
reboot
1.3、数据库软件命名规则及下载
安装包命名规则
序号 | 类型 | 安装包命名 | 备注 |
---|---|---|---|
1 | server安装包 | 命名规则: GBase8sV8.[x]_[AEE|TL]_[x.x.x_x]_[hashid]_[os]_[cpu].tar 示例1:在RHEL6+x86_64平台编译的版本,适用于x86平台 GBase8sV8.8_AEE_3.3.0_2_36477d_RHEL6_x86_64.tar 示例2:在Kylin10_FT2000PLUS 平台编译的版本,适用于飞腾平台 GBase8sV8.8_AEE_3.3.0_2_0971827_Kylin10_FT2000PLUS.tar 示例3:在CentOS7_KP920平台编译的版本,适用于鲲鹏平台 GBase8sV8.8_AEE_3.3.0_2X4_1_025862_CentOS7_KP920.tar 数据库server安装包包含数据库所有功能,包括高可用相关组件,AEE为生产版本,TL为试用版本,试用期限1年,如无特殊要求,建议使用GBase8sV8.8_AEE_3.3.0以上版本 | 如未使用SSC共享磁盘集群且要求自动切换,下载本安装包安装即可,无需安装其他组件。 |
2 | csdk安装包 | 命名规则: clientsdk_[x.x.x_x]_[hashid]_[os]_[cpu].tar 示例1:在RHEL6+x86_64平台编译的版本,适用于x86平台 clientsdk_3.3.0_2_36477d_RHEL6_x86_64.tar 示例2:在Kylin10_FT2000PLUS 平台编译的版本,适用于飞腾平台 clientsdk_3.3.0_2_097182_Kylin10_FT2000PLUS.tar 示例3:在CentOS7_KP920平台编译的版本,适用于鲲鹏平台 clientsdk_3.3.0_2X4_1_025862_CentOS7_KP920.tar csdk安装包包含数据库c、odbc等接口,如应用系统使用了这些接口连接数据库,需在应用服务器安装csdk,csdk也包含了连接管理器组件,如数据库集群需要使用连接管理器仲裁切换,需要安装csdk。csdk不区分生产和试用版本,csdk版本要求与server版本严格匹配一致使用,即hashid和server一致。 | 如使用SSC共享磁盘集群且要求自动切换,需安装csdk。 |
3 | jdbc驱动 | 命名规则: gbasedbtjdbc_[x.x.x_x]_[hashid].jar 示例1: gbasedbtjdbc_3.3.0_2_36477d.jar jdbc驱动版本要求与server版本严格匹配一致使用,即hashid和server一致。jdbc不区分生产和试用版本。 |
获取安装包
GBase8sV8.8_AEE_3.5.0_3X1_ea855d_RHEL6_x86_64.tar【SERVER,高级企业版无任何限制】
[MD5:002739ae719c2132bb025b314c96b360]
2、安装数据库
2.1、创建数据库用户【gbasedbt】
使用【root】创建【gbaesdbt】用户,默认密码【GBase123】,部分系统存在安全加固策略,需使用符合规则的密码:
groupadd gbasedbt -g 500
useradd gbasedbt -u 500 -g gbasedbt -m -d /home/gbasedbt
echo "GBase123" | passwd --stdin gbasedbt
2.2、解压安装介质
使用【root】解压:
tar -xvf GBase8s*.tar
2.3、开始安装
使用【root】安装,安装到路径【/opt/gbase】:
./ids_install
Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
Launching installer...
===============================================================================
GBase Software Bundle (created with InstallAnywhere)
-------------------------------------------------------------------------------
Preparing CONSOLE Mode Installation...
===============================================================================
Getting Started
---------------
This application will guide you through the installation of GBase Software
Bundle.
Copyright General Data Corporation 2014, 2021. All rights reserved.
1. Release Notes
The Release Notes can be found in /root/doc/ids_unix_relnotes_12.10.html.
2. Launch Information Center
Access the GBase Information Center at http://www.gbase.cn.
To Begin Installation, respond to each prompt to proceed to the next step in
the installation.
If you want to change something on a previous step, type 'back'.
You may cancel this installation at any time by typing 'quit'.
PRESS <ENTER> TO CONTINUE: 回车
===============================================================================
License Agreement
-----------------
Installation and Use of GBase Software Bundle Requires Acceptance of the
Following License Agreement:
Thank you for choosing GBase product!
Please read carefully the following licencing agreement before installing any
product: TIANJIN GENERAL DATA TECHNOLOGY CO. LTD. LICENSE AGREEMENT
READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSETERMS
(COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWAREMEDIA PACKAGE.
BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS
AGREEMENT. IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR
ACCEPTANCE OF THESE TERMS. IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY
RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND.
1. LICENSE TO USE. GeneralData grants you a non-exclusive and non-transferable
license for the internal use only of the accompanying software and
documentation and any error corrections provided by GeneralData(collectively
"Software"), by the number of users and the class of computer hardware for
which the corresponding fee has been paid.
2. RESTRICTIONS. Software is confidential and copyrighted. Title to Software
PRESS <ENTER> TO CONTINUE: 回车
and all associated intellectual property rights is retained by GeneralData
and/or its licensors. Except as specifically authorized in any Supplemental
License Terms, you may not make copies of Software, other than a single copy
of Software for archival purposes. Unless enforcement is prohibited by
applicable law, you may not modify, decompile, or reverse engineer Software.
You acknowledge that Software is not designed, licensed or intended for use in
the design, construction, operation or maintenance of any nuclear facility.
GeneralData disclaims any express or implied warranty of fitness for such
uses. No right, title or interest in or to any trademark, service mark, logo or
trade name of GeneralData or its licensors is granted under this Agreement.
3. DISCLAIMER OF WARRANTY. Unless specified in this agreement, all express of
implied conditions, representations and warranties, including any implied
warranty of merchantability, fitness for aparticular purpose or
non-infringement are disclaimed, except to theextent that these disclaimers
are held to be legally invalid.
4. LIMITATION OF LIABILITY. To the extent not prohibited by law, in no event
will GeneralData or its licensors be liable for any lost revenue, profit or
data, or for special, indirect, consequential, incidental orpunitive damages,
however caused regardless of the theory of liability, arising out of or
related to the use of or inability to use software, even if GeneralData has
PRESS <ENTER> TO CONTINUE: 回车
been advised of the possibility of such damages. In no event will
GeneralData's libility to you, whether incontract, tort(including negligence),
or otherwise, exceed the amount paid by you for Software under this Agreement.
The foregoing limitations will apply even if the above stated warranty fails
of itsessential purpose.
5. TERMINATION. This Agreement is effective until terminated. You may terminate
this Agreement at any time by destroying all copies of Software. This
Agreement will terminate immediately without noticefrom GeneralData if you
fail to comply with any provision of this Agreement. Upon Termination, you
must destroy all copies of Software.
6. EXPORT REGULATIONS. All Software and technical data delivered under this
Agreement are subject to US export control laws and may be subject to export
or import regulations in other countries. You agree to comply strictly with
all such laws and regulations and acknowledge that you have the responsibility
to obtain such licenses to export, re-export, or import as may be required
after delivery to you.
7. CHINESE GOVERNMENT RESTRICTED. If Software is being acquired by or on behalf
PRESS <ENTER> TO CONTINUE: 回车
of the Chinese Government, then the Government's rights in Software and
accompanying documentation will be only as set forth in this Agreement.
8. GOVERNING LAW. Any action related to this Agreement will be governed by
Chinese law: "COPYRIGHT LAW OF THE PEOPLE'S REPUBLIC OF CHINA", "PATENT LAW OF
THE PEOPLE'S REPUBLIC OF CHINA", "TRADEMARK LAW OF THE PEOPLE'S REPUBLIC OF
CHINA", "COMPUTER SOFTWARE PROTECTION REGULATIONS OF THE PEOPLE'S REPUBLIC OF
CHINA". No choice of law rules of any jurisdiction will apply."
9. SEVERABILITY. If any provision of this Agreement is held to be
unenforceable, this Agreement will remain in effect with the provision
omitted, unless omission would frustrate the intent of the parties, in which
case this Agreement will immediately terminate.
10. INTEGRATION. This Agreement is the entire agreement between you and
GeneralData relating to its subject matter. It supersedes all prior or
contemporaneous oral or written communications, proposals, representations and
warranties and prevails over any conflicting or additional terms of any quote,
order, acknowledgment, or other communication between the parties relating to
its subject matter during the term of this Agreement. No modification of this
Agreement will be binding, unless in writing and signed by an authorize
depresentative of each party. When the translation document has the different
PRESS <ENTER> TO CONTINUE: 回车
meaning or has the conflicting views with Chinese original text conflict,
should take the laws and regulations promulgation unit as well as the
GeneralData issue Chinese original text as the standard.
All trademarks and registered trademarks mentioned herein are the property of
their respective owners.
DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): y
===============================================================================
Installation Location
---------------------
Choose location for software installation.
Default Install Folder: /opt/GBASE/gbase
ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
: /opt/gbase
INSTALL FOLDER IS: /opt/gbase
IS THIS CORRECT? (Y/N): y
===============================================================================
Installation or Distribution
----------------------------
Select the installation type.
Typical: Install the database server with all features and a database server
that
is configured with default values. Includes:
** Client Software Development Kit (CSDK)
** Java Database Connectivity (JDBC)
Minimum disk space required: 700-800MB
Custom: Install the database server with specific features and software that
you need.
Optionally install a configured database server instance.
Minimum disk space required: 75 MB (without a server instance)
->1- Typical installation
2- Custom installation
3- Extract the product files (-DLEGACY option)
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:: 回车
===============================================================================
Server Instance Creation
------------------------
Create a server instance?
->1- Yes - create an instance
2- No - do not create an instance
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT:: 2
===============================================================================
Installation Summary
--------------------
Please review the following before continuing:
Product Name:
GBase Software Bundle
Install Folder:
/opt/gbase
Product Features:
GBase database server,
Base Server,
Extensions and tools,
J/Foundation,
Database extensions,
Conversion and reversion support,
XML publishing,
Demonstration database scripts,
Enterprise Replication,
Data loading utilities,
onunload and onload utilities,
dbload utility,
Backup and Restore,
archecker utility,
ON-Bar utility,
Interface to Tivoli Storage Manager,
Administrative utilities,
Performance monitoring utilities,
Miscellaneous monitoring utilities,
Auditing utilities,
Database import and export utilities,
JSON Client Support,
Global Language Support (GLS),
Chinese
Disk Space Information (for Installation Target):
Required: 511,594,804 Bytes
Available: 28,167,393,280 Bytes
PRESS <ENTER> TO CONTINUE: 回车
===============================================================================
Ready To Install
----------------
InstallAnywhere is now ready to install GBase Software Bundle onto your system
at the following location:
/opt/gbase
PRESS <ENTER> TO INSTALL:
===============================================================================
Installing...
-------------
[==================|==================|==================|==================]
[------------------|------------------|------------------|------------------]
===============================================================================
Installation Complete
---------------------
Congratulations! GBase Software Bundle installation is complete.
Product install status:
GBase: Successful
GBase Connect: Successful
Main Version: GBase 8s V8.8
For more information about using GBase products, see the GBase Information
Center at http://www.gbase.cn.
PRESS <ENTER> TO EXIT THE INSTALLER:回车
3、初始化及优化实例
3.1、实例配置规范
序号 | 配置项 | 规范 | 示例 |
---|---|---|---|
1 | GBASEDBTDIR | /opt/gbase | |
2 | GBASEDBTSERVER | gbase[xx] | gbase01、gbase02 |
3 | DBSERVERALIASES | ha_[type][xx] | ha_pri、ha_ssc、ha_hac、ha_rhac,如有多个ssc备机或rhac备机,后面加上序号,如ha_ssc01、ha_rhac01 |
4 | ONCONFIG | onconfig.${GBASEDBTSERVER} | onconfig.gbase01 |
5 | GBASEDBTSQLHOSTS | $GBASEDBTDIR/etc/sqlhosts.${GBASEDBTSERVER} | sqlhosts.gbase01 |
6 | DB_LOCALE | zh_CN.utf8 | 默认使用utf8字符集 |
7 | CLIENT_LOCALE | zh_CN.utf8 | 默认使用utf8字符集 |
8 | GL_USEGLU | 1 | |
9 | 空间命名规则 | 根空间:rootdbs 物理日志空间:plogdbs 逻辑日志空间:llogdbs 临时空间:tempdbs[xx] 智能大对象空间:sbspace[xx] 数据空间:datadbs[xx] 索引空间:indxdbs[xx] 磁盘心跳空间:ssc_alt_comm | rootdbs plogdbs llogdbs tempdbs01、tempdbs02 sbspace01 datadbs01、datadbs02 indxdbs01 |
10 | 数据文件命名规则 | ${dbspacename}chk[xxx] | rootdbschk001 plogdbschk001 llogdbschk001 tempdbs01chk001 sbspace01chk001 datadbs01chk001 indxdbs01chk001 |
11 | 数据文件路径 | /data/gbase | |
12 | 备份磁盘路径 | /backup |
3.2、挂载数据盘【/data]
【root】用户格式化数据盘,并挂载到/data目录,将磁盘uid添加到/etc/fstab自动挂载,创建/data/gbase目录,用于存放数据文件:
mkfs.xfs /dev/vdb
blkid /dev/vdb
mkdir /data
mount /dev/vdb /data
mkdir /data/gbase
chown gbasedbt:gbasedbt /data/gbase
echo "UUID=158d0f4d-5606-4546-9b0a-6bddd97b1aeb /data xfs defaults 0 0>>/etc/fstab
3.3、配置【gbasedbt】用户环境变量
使用gbasedbt用户登录执行以下命令,设置数据库实例名为gbase[xx],xx为两位编号,如:gbase01,如为数据库集群,集群中实例节点按顺序以此规则命名。设置默认字符集为utf8编码:
#修改INSTANCE为实例名
INSTANCE=gbase01
cat >>.bash_profile << EOF
export GBASEDBTDIR=/opt/gbase
export GBASEDBTSERVER=${INSTANCE}
export ONCONFIG=onconfig.${INSTANCE}
export GBASEDBTSQLHOSTS=\$GBASEDBTDIR/etc/sqlhosts.${INSTANCE}
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
export GL_USEGLU=1
export PATH=\$GBASEDBTDIR/bin:/usr/bin:\${PATH}:.
EOF
source .bash_profile
3.4、配置【ONCONFIG】配置文件
使用gbasedbt用户登录执行以下命令,初始化数据库实例,以此配置参数初始化数据库,要求系统内存在16GB以上。
数据库总内存计算方法:
SHMVIRTSIZE (KB)+LOCKS144 (Byte)+BUFFERPOOL(sizebuffers) (KB)
以下配置共约占用内存4096000KB+10000000144B+16512000=4G+1.4G+8G=13.4G
如系统内存不足或系统内存充足,可适当调整BUFFERPOOL参数的buffers大小用于数据缓存,以充分利用系统资源,建议数据库总内存不超过系统内存的50%。
DATADIR=/data/gbase
NUMCPU=`onstat -g osi |awk /"online processors"/'{print $5}'`
cp $GBASEDBTDIR/etc/onconfig.std $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^ROOTPATH.*#ROOTPATH ${DATADIR}/rootdbschk001#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^ROOTSIZE.*#ROOTSIZE 2048000 #g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^DBSERVERNAME.*#DBSERVERNAME $GBASEDBTSERVER#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^NETTYPE.*#NETTYPE soctcp,8,100,NET#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^TAPEDEV.*#TAPEDEV /dev/null#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^LTAPEDEV.*#LTAPEDEV /dev/null#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^MULTIPROCESSOR.*#MULTIPROCESSOR 1#g" $GBASEDBTDIR/etc/$ONCONFIG;
sed -i "s#^CLEANERS.*#CLEANERS 32#g" $GBASEDBTDIR/etc/$ONCONFIG;
sed -i "s#^LOCKS.*#LOCKS 10000000#g" $GBASEDBTDIR/etc/$ONCONFIG;
sed -i "s#^DEF_TABLE_LOCKMODE.*#DEF_TABLE_LOCKMODE row#g" $GBASEDBTDIR/etc/$ONCONFIG;
sed -i "s#^DS_TOTAL_MEMORY.*#DS_TOTAL_MEMORY 4096000#g" $GBASEDBTDIR/etc/$ONCONFIG;
sed -i "s#^SHMVIRTSIZE.*#SHMVIRTSIZE 4096000#g" $GBASEDBTDIR/etc/$ONCONFIG;
sed -i "s#^SHMADD.*#SHMADD 2048000#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^STACKSIZE.*#STACKSIZE 2048#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^SBSPACENAME.*#SBSPACENAME sbspace01#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^DBSPACETEMP.*#DBSPACETEMP tempdbs01,tempdbs02,tempdbs03,tempdbs04#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^VPCLASS cpu.*#VPCLASS cpu,num=${NUMCPU},noage#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^TEMPTAB_NOLOG.*#TEMPTAB_NOLOG 1#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^NS_CACHE.*#NS_CACHE host=0,service=0,user=0,group=0#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^DUMPSHMEM.*#DUMPSHMEM 0#g" $GBASEDBTDIR/etc/$ONCONFIG
echo "BUFFERPOOL size=16k,buffers=512000,lrus=64,lru_min_dirty=50,lru_max_dirty=60">>$GBASEDBTDIR/etc/$ONCONFIG
3.5、配置【sqlhosts】监听文件
使用【gbasedbt】用户登录执行以下命令,修改IPADDR为实际IP(不修改则监听所有IP):
IPADDR=0.0.0.0
cp $GBASEDBTDIR/etc/sqlhosts.std $GBASEDBTSQLHOSTS
echo "$GBASEDBTSERVER onsoctcp ${IPADDR} 9088" >> $GBASEDBTSQLHOSTS
3.6、初始化实例
使用【gbasedbt】用户登录执行以下命令,初始化数据库实例:
DATADIR=/data/gbase
touch ${DATADIR}/rootdbschk001
chmod 660 ${DATADIR}/rootdbschk001
oninit -ivyw
3.7、创建物理日志空间并优化物理日志
使用【gbasedbt】用户登录执行以下命令,物理日志位置从【rootdbs】调整到【plogdbs】,大小【5G】,物理日志大小跟根据系统负荷情况而定,对于生产系统,要求不小于【5G】:
DATADIR=/data/gbase
touch ${DATADIR}/plogdbschk001
chmod 660 ${DATADIR}/plogdbschk001
#创建物理日志空间,大小5GB
onspaces -c -d plogdbs -p ${DATADIR}/plogdbschk001 -o 0 -s 5120000
#调整物理日志,将物理日志从rootdbs中转移到plogdbs,大小5GB:
onparams -p -d plogdbs -s 5000000 -y
3.8、创建逻辑日志空间并优化逻辑日志
使用【gbasedbt】用户登录执行以下命令,逻辑日志位置从【rootdbs】调整到【llogdbs】,共【100个】,每个大小【100MB】,总计【10GB】:
DATADIR=/data/gbase
#创建逻辑日志空间,大小10GB
touch ${DATADIR}/llogdbschk001
chmod 660 ${DATADIR}/llogdbschk001
onspaces -c -d llogdbs -p ${DATADIR}/llogdbschk001 -o 0 -s 10240000
#增加逻辑日志到llogdbs,增加100个,每个100MB,存放于llogdbs:
for i in `seq 10`;do onparams -a -d llogdbs -s 1000000;done
#切换当前逻辑日志到第七个以后,释放rootdbs中的前6个日志:
for i in `seq 7`;do onmode -l;done
#执行检查点:
onmode -c
#删除rootdbs中的6个逻辑日志:
for i in `seq 6`;do onparams -d -l $i -y;done
3.9、创建临时数据库空间
使用【gbasedbt】用户登录执行以下命令,创建4个临时空间,每个大小【10GB】,创建多个临时空间,部分操作可并行执行于各个临时空间,以提高效率。临时空间名称应与参数【DBSPACETEMP】配置保持一致,多个空间之间以英文逗号分隔,本文中配置参数【DBSPACETEMP】已配置为【tempdbs01,tempdbs02,tempdbs03,tempdbs04】:
DATADIR=/data/gbase
#创建四个临时空间,每个10GB
touch ${DATADIR}/tempdbs01chk001
touch ${DATADIR}/tempdbs02chk001
touch ${DATADIR}/tempdbs03chk001
touch ${DATADIR}/tempdbs04chk001
chmod 660 ${DATADIR}/tempdbs01chk001
chmod 660 ${DATADIR}/tempdbs02chk001
chmod 660 ${DATADIR}/tempdbs03chk001
chmod 660 ${DATADIR}/tempdbs04chk001
onspaces -c -d tempdbs01 -p ${DATADIR}/tempdbs01chk001 -o 0 -s 10240000 -k 16 -t
onspaces -c -d tempdbs02 -p ${DATADIR}/tempdbs02chk001 -o 0 -s 10240000 -k 16 -t
onspaces -c -d tempdbs03 -p ${DATADIR}/tempdbs03chk001 -o 0 -s 10240000 -k 16 -t
onspaces -c -d tempdbs04 -p ${DATADIR}/tempdbs04chk001 -o 0 -s 10240000 -k 16 -t
3.10、创建智能大对象空间
使用【gbasedbt】用户登录执行以下命令,智能大对象空间用于存储【blob、clob】数据类型,【SBSPACENAME】参数指定默认智能大对象空间,创建的智能大对象空间名称应与此参数值一致,本文中配置参数【SBSPACENAME】已配置为【sbspace01】:
DATADIR=/data/gbase
#创建智能大对象数据库空间,大小10GB,如未使用blob、clob数据类型,可不创建
touch ${DATADIR}/sbspace01chk001
chmod 660 ${DATADIR}/sbspace01chk001
onspaces -c -S sbspace01 -p ${DATADIR}/sbspace01chk001 -o 0 -s 10240000 -Df "LOGGING = ON"
3.11、创建用户数据库空间
使用【gbasedbt】用户登录执行以下命令,创建数据库空间【datadbs01】,用于存放用户数据,该空间页大小为【16KB】,总大小【100GB】:
DATADIR=/data/gbase
touch ${DATADIR}/datadbs01chk001
chmod 660 ${DATADIR}/datadbs01chk001
onspaces -c -d datadbs01 -p ${DATADIR}/datadbs01chk001 -o 0 -s 102400000 -k 16
3.12、创建默认数据库
使用【gbasedbt】用户登录执行以下命令,创建默认数据库【gbasedb】,数据存储于【datadbs01】空间:
dbaccess - -<<!
create database gbasedb in datadbs01 with log;
!
4、配置备份
如采购了第三方备份设备,由第三方备份厂商支持备份实施,如未采购第三方备份设备,按以下步骤对数据库实施备份,如开发测试环境,可不配置备份。
挂载备份盘(备份盘尽量不与数据盘存放同一存储设备),【root】用户执行,UUID修改为blkid命令的输出ID,如没有单独备份盘,在数据盘【/data】下创建目录存放备份数据:
#有备份盘,参考以下配置命令:
mkfs.xfs /dev/vdc
blkid /dev/vdc
mkdir /backup
mount /dev/vdc /backup
chown gbasedbt:gbasedbt /backup
chmod 775 /backup
echo " UUID=158d0f4d-5606-4546-9b0a-6bddd97b1aeb /data xfs defaults 0 0>>/etc/fstab
#无单独备份盘,参考以下配置命令
mdir -p /data/backup
chown gbasedbt:gbasedbt /data/backup
chmod 775 /data/backup
【gbasedbt】用户调整备份参数:
BACKUPDIR=/backup
onmode -wf TAPEDEV=$BACKUPDIR
onmode -wf LTAPEDEV=$BACKUPDIR
onmode -wf TAPEBLK=2048
onmode -wf LTAPEBLK=2048
sed -i "s#^ALARMPROGRAM.*#ALARMPROGRAM \$GBASEDBTDIR/etc/log_full.sh#g" $GBASEDBTDIR/etc/$ONCONFIG
sed -i "s#^BACKUP_CMD.*#BACKUP_CMD=\"ontape -a -d\" #g" $GBASEDBTDIR/etc/log_full.sh
onmode -ky
oninit -v
【gbasedbt】用户执行以下命令生成备份脚本【backup.sh】:
cat <<! >/opt/gbase/etc/backup.sh
#!/bin/bash
. /home/gbasedbt/.bash_profile
onstat - |grep "On-Line" >/dev/null
if [ \$? -ne 1 ]
then
DATE=\`date\`
echo "Level 0 backup of "\$GBASEDBTSERVER" strat at "\$DATE
ontape -s -L 0
DATE=\`date\`
echo "Level 0 backup of "\$GBASEDBTSERVER" completed at "\$DATE
find /backup -mtime +7 -type f ! -name *.sh ! -name *.log |xargs rm -rf
fi
exit 0
!
chmod 775 /opt/gbase/etc/backup.sh
【gbasedbt】用户执行【crontab -e】部署以下定时任务,【backup.sh】每天0点执行0级备份,删除7天以前备份:
0 0 * * * /opt/gbase/etc/backup.sh >>/opt/gbase/tmp/backup.log 2>&1
如【gbasedbt】用户无crontab权限,使用【root】添加:【echo "gbasedbt">>/etc/cron.allow】
更多安装规范,下载【T_GBase 8s数据库安装规范_20240112_LFL.docx】
评论


热门帖子
- 12023-05-09浏览数:16913
- 22020-05-11浏览数:10343
- 32019-04-26浏览数:10327
- 42023-09-25浏览数:9754
- 52023-07-04浏览数:9544