GBase 8s 学习笔记 002 —— GBase 8s 安装与卸载
安装环境
检查服务器内存大小
[root@192 ~]# free -m total used free shared buff/cache available Mem: 1819 787 103 20 927 855 Swap: 2047 4 2043
检查服务器磁盘空间大小
[root@192 ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 894M 0 894M 0% /dev tmpfs 910M 0 910M 0% /dev/shm tmpfs 910M 11M 900M 2% /run tmpfs 910M 0 910M 0% /sys/fs/cgroup /dev/mapper/centos-root 50G 5.4G 45G 11% / /dev/sda1 1014M 185M 830M 19% /boot /dev/mapper/centos-home 27G 37M 27G 1% /home tmpfs 182M 48K 182M 1% /run/user/0 /dev/sr0 4.4G 4.4G 0 100% /run/media/root/CentOS 7 x86_64
检查服务器网络配置信息
[root@192 ~]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.254.134 netmask 255.255.255.0 broadcast 192.168.254.255 inet6 fe80::d8df:9e1b:e341:34dd prefixlen 64 scopeid 0x20<link> ether 00:0c:29:6f:ac:d9 txqueuelen 1000 (Ethernet) RX packets 336065 bytes 502856578 (479.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 59073 bytes 3630904 (3.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 1036 bytes 89096 (87.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1036 bytes 89096 (87.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:81:64:14 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
检查操作系统版本
[root@192 ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)
安装前的准备工作
创建用户
GBase 8s数据库需要一个名字为gbasedbt的操作系统用户,做为数据库的超级用户。我们在安装前,需要创建好这个用户。
如果我们在安装时,没有提前创建这个用户,在安装过程中,会提示要创建这个用户,并输入密码。不过在安装过程中创建的用户,没有创建一个新的目录做为gbasedbt的Home,这可能导致在后续的创建数据库实例时,无法自动生成实例的环境变量。
为了减少后面的麻烦,记得提前创建gbasedbt用户,并设置好密码。
检查操作系统是否存在gbasedbt用户
[root@192 ~]# cat /etc/passwd | grep gbasedbt [root@192 ~]#
检查操作系统是否存在gbasedbt组
[root@192 ~]# cat /etc/group | grep gbasedbt [root@192 ~]#
创建gbasedbt组和用户,并设置用户密码
[root@192 ~]# useradd gbasedbt
创建gbasedbt后,再次查看
[root@192 ~]# cat /etc/group | grep gbasedbt gbasedbt:x:1001: [root@192 ~]# cat /etc/passwd | grep gbasedbt gbasedbt:x:1001:1001::/home/gbasedbt:/bin/bash
gbasedbt的组和用户已经创建成功。
准备软件安装包
上传GBase 8s安装包到服务器。
[root@192 ~]# ll /root/setup/ 总用量 309272 -rw-r--r--. 1 root root 316692480 2月 7 20:46 GBase8s_ExpressEdition.tar
创建一个目录,将安装包解压到该目录
[root@192 ~]# mkdir install [root@192 ~]# ll 总用量 8 -rw-------. 1 root root 1793 9月 2 06:28 anaconda-ks.cfg -rw-r--r--. 1 root root 1821 9月 1 22:30 initial-setup-ks.cfg drwxr-xr-x. 2 root root 6 2月 7 20:48 install drwxr-xr-x. 2 root root 40 2月 7 20:46 setup drwxr-xr-x. 2 root root 6 2月 7 19:38 公共 drwxr-xr-x. 2 root root 6 2月 7 19:38 模板 drwxr-xr-x. 2 root root 6 2月 7 19:38 视频 drwxr-xr-x. 2 root root 6 2月 7 19:38 图片 drwxr-xr-x. 2 root root 6 2月 7 19:38 文档 drwxr-xr-x. 2 root root 6 2月 7 19:38 下载 drwxr-xr-x. 2 root root 6 2月 7 19:38 音乐 drwxr-xr-x. 2 root root 6 2月 7 19:38 桌面 [root@192 ~]# cd install/ [root@192 install]# tar xf /root/setup/GBase8s_ExpressEdition.tar [root@192 install]# ll 总用量 309248 drwxr-xr-x. 2 nwh nwh 77 3月 23 2021 doc -rwxr-xr-x. 1 nwh nwh 316579352 3月 23 2021 ids_install -rw-r--r--. 1 nwh nwh 1864 3月 23 2021 ids.properties -rwxr-xr-x. 1 nwh nwh 82738 3月 23 2021 onsecurity
至此,安装数据库需要的软件包和用户都准备好了。
安装GBase 8s
安装GBase 8s数据库组件
GBase 8s数据库安装,支持图形界面方式和控制台的命令行方式。默认的安装方式是控制台命令行方式。如果希望使用图形界面安装,只需要在启动安装程序时,后面加上参数./ids_install -i swing即可。
安装过程中,会显示产品的License,内容较长,在控制台的命令行方式中,可以连续按5次回车。在图形界面方式中,需要用鼠标拉动界面右侧的滚动条到底部,就可以点那个复选框,确认License了。
在root用户下,进入安装包目录,运行安装命令ids_install,启动安装程序。
[root@192 install]# ./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 /root/install/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
接受License,输入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
安装程序提示用户输入GBase 8s的安装路径。我们输入/opt/gbase。
- 说明:
- /opt目录的默认用户和用户组是root:root,如果被修改成其它用户和用户组,可能会导致安装时,报权限错误。请检查指定的安装路径用户和用户组是否为root:root。
- 如果数据库安装在/opt下,可以不用手动创建后面的目录,安装程序会自动创建。
- 为了保障数据安全,GBase 8s的安装路径,不能允许其它用户有写权限,即安装路径不能设置为777。建议将安装路径的权限设置为755.
- 安装目录中,必须为空。
INSTALL FOLDER IS: /opt/gbase IS THIS CORRECT? (Y/N): y
输入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:: 1
安装程序支持典型安装和自定义安装方式,我们选择典型安装,所以输入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 <ENTER> TO ACCEPT THE DEFAULT:: 2
在安装过程中,可以自动创建一个数据库的实例。由于典型安装中创建的实例在配置上非常简单,不适合后期深入的学习GBase 8s,因此选择不创建实例,在安装后,可以手动执行一个脚本,方便了创建一个新的数据库实例。此处输入2。
重要说明:
这个选择很重要。选择不创建实例,不但可以减少你的整体安装时间,也会让你对这款数据库,有更深入地了解。
安装过程中,自动创建一个数据库实例,在个别情况下,可能出现安装后,不能创建数据库现象(执行create database卡住,一段时间后报错退出)。这个问题的原因是sqlhosts文件中使用了机器名,需要我们修改成服务器的IP地址,并重启数据库,就可以解决。也许有其它好的解决方法,不过这是目前知道的一个方法,而且好用。
=============================================================================== 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: 496,188,997 Bytes Available: 46,859,845,632 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 Express Edition For more information about using GBase products, see the GBase Information Center at http://www.gbase.cn. PRESS <ENTER> TO EXIT THE INSTALLER:
安装完成。按回车键退出安装程序。
至此,数据库的组件,全部安装完成。
再创建一个数据库实例,就可以工作了。
创建数据库实例
创建数据库实例,需要切换到gbasedbt用户。
[root@192 install]# su - gbasedbt
在数据库安装目录的etc目录有,有一个GBaseInit_gbasedbt.sh脚本,可以采用向导方式,让我们一步一步,方便地创建一个新的数据库实例。
GBase 8s不同于Oracle,MySQL和SQL Server等,支持在一台服务器上,部署多个实例,听说甚至可以部署不同版本的多个实例,对于那些服务器紧张的小伙伴,是个福利。
[gbasedbt@192 ~]$ cd /opt/gbase/etc [gbasedbt@192 etc]$ ls ac_config.std boot1210.sql boot920b.sql cnv50t60.sql evidence.sh IIFfiles revboot1210XC4_CM.sql syscdcv1.sql alarmprogram.sh boot1210XC4_CM.sql boot920c.sql cnv50t92.sql gbasedbtdir-is-insecure IM_ic_16.png secswitch.std syscdr.sql allowed.surrogates.demo boot1210XC4.sql boot920.sql cnv94t100.sql GBaseInit_gbasedbt.sh IM_uninstall_16.png securityconfig.std syscdrview.sql blduser.sh boot901.sql boot930a.sql conv GBase_security.sh install securitylog.std sysmaster.sql bldutil.sh boot90.sql boot940.sql convTovNoSQL1210.sql GLS-cr jsonListener-example.properties server_instance_terminal.png sysuser.sql boot1000a.sql boot910b.sql bootdwa.sql convTovNoSQL1210XC3.sql Glsfiles log_full.sh smi_6to7 sysutils.sql boot1000.sql boot910.sql bootupgrade.sql cvtlongid7x.sql ids_16.png make-gbasedbtdir-secure smi_load termcap boot1110.sql boot911.sql brand cvtlongid914.sql idser.xsd Messagefiles smi_unld typetab boot1150.sql boot911u.sql buildsmi cvtviotab.sql ids_master_doc.xml MSG-cr sm_versions.std xpg4_is.sql boot1150XC6.sql boot912b.sql clone do_role_sep ifxdeploy.conf no_log.sh sqlhosts.ext.demo boot1170.sql boot912.sql cnv10to1110.sql dropcdr.sql ifx_failover_callback.sh onconfig.std sqlhosts.std boot1170XC3.sql boot920a.sql cnv1150to1170.sql dummyupds100.sql IIF-cr release_notes.png sysadmin [gbasedbt@192 etc]$
执行创建实例的脚本
[gbasedbt@192 etc]$ sh GBaseInit_gbasedbt.sh
开始创建数据库实例。
Initializing Program...OK ENTER THE INSTANCE INFORMATION or PRESS <ENTER> TO ACCEPT THE DEFAULT. ENTER GBASE INSTANCE NAME (GBASEDBTSERVER) [Default:gbaseserver]:
脚本默认的实例名称为gbaseserver,可以在冒号后面输入希望的名称,也可以直接回车,使用默认的实例名。
说明:实例的名称可以是字母,数字和下划线。
不要用减号,不要用减号,不要用减号。
SEARCHING FOR GBASE INSTALL FOLDER, PLEASE WAIT FOR SECONDS... GBASE INSTALL FOLDER LIST: 1) /opt/gbase CHOOSE GBASE INSTALL FOLDER(GBASEDBTDIR) [Default:/opt/gbase]:
安装脚本询问GBase 8s的程序安装在哪个路径下,默认是之前安装时指定的路径。直接回车继续。
CHOOSE SERVICE IP ADDRESS FROM THE LIST: 1) 192.168.254.134 2) 127.0.0.1 3) 192.168.122.1 ENTER THE NUMBER FOR YOUR CHOICE [Default:192.168.254.134]:
安装脚本询问服务器的IP地址,输入服务器的IP地址。如果默认的IP地址是希望的IP,直接回车继续。
SPECIFY THE PORT NUMBER FOR GBASE [Default:9088]:
安装脚本询问数据库监听使用的端口号,默认为9088。使用默认值,回车继续。
INITIALIZE TYPE: 1) TYPICAL -- Initialize the instance with all features configured with default values. 2) CUSTOM -- Initialize the instance with specific features that you need. ENTER THE NUMBER FOR YOUR CHOICE [Default:1]: 2
安装脚本询问初始化的类型,选择CUSTOM,输入2,回车继续。
GBASE CHARACTER SET LIST: 1) en_US.8859-1 2) zh_CN.GB18030-2000 3) zh_CN.utf8 ENTER THE NUMBER FOR YOUR CHOICE [Default:1]: 3
安装脚本询问数据库使用哪种字符集,此处使用UTF8,输入3,回车继续。
ENTER THE DATA SPACE PATH [Default:/opt/gbase/gbaseserver_dbs]:
安装脚本询问数据保存在哪个目录中,使用默认值,回车继续。
ENTER THE LOGICAL LOG DBSPACE SIZE(MB) [Default:4500]: 200
安装脚本询问,保存逻辑日志的数据库空间大小,输入200,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。
ENTER THE PHYSICAL LOG DBSPACE SIZE(MB) [Default:4500]: 200
安装脚本询问,保存物理日志的数据库空间大小,输入200,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。
ENTER THE SMART LOB DBSPACE SIZE(MB) [Default:930]: 100
安装脚本询问,保存智能大对象的数据库空间大小,输入100,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。
ENTER THE TEMPORARY DBSPACE SIZE(MB) [Default:930]: 100
安装脚本询问,保存临时数据的数据库空间大小,输入100,回车继续。
说明:这个地方指定的值很大时,数据库会按该值分配磁盘空间,可能用时较长。
ENTER "Y" TO START DATABASE ADVANCED SETTINGS, OR ENTER "N" TO ACCEPT DEFAULT VALUES: [Default:N]: y
安装脚本询问我们,是否进行一些高级设置,我们输入y,回车继续。
ENTER THE NUMBER OF DATA DBSPACES [Default:1]: 5
安装脚本询问我们,创建几个保存数据的数据库空间,输入5,回车继续。
提示:这点很重要,方便后面学习分片表。
ENTER THE NUMBER OF TEMP DBSPACES [Default:1]: 3
安装脚本询问,创建几个保存临时数据的数据库空间,输入3,回车继续。
Enter "Y" TO ENABLE ENVIRONMENT GL_USEGLU, OR ENTER "N" TO DISABLE: [Default:N]:
安装脚本询问,是否启用GL_USEGLU,默认不启用,直接回车继续。
INSTANCE SUMMARY: Instance name: gbaseserver GBase install directory: /opt/gbase IP address & port: 192.168.254.134:9088 Character set: zh_CN.utf8 Logical log space size: 200 MB Physical log space size: 200 MB Smart LOB space size: 100 MB Temp DBSpace size: 100 MB Data path: /opt/gbase/gbaseserver_dbs Data path free size: 44629 MB The number of data DBSpace: 5 The number of temp DBSpace: 3 Environment GL_USEGLU: 0 Enter "Y" to Start database initializing, or Enter "N" to Edit Again: y
安装脚本列出创建实例的配置信息。输入y,回车继续。
安装脚本开始创建实例。
Touching Chunks...OK Create sqlhosts File: /opt/gbase/etc/sqlhosts.gbaseserver ...OK Setting Parameters in /opt/gbase/etc/onconfig.gbaseserver : ROOTPATH.ROOTSIZE.DBSERVERNAME.FULL_DISK_INIT.SBSPACENAME.SYSSBSPACENAME.DBSPACETEMP.LOGFILES.MULTIPROCESSOR.VPCLASS.NETTYPE.CLEANERS.DEF_TABLE_LOCKMODE.DIRECT_IO.LOCKS.TAPEDEV.LTAPEDEV.CKPTINTVL.DS_MAX_QUERIES.DS_TOTAL_MEMORY.DS_NONPDQ_QUERY_MEM.PHYSBUFF.LOGBUFF.AUTO_TUNE.MSGPATH.SERVERNUM.ALLOW_NEWLINE.TEMPTAB_NOLOG.DUMPSHMEM.USEOSTIME.STACKSIZE.ON_RECVRY_THREADS.OFF_RECVRY_THREADS.USELASTCOMMITTED.SHMVIRTSIZE.SHMADD.GBASEDBTCONTIME.BUFFERPOOL2K.BUFFERPOOL16K...AUTO_CKPTS.OK Initializing Root DBSpace & Share Memory...OK Creating system database.........OK Creating logical log Dbspace...OK Creating physical log Dbspace...OK Creating smart LOB Dbspace...OK Creating temp Dbspace.1.2.3...OK Creating data Dbspace.1.2.3.4.5...OK Setting dbscheduler...OK Moving physical log...OK Adding 20 logical logs: 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20...OK Setting data chunks extendable...OK Cleaning logical logs in rootdbs...Your evaluation license will expire on 2024-02-07 00:00:00 .Your evaluation license will expire on 2024-02-07 00:00:00 .Your evaluation license will expire on 2024-02-07 00:00:00 .Your evaluation license will expire on 2024-02-07 00:00:00 ...OK Database restarting.......Your evaluation license will expire on 2024-02-07 00:00:00 OK Creating database: gbasedb...OK Now you can use this URL to connect to gbasedb: jdbc:gbasedbt-sqli://192.168.254.134:9088/gbasedb:GBASEDBTSERVER=gbaseserver;DB_LOCALE=zh_CN.utf8;CLIENT_LOCALE=zh_CN.utf8;NEWCODESET=UTF8,utf8,57372; Version: Your evaluation license will expire on 2024-02-07 00:00:00 On-Line -- Up 00:00:13 -- 597864 Kbytes Build Number: 3.3.0_N303 GBase Initializing Finished! Initialize log file : ./InitGBaseDB_202302072126.log Press <ENTER> to Exit and Logout...
至此,数据库实例创建完成。
已杀死 [root@192 install]#
环境变量
安装脚本会在gbasedbt的Home路径下,自动生成一个名称为profile.gbaseserver的文件,记录了新创建数据库实例需要的环境变量。
[gbasedbt@192 ~]$ ls profile.gbaseserver
可以使用cat命令查看文件的内容。
[gbasedbt@192 ~]$ cat profile.gbaseserver export GBASEDBTSERVER=gbaseserver export GBASEDBTDIR=/opt/gbase export GBASEDBTSQLHOSTS=/opt/gbase/etc/sqlhosts.gbaseserver export ONCONFIG=onconfig.gbaseserver export PATH=/opt/gbase/bin:$PATH export DB_LOCALE=zh_CN.utf8 export CLIENT_LOCALE=zh_CN.utf8 unset GL_USEGLU
可以使用source命令,使环境变量生效。
[gbasedbt@192 ~]$ source profile.gbaseserver
可以使用env查看环境变量。
[gbasedbt@192 ~]$ env | grep GBASE GBASEDBTSQLHOSTS=/opt/gbase/etc/sqlhosts.gbaseserver GBASEDBTSERVER=gbaseserver GBASEDBTDIR=/opt/gbase
数据库状态查看与启停
查看GBase 8s的进程信息
GBase 8s启动后,会运行名称为oninit的进程,可以使用ps命令查看。
[gbasedbt@192 ~]$ ps -ef | grep oninit gbasedbt 62615 1 0 21:40 ? 00:00:00 oninit -v root 62617 62615 0 21:40 ? 00:00:00 oninit -v root 62618 62617 0 21:40 ? 00:00:00 oninit -v root 62620 62617 0 21:40 ? 00:00:00 oninit -v root 62622 62617 0 21:40 ? 00:00:00 oninit -v root 62624 62617 0 21:40 ? 00:00:00 oninit -v root 62625 62617 0 21:40 ? 00:00:00 oninit -v gbasedbt 62627 62617 0 21:40 ? 00:00:00 oninit -v root 62630 62617 0 21:40 ? 00:00:00 oninit -v root 62631 62617 0 21:40 ? 00:00:00 oninit -v root 62632 62617 0 21:40 ? 00:00:00 oninit -v root 62633 62617 0 21:40 ? 00:00:00 oninit -v root 62634 62617 0 21:40 ? 00:00:00 oninit -v gbasedbt 62960 62755 0 21:44 pts/0 00:00:00 grep --color=auto oninit
查看数据库运行状态
可以使用onstat命令,查看数据库运行状态。
[gbasedbt@192 ~]$ onstat - Your evaluation license will expire on 2024-02-07 00:00:00 On-Line -- Up 00:05:14 -- 597864 Kbytes
命令输出显示,当前数据库运行在OnLine状态。
启动数据库
可以使用oninit命令启动数据库。
[gbasedbt@192 ~]$ oninit -vy Your evaluation license will expire on 2024-02-07 00:00:00 Reading configuration file '/opt/gbase/etc/onconfig.gbaseserver'...succeeded Creating /GBASEDBTTMP/.infxdirs...succeeded Allocating and attaching to shared memory...succeeded Creating resident pool 36470 kbytes...succeeded Creating infos file "/opt/gbase/etc/.infos.gbaseserver"...succeeded Linking conf file "/opt/gbase/etc/.conf.gbaseserver"...succeeded Initializing rhead structure...rhlock_t 65536 (2048K)... rlock_t (26562K)... 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 Starting tracing...succeeded Initializing 32 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@192 ~]$
启动完成后,可以使用onstat命令查看数据库的运行状态。
[gbasedbt@192 ~]$ onstat - Your evaluation license will expire on 2024-02-07 00:00:00 On-Line -- Up 00:00:46 -- 597864 Kbytes
可以使用ps命令,查看操作系统的进程,是否存在oninit进程。
[gbasedbt@192 ~]$ ps -ef | grep oninit gbasedbt 63443 1 0 21:52 ? 00:00:00 oninit -vy root 63453 63443 0 21:52 ? 00:00:00 oninit -vy root 63454 63453 0 21:52 ? 00:00:00 oninit -vy root 63456 63453 0 21:52 ? 00:00:00 oninit -vy root 63458 63453 0 21:52 ? 00:00:00 oninit -vy root 63460 63453 0 21:52 ? 00:00:00 oninit -vy root 63461 63453 0 21:52 ? 00:00:00 oninit -vy gbasedbt 63463 63453 0 21:52 ? 00:00:00 oninit -vy root 63466 63453 0 21:52 ? 00:00:00 oninit -vy root 63467 63453 0 21:52 ? 00:00:00 oninit -vy root 63468 63453 0 21:52 ? 00:00:00 oninit -vy root 63469 63453 0 21:52 ? 00:00:00 oninit -vy root 63470 63453 0 21:52 ? 00:00:00 oninit -vy gbasedbt 63539 62755 0 21:53 pts/0 00:00:00 grep --color=auto oninit
停止数据库
可以使用onmode命令,停止数据库的运行。
[gbasedbt@192 ~]$ onmode -ky Your evaluation license will expire on 2024-02-07 00:00:00
使用onstat命令查看数据库状态,显示共享内存没有初始化,数据库处于离线状态。
[gbasedbt@192 ~]$ onstat - Your evaluation license will expire on 2024-02-07 00:00:00 shared memory not initialized for GBASEDBTSERVER 'gbaseserver'
使用ps命令查看数据库的进程信息,发现没有oninit进程存在。
[gbasedbt@192 ~]$ ps -ef | grep oninit gbasedbt 63654 62755 0 21:55 pts/0 00:00:00 grep --color=auto oninit
验证数据库安装
可以使用客户端工具,验证数据库功能是否正常。
[gbasedbt@192 ~]$ dbaccess - -
Your evaluation license will expire on 2024-02-07 00:00:00
> create database mydb with log;
Database created.
> database mydb;
Database closed.
Database selected.
> create table t_user(f_userid int, f_username varchar(50));
Table created.
> insert into t_user values(1,'gbasedbt');
1 row(s) inserted.
> select * from t_user;
f_userid f_username
1 gbasedbt
1 row(s) retrieved.
>
# Ctrl+D
Database closed.
验证结果显示,GBase 8s可以创建数据库,创建表,可以插入和查询数据。数据库功能正常。