1.GBase 8s介绍及安装要求
在2021年7月,我第一次接触GBase数据库,被它高效、稳定的性能所吸引。并通过使用和学习逐渐掌握了相关的知识和技能。在2021年8月,我取得了GBase 8a 数据库管理工程师GDCA认证,这使我更加自信和专业地运用GBase数据库。在随后的一个月中,我又取得了GBase 8s数据库管理工程师GDCA认证,这进一步增强了我在GBase数据库方面的专业能力和实践经验。在本文中,我将为读者提供一份详细的GBase 8s安装指南,希望这篇文章能够帮助读者更好地了解和使用这个强大的数据库系统。
GBase 8s是南大通用数据技术股份有限公司自主研发的成熟数据库集群,基于共享存储,具备高容量、高并发、高性能等特点。产品符合安全数据库四级标准(国际B2),支持SQL92/99、ODBC、JDBC、ADO.NET、GCI(OCI/OCCI)、Python接口等规范和开发接口,并且支持集中式部署、共享存储高可用部署、两地三中心高可用部署。
GBase 8s适用于OLTP场景,包括金融、电信行业、党政、国防等行业信息系统,以及大型企业的管理和经营类信息系统。它能够提供7*24小时不间断运行处理能力,在很多场景中可以替代国际主流数据库。
1.1硬件要求
在实际生产环境中,GBase 8s硬件要求如下,在个人测试、学习中,可以降低要求,根据个人服务器资源进行配置。
1.2系统要求
GBase 8s产品支持多种处理器平台,不仅支持国际主流的x86_64处理器(包括Intel和AMD),还全面支持中国自主研发的飞腾、鲲鹏、龙芯、兆芯、海光、申威等国产处理器。此外,GBase 8s产品可以在多个操作系统上运行,其中包括RHEL和CentOS等Linux操作系统,以及国产操作系统统信UOS、麒麟、欧拉等。
2.安装环境介绍
本文采用CentOS 7.6操作系统,进行GBase 8s数据库安装,具体环境如下:
--查看系统版本
[root@vip ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@vip ~]#
复制
--检查服务器磁盘空间大小
[root@vip ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 46G 20G 27G 43% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 12K 1.9G 1% /dev/shm
tmpfs 1.9G 84M 1.8G 5% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 297M 157M 140M 53% /boot
tmpfs 378M 40K 378M 1% /run/user/0
overlay 46G 20G 27G 43% /root/data/docker/overlay2/6ab345bd95d9ecfedfb79791587af5355a673f17abd744916f25c5152592d8df/merged
[root@vip ~]#
复制
--查看内存情况
[root@vip ~]# free -g
total used free shared buff/cache available
Mem: 4 0 3 0 0 3
Swap: 3 0 3
[root@vip ~]#
复制
3.安装准备
3.1创建 gbasedbt 组和用户
在启动GBase 8s的安装过程之前,需要先准备好系统并具有足够的权限来执行安装。为了完成与安装相关的任务,必须使用root用户登录,并确保服务器操作系统上存在gbasedbt组和gbasedbt用户。登录系统后执行以下命令创建 gbasedbt 组和 gbasedbt 用户:
--创建gbasedbt 组和 gbasedbt 用户
[root@vip ~]# groupadd gbasedbt
[root@vip ~]# useradd -g gbasedbt gbasedbt
--为 gbasedbt 用户设置密码,密码为 gbasedbt:
[root@vip ~]# passwd gbasedbt
Changing password for user gbasedbt.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.
[root@vip ~]#
复制
3.2创建 GBase 8s 数据库安装目录
GBase 8s 数据库缺省的安装目录为 /opt/GBASE/gbase,并且此文件夹必须为空。执行以下命令创建GBase 8s安装目录并将目录属主改为gbasedbt:
[root@vip ~]# mkdir -p /opt/GBASE/gbase
[root@vip ~]# chown gbasedbt:gbasedbt /opt/GBASE/gbase
[root@vip ~]#
[root@vip ~]# ll /opt/GBASE/
total 0
drwxr-xr-x. 2 gbasedbt gbasedbt 6 Apr 24 11:13 gbase
[root@vip ~]#
复制
3.3上传并解压安装包
在本文中,以GBase8s_ExpressEdition-202108.tar为例进行安装说明。将软件包上传到/opt/soft目录下并解压。
[root@vip ~]# cd /opt/soft
[root@vip soft]# ll
total 309272
-rw-r--r--. 1 root root 316692480 Apr 24 13:36 GBase8s_ExpressEdition-202108.tar
[root@vip soft]# tar -vxf GBase8s_ExpressEdition-202108.tar
doc/
doc/ids_machine_notes_12.10.txt
doc/ids_unix_relnotes_12.10.html
ids.properties
ids_install
onsecurity
.gbase.properties
[root@vip soft]# ll
total 618520
drwxr-xr-x. 2 vip vip 77 Mar 23 2021 doc
-rw-r--r--. 1 root root 316692480 Apr 24 13:36 GBase8s_ExpressEdition-202108.tar
-rwxr-xr-x. 1 vip vip 316579352 Mar 23 2021 ids_install
-rw-r--r--. 1 vip vip 1864 Mar 23 2021 ids.properties
-rwxr-xr-x. 1 vip vip 82738 Mar 23 2021 onsecurity
[root@vip soft]#
复制
至此,安装环境已准备就绪。接下来,我将演示两种不同的GBase 8s安装方式:命令行典型安装和图形化定制安装。我希望通过这次演示,让各位读者熟悉这两种安装方式,并充分利用GBase 8s所提供的优势。请耐心阅读,谢谢。
4.典型安装GBase 8s(命令行方式)
对于GBase 8s数据库的安装,用户可以选择两种方式进行:图形界面方式或命令行方式。默认情况下,安装程序使用的是命令行方式进行。如果需要使用图形界面安装,则只需在启动安装程序时添加参数./ids_install -i swing,并且必须保证你的连接工具支持图形化。
进入/opt/soft目录并以root用户身份运行安装命令ids_install即可启动安装程序。在执行安装过程中,安装程序会先检查系统环境。如果系统没有安装JDK,那么安装包会先解压JDK并自动安装到该系统中。如果已经安装JDK,则会显示产品的授权条款,并等待确认是否接受这些版权条款。
[root@vip ~]# cd /opt/soft
[root@vip soft]# ls
doc GBase8s_ExpressEdition-202108.tar ids_install ids.properties onsecurity
[root@vip soft]# sh 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, 2023. All rights reserved.
1. Release Notes
The Release Notes can be found in /opt/soft/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 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 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 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 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 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 TO ACCEPT THE DEFAULT
:
--根据界面提示确认默认安装路径 /opt/GBASE/gbase,按回车键继续安装
===============================================================================
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 TO ACCEPT THE DEFAULT::
--使用默认安装选项 1(即为典型安装方式),然后直接回车,进行安装
===============================================================================
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 TO ACCEPT THE DEFAULT::
--系统提示是否创建一个实例,默认选项 1 为创建,这里直接回车,创建一个实例
===============================================================================
Configuration - Number of Users
-------------------------------
Select the number of expected database users.
->1- 1 - 100
2- 101 - 500
3- 501 - 1000
4- 1000+
ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS TO ACCEPT THE DEFAULT::
--选择实例预期要支持的数据库用户数,根据实际需求进行选择,默认选项为 1,此处选择默认,然后直接回车继续安装
===============================================================================
Ready To Install
----------------
InstallAnywhere is now ready to install GBase Software Bundle onto your system
at the following location:
/opt/GBASE/gbase
PRESS TO INSTALL:
--配置结束,点击回车进行安装
===============================================================================
Installing...
-------------
[==================|==================|==================|==================]
[------------------|------------------|------------------|------------------]
===============================================================================
Server Initialization
---------------------
The server will now be initialized. Initialization might take quite a while,
depending on the performance of your computer.
PRESS TO CONTINUE:
--安装后会提示将进行数据库实例的初始化,按回车继续
===============================================================================
Using the new instance
----------------------
A database server instance was created. If you chose to initialize the
instance, it is ready to use.
You can open a command prompt to an initialized instance by running one of the
following commands at /opt/GBASE/gbase, where ol_gbasedbt1210 is the path or
filename of the instance.
Windows:
ol_gbasedbt1210.cmd
UNIX csh:
source ol_gbasedbt1210.csh
UNIX ksh or bourne:
./ol_gbasedbt1210.ksh
If initialization fails, check the online.log file for messages. The instance's
root chunk must be owned by the correct user and group, and it must have
readable and writable (rw) permission bits set only for owner and group.
PRESS TO CONTINUE:
--安装完成,回车后退出安装程序,完成本次安装
===============================================================================
Installation Complete
---------------------
Congratulations! GBase Software Bundle installation is complete.
Product install status:
GBase: Successful
GBase Connect: Successful
Main Version: GBase 8s Express Edition
For more information about using GBase products, see the GBase Information
Center at http://www.gbase.cn.
PRESS TO EXIT THE INSTALLER:
[root@vip soft]#
复制
至此,GBase 8s 命令行方式典型安装成功。
5.配置环境变量
在使用 GBase 8s 数据库服务前需要设置几个环境变量。可以把安装目录下的ol_gbasedbt1210.ksh 文件的内容追加到 gbasedbt 用户主目录下的 .bash_profile文件中,以便于 gbasedbt 用户在登录后即自动应用这些环境变量。注意,此处的ol_gbasedbt1210.ksh为安装过程中Server Instance Creation步骤创建的数据库实例文件,所以在定制化安装过程中,该文件名称会发生变化。
[root@vip soft]# cd /opt/GBASE/gbase/
[root@vip gbase]# ls
aaodir etc gls ol_gbasedbt1210.csh SDK
bin extend incl ol_gbasedbt1210.ksh ssl
dbssodir GBase_GLS_Install_04_24_2023_13_58_45.log isa ol_gbasedbt1210.log storage
demo GBase_Install_04_24_2023_13_58_52.log lib release tmp
doc GBase_Software_Bundle_Install_04_24_2023_13_58_38.log msg RUNasroot.installserver uninstall
--查看ol_gbasedbt1210.ksh配置文件内容
[root@vip gbase]# cat ol_gbasedbt1210.ksh
GBASEDBTDIR=/opt/GBASE/gbase
GBASEDBTSERVER=ol_gbasedbt1210
ONCONFIG=onconfig.ol_gbasedbt1210
GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.ol_gbasedbt1210
GL_USEGLU=1
PATH=${GBASEDBTDIR}/bin:${GBASEDBTDIR}/extend/krakatoa/jre/bin:${PATH}
export GBASEDBTDIR GBASEDBTSERVER ONCONFIG GBASEDBTSQLHOSTS GL_USEGLU PATH
--切换到gbasedbt用户,查看当前配置文件内容
[root@vip gbase]# su - gbasedbt
[gbasedbt@vip ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
[gbasedbt@vip ~]$ exit
logout
[root@vip gbase]#
复制
[root@vip gbase]# pwd
/opt/GBASE/gbase
[root@vip gbase]# ls
aaodir etc gls ol_gbasedbt1210.csh SDK
bin extend incl ol_gbasedbt1210.ksh ssl
dbssodir GBase_GLS_Install_04_24_2023_13_58_45.log isa ol_gbasedbt1210.log storage
demo GBase_Install_04_24_2023_13_58_52.log lib release tmp
doc GBase_Software_Bundle_Install_04_24_2023_13_58_38.log msg RUNasroot.installserver uninstall
--将 GBase 8s 安装目录下的 ol_gbasedbt1210.ksh 文件的内容追加到 gbasedbt 用户主目录下的 .bash_profile 文件中
[root@vip gbase]# cat ol_gbasedbt1210.ksh >> /home/gbasedbt/.bash_profile
[root@vip gbase]# cd /home/gbasedbt/
--进入到gbasedbt用户下执行source .bash_profile命令使配置文件生效
[root@vip gbasedbt]# source .bash_profile
[root@vip gbasedbt]# su - gbasedbt
Last login: Mon Apr 24 14:21:09 CST 2023 on pts/1
--查看gbasedbt用户下配置文件
[gbasedbt@vip ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
GBASEDBTDIR=/opt/GBASE/gbase
GBASEDBTSERVER=ol_gbasedbt1210
ONCONFIG=onconfig.ol_gbasedbt1210
GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.ol_gbasedbt1210
GL_USEGLU=1
PATH=${GBASEDBTDIR}/bin:${GBASEDBTDIR}/extend/krakatoa/jre/bin:${PATH}
export GBASEDBTDIR GBASEDBTSERVER ONCONFIG GBASEDBTSQLHOSTS GL_USEGLU PATH
[gbasedbt@vip ~]$
复制
配置完毕后,即可正常使用 GBase 8s 数据库。
6.使用 GBase 8s 数据库
6.1检查数据库运行状态
通常情况下,使用 gbasedbt 用户来启动和停止数据库服务。成功安装数据库 GBase 8s 后,数据库会自动处于启动状态,会运行名称为oninit的进程,可通过 ps -ef|grep oninit 命令检查服务进程是否存在:
[root@vip ~]# ps -ef|grep oninit
gbasedbt 11114 1 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 11126 11114 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 11141 11126 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 11146 11126 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 11163 11126 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 11168 11126 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 11173 11126 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 11179 11126 0 14:00 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 16102 114275 0 14:31 pts/1 00:00:00 grep --color=auto oninit
[root@vip ~]#
复制
使用onstat命令,查看数据库运行状态,此命令执行成功的前提是环境变量配置成功。
[root@vip ~]# su - gbasedbt
Last login: Mon Apr 24 14:21:51 CST 2023 on pts/1
[gbasedbt@vip ~]$ onstat -
Your evaluation license will expire on 2024-04-23 00:00:00
On-Line -- Up 00:35:26 -- 175748 Kbytes
[gbasedbt@vip ~]$
复制
6.2关闭数据库并检查数据库运行状态
以 gbasedbt 用户身份登录后,输入 onmode -ky,可停止数据库服务,示例如下:
[gbasedbt@vip ~]$ onmode -ky
Your evaluation license will expire on 2024-04-23 00:00:00
--使用onstat命令查看数据库状态,显示共享内存没有初始化,数据库处于离线状态。
[gbasedbt@vip ~]$ onstat -
Your evaluation license will expire on 2024-04-23 00:00:00
shared memory not initialized for GBASEDBTSERVER 'ol_gbasedbt1210'
--使用ps命令查看数据库的进程信息,发现没有oninit进程存在。
[gbasedbt@vip ~]$ ps -ef|grep oninit
gbasedbt 16833 16565 0 14:37 pts/1 00:00:00 grep --color=auto oninit
[gbasedbt@vip ~]$
复制
6.3启动数据库并检查数据库运行状态
输入 oninit -vy,启动数据库服务,示例如下:
[gbasedbt@vip ~]$ oninit -vy
Your evaluation license will expire on 2024-04-23 00:00:00
Warning: Parameter's user-configured value was adjusted. (DS_MAX_SCANS)
Warning: Parameter's user-configured value was adjusted. (ONLIDX_MAXMEM)
Reading configuration file '/opt/GBASE/gbase/etc/onconfig.ol_gbasedbt1210'...succeeded
Creating /GBASEDBTTMP/.infxdirs...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 8310 kbytes...succeeded
Creating infos file "/opt/GBASE/gbase/etc/.infos.ol_gbasedbt1210"...succeeded
Linking conf file "/opt/GBASE/gbase/etc/.conf.ol_gbasedbt1210"...succeeded
Initializing rhead structure...rhlock_t 16384 (512K)... rlock_t (5312K)... Writing to infos file...succeeded
Initialization of Encryption...succeeded
Initializing ASF...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Bringing up ADM VP...succeeded
Creating VP classes...succeeded
Forking main_loop thread...succeeded
Initializing DR structures...succeeded
Forking 1 'soctcp' listener threads...succeeded
Forking 1 'soctcp' listener threads...succeeded
Forking 1 'soctcp' listener threads...succeeded
Starting tracing...succeeded
Initializing 2 flushers...succeeded
Initializing SDS Server network connections...succeeded
Initializing log/checkpoint information...succeeded
Initializing dbspaces...succeeded
Opening primary chunks...succeeded
Validating chunks...succeeded
Initialize Async Log Flusher...succeeded
Starting B-tree Scanner...succeeded
Init ReadAhead Daemon...succeeded
Init DB Util Daemon...succeeded
Initializing DBSPACETEMP list...succeeded
Init Auto Tuning Daemon...succeeded
Checking database partition index...succeeded
Initializing dataskip structure...succeeded
Checking for temporary tables to drop...succeeded
Updating Global Row Counter...succeeded
Forking onmode_mon thread...succeeded
Creating periodic thread...succeeded
Creating periodic thread...succeeded
Starting scheduling system...succeeded
Verbose output complete: mode = 5
[gbasedbt@vip ~]$
复制
继续输入 ps -ef|grep oninit 检查数据库服务进程是否存在:
--使用ps命令查看数据库的进程信息,oninit进程存在
[gbasedbt@vip ~]$ ps -ef|grep oninit
gbasedbt 16986 1 0 14:38 ? 00:00:00 oninit -vy
root 16989 16986 0 14:38 ? 00:00:00 oninit -vy
root 16990 16989 0 14:38 ? 00:00:00 oninit -vy
root 16993 16989 0 14:38 ? 00:00:00 oninit -vy
root 16996 16989 0 14:38 ? 00:00:00 oninit -vy
root 16999 16989 0 14:38 ? 00:00:00 oninit -vy
root 17002 16989 0 14:38 ? 00:00:00 oninit -vy
root 17005 16989 0 14:38 ? 00:00:00 oninit -vy
gbasedbt 17479 16565 0 14:41 pts/1 00:00:00 grep --color=auto oninit
--使用onstat命令查看数据库状态,当前数据库处于OnLine状态
[gbasedbt@vip ~]$ onstat -
Your evaluation license will expire on 2024-04-23 00:00:00
On-Line -- Up 00:04:19 -- 175748 Kbytes
[gbasedbt@vip ~]$
复制
7.定制安装GBase 8s(图形界面方式)
完成本文第三章节安装环境准备后,开始进行图形化界面安装,采用xstart工具进行图形化界面安装。具体说明见安装截图。
--进入到存放软件包目录,执行./ids_install -i swing启动图形化界面安装方式
[root@vip ~]# cd /opt/soft
[root@vip soft]# ls
doc GBase8s_ExpressEdition-202108.tar ids_install ids.properties onsecurity
[root@vip soft]# ./ids_install -i swing
复制
如果数据库服务器配置为支持 DRDA 协议,则会自动创建 Metadata 和 sqlcaMessage 例程。SYSDbOpen 和 SYSDbClose 例程可以在任一 GBase 8s 数据库中定义。
服务器现在将被初始化。 初始化可能需要一段时间,具体取决于计算机的性能。
安装完成后,重复本文章节5配置环境变量操作,如此才能正常使用数据库服务器。
[root@vip ~]# cd /opt/GBASE/gbase/
[root@vip gbase]# ls
aaodir etc incl SDK vip8s.ksh
backups extend isa ssl vip8s.log
bin GBase_GLS_Install_04_25_2023_11_00_54.log lib storage
dbssodir GBase_Install_04_25_2023_11_01_02.log msg tmp
demo GBase_Software_Bundle_Install_04_25_2023_11_00_45.log release uninstall
doc gls RUNasroot.installserver vip8s.csh
[root@vip gbase]# cat vip8s.ksh
GBASEDBTDIR=/opt/GBASE/gbase
GBASEDBTSERVER=vip8s
ONCONFIG=onconfig.vip8s
GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.vip8s
GL_USEGLU=1
PATH=${GBASEDBTDIR}/bin:${GBASEDBTDIR}/extend/krakatoa/jre/bin:${PATH}
export GBASEDBTDIR GBASEDBTSERVER ONCONFIG GBASEDBTSQLHOSTS GL_USEGLU PATH
[root@vip gbase]# cat vip8s.ksh >> /home/gbasedbt/.bash_profile
[root@vip gbase]# cd /home/gbasedbt/
[root@vip gbasedbt]# source .bash_profile
[root@vip gbasedbt]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
GBASEDBTDIR=/opt/GBASE/gbase
GBASEDBTSERVER=vip8s
ONCONFIG=onconfig.vip8s
GBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.vip8s
GL_USEGLU=1
PATH=${GBASEDBTDIR}/bin:${GBASEDBTDIR}/extend/krakatoa/jre/bin:${PATH}
export GBASEDBTDIR GBASEDBTSERVER ONCONFIG GBASEDBTSQLHOSTS GL_USEGLU PATH
[root@vip gbasedbt]#
复制
配置环境变量后,执行onstat -和ps -ef|grep oninit检查数据库状态及运行情况。
[root@vip ~]# su - gbasedbt
Last login: Tue Apr 25 13:47:11 CST 2023 on pts/3
[gbasedbt@vip ~]$ onstat -
Your evaluation license will expire on 2024-04-24 00:00:00
On-Line -- Up 02:42:53 -- 175748 Kbytes
[gbasedbt@vip ~]$ ps -ef|grep oninit
gbasedbt 25062 1 0 11:04 ? 00:00:01 /opt/GBASE/gbase/bin/oninit -ivwy
root 25066 25062 0 11:04 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 25067 25066 0 11:04 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 25070 25066 0 11:04 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 25072 25066 0 11:04 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 25075 25066 0 11:04 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 25078 25066 0 11:04 ? 00:00:00 /opt/GBASE/gbase/bin/oninit -ivwy
root 25080 25066 0 11:04 ? 00:00:02 /opt/GBASE/gbase/bin/oninit -ivwy
gbasedbt 44782 44694 0 13:47 pts/3 00:00:00 grep --color=auto oninit
[gbasedbt@vip ~]$
复制
至此,GBase 8s 图形化方式定制化安装成功。
8.典型安装--GBase 8s数据库简单使用(命令行安装方式)
8.1登录数据库
以 gbasedbt 用户身份登录,输入 dbaccess - - 命令进入数据库命令行模式。
[root@vip ~]# su - gbasedbt
Last login: Mon Apr 24 14:35:31 CST 2023 on pts/1
[gbasedbt@vip ~]$ dbaccess - -
Your evaluation license will expire on 2024-04-23 00:00:00
>
复制
8.2创建数据库
以 gbasedbt 用户身份登录,输入 dbaccess - - 命令进入数据库命令行模式,执行create database命令创建数据库。
[gbasedbt@vip ~]$ dbaccess - -
Your evaluation license will expire on 2024-04-23 00:00:00
> create database vip8s with log;
Database created.
>
Database closed.
[gbasedbt@vip ~]$
复制
当创建数据库出现卡住后报错时,主要原因是在/opt/GBASE/gbase/etc目录下sqlhosts.ol_gbasedbt1210文件中使用的是服务器机器名。
解决办法:将sqlhosts.ol_gbasedbt1210文件中的服务器机器名改为具体IP地址,然后重启数据库,再次登录数据库执行建库语句即可成功。
--查看sqlhosts.ol_gbasedbt1210文件当前内容,可以看出当前内容中使用的是服务器机器名,并非是具体IP地址
[root@vip ~]# cd /opt/GBASE/gbase/etc
[root@vip etc]# cat sqlhosts.ol_gbasedbt1210
ol_gbasedbt1210 onsoctcp vip ol_gbasedbt1210
dr_gbasedbt1210 drsoctcp vip dr_gbasedbt1210
lo_gbasedbt1210 onsoctcp 127.0.0.1 lo_gbasedbt1210
[root@vip etc]#
复制
--将sqlhosts.ol_gbasedbt1210文件中的服务器机器名改为具体IP地址
[root@vip etc]# vi sqlhosts.ol_gbasedbt1210
复制
执行onmode -ky和oninit -vy命令重启数据库后,再次登录数据库执行建库语句即可成功。
8.3创建数据表、插入数据并执行查询
以 gbasedbt 用户身份登录,输入 dbaccess - - 命令进入数据库命令行模式,执行database vip8s命令以选定vip8s数据库。
[gbasedbt@vip ~]$ dbaccess - -
Your evaluation license will expire on 2024-04-23 00:00:00
--选定vip8s数据库
> database vip8s;
Database selected.
--创建viptab数据表
> create table viptab(id int,name varchar(32));
Table created.
--向viptab表中插入测试数据
> insert into viptab values(1,'gbliu');
1 row(s) inserted.
--执行select命令查询viptab表中信息
> select * from viptab;
id name
1 gbliu
1 row(s) retrieved.
>
复制
9.定制安装--使用GBase DataStudio客户端工具简单使用GBase 8s(图形界面安装方式)
打开GBase DataStudio软件,创建新的数据库连接。
根据图中报错信息可知,错误原因为gbasedbt用户密码太过简单,不符合密码强度要求。解决方法:在数据库服务器中,使用root用户,更改gbasedbt用户密码,然后重启数据库即可使用GBase DataStudio工具连接到数据库。
[root@vip ~]# passwd gbasedbt
Changing password for user gbasedbt.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@vip ~]# su - gbasedbt
Last login: Tue Apr 25 14:34:40 CST 2023 on pts/2
[gbasedbt@vip ~]$ onmode -ky
Your evaluation license will expire on 2024-04-24 00:00:00
[gbasedbt@vip ~]$ oninit -vy
Your evaluation license will expire on 2024-04-24 00:00:00
Warning: Parameter's user-configured value was adjusted. (DS_MAX_SCANS)
Warning: Parameter's user-configured value was adjusted. (ONLIDX_MAXMEM)
Reading configuration file '/opt/GBASE/gbase/etc/onconfig.vip8s'...succeeded
Creating /GBASEDBTTMP/.infxdirs...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 8310 kbytes...succeeded
Creating infos file "/opt/GBASE/gbase/etc/.infos.vip8s"...succeeded
Linking conf file "/opt/GBASE/gbase/etc/.conf.vip8s"...succeeded
Initializing rhead structure...rhlock_t 16384 (512K)... rlock_t (5312K)... Writing to infos file...succeeded
Initialization of Encryption...succeeded
Initializing ASF...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Bringing up ADM VP...succeeded
Creating VP classes...succeeded
Forking main_loop thread...succeeded
Initializing DR structures...succeeded
Forking 1 'soctcp' listener threads...succeeded
Forking 1 'soctcp' listener threads...succeeded
Forking 1 'soctcp' listener threads...succeeded
Starting tracing...succeeded
Initializing 2 flushers...succeeded
Initializing SDS Server network connections...succeeded
Initializing log/checkpoint information...succeeded
Initializing dbspaces...succeeded
Opening primary chunks...succeeded
Validating chunks...succeeded
Initialize Async Log Flusher...succeeded
Starting B-tree Scanner...succeeded
Init ReadAhead Daemon...succeeded
Init DB Util Daemon...succeeded
Initializing DBSPACETEMP list...succeeded
Init Auto Tuning Daemon...succeeded
Checking database partition index...succeeded
Initializing dataskip structure...succeeded
Checking for temporary tables to drop...succeeded
Updating Global Row Counter...succeeded
Forking onmode_mon thread...succeeded
Creating periodic thread...succeeded
Creating periodic thread...succeeded
Starting scheduling system...succeeded
Verbose output complete: mode = 5
[gbasedbt@vip ~]$
复制
在GBase DataStudio中,除了使用SQL语句对数据库进行控制外,还可以通过直接编辑左侧数据库表进行操作。如通过左侧数据库导航栏查看testtab表中数据:
恭喜!GBase 8s 已成功安装,并且能够通过本地和GBase DataStudio客户端工具方式正常连接使用,现在,让我们一起畅享GBase 8s 带来的极致体验吧!!!
评论














