1. 虚谷数据库文件下载
虚谷数据库下载地址:
https://download.xugudb.com/XuGuDBMS/XuGuServer-12_20230630-trial-linux-x64.tar.gz
https://download.xugudb.com/XuGuDBMS/XuGuServer-12_20230630-trial-linux-aarch64.tar.gz
https://download.xugudb.com/XuGuDBMS/XuGuServer-12_20230630-trial-win-x64.zip
2.部署环境
硬件环境
Linux(x86,arrch64)
操作系统(主流的Linux发行版,RedHat,Centos,Ubuntu等;及windows版本)
内存(建议16G以上)
磁盘(建议100G以上)
网络(千兆以上)
软件环境
snmp 服务的安装(设置为开机自启)。
ntp 服务的安装(设置为开机自启)。
gcc、libaio、gdb 包的安装(数据库运行环境参数)。
jdk1.8及以上
3. 本地安装环境配置
BIOS
(1)关闭超线程
如果支持超线程得关闭超线程,进入BIOS SETUP 界面,找到(超线程)Hyper-Threading Technology 选项后将其设置为[Disabied]关闭,保存退出后启动系统。lscpu |grep "Thread(s) per core:" 结果为1说明已经关闭超线程。
(2)将电源管理设置为性能模式
进入BIOS,找到“高级”下面的“性能配置”;“性能配置”里面的“电源策略”选择“性能”。cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 显示 performance 即可,可能不同的和主板设置的位置不一样,具体情况参照主板说明书。
系统配置
[root@xugu-node1-v12 ~]# cat /etc/system-release
CentOS Linux release 7.4.1708 (Core)
[root@xugu-node1-v12 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 17G 1.3G 16G 8% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.4M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/vda1 1014M 125M 890M 13% /boot
tmpfs 396M 0 396M 0% /run/user/0
[root@xugu-node1-v12 ~]# free -h
total used free shared buff/cache available
Mem: 3.9G 123M 3.3G 8.4M 467M 3.5G
Swap: 2.0G 0B 2.0G
[root@xugu-node1-v12 ~]# ethtool eth0 |grep Speed
Speed: 1000Mb/s
防火墙和Selinux
防火墙和selinux按照需求关闭,这是测试环境直接关闭
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
setenforce 0
getenforce
sestatus
透明页和内存页
禁用透明页和内存页,直接关闭
cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
cat /sys/kernel/mm/transparent_hugepage/defrag
always madvise [never]
cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
vi /etc/rc.d/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
chmod +x /etc/rc.d/rc.local
网络参数设置
vi /etc/sysctl.conf
net.core.rmem_default = 2097152
net.core.wmem_default = 2097152
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608
sysctl -p
内核ulimit参数配置
vi /etc/profile
ulimit -s 20480
ulimit -n 10240
source /etc/profile
检查环境所需包,snmpd自启动
yum -y install vsftpd ntp libaio net-snmp perf gcc gdb sysstat
systemctl start snmpd
systemctl enable snmpd
systemctl status snmpd
创建xugu用户
groupadd -g 2000 xugu
useradd -g xugu -u 2000 -m -d /home/xugu xugu
passwd xugu
4.本地单机虚谷数据库安装
数据库安装包解压
一个XuguServer目录和一个安装手册.pdf。Server的BIN目录中包含xgconsole登录数据库的控制台,数据库服务启动运行工具,初始化SQL脚本,数据库服务启动脚本,SETUP目录包含数据库的ini配置文件。
[root@xugu-node1-v12 ~]# tar -zxvf XuGuServer-12_20230630-trial-linux-x64.tar.gz
XuguServer/
XuguServer/BIN/
XuguServer/BIN/xgconsole-linux-x64
XuguServer/BIN/xugu12_linux_x64_trial
XuguServer/BIN/xugu_init.sql
XuguServer/BIN/xugu_start.sh
XuguServer/SETUP/
XuguServer/SETUP/mount.ini
XuguServer/SETUP/trust.ini
XuguServer/SETUP/types.ini
XuguServer/SETUP/xugu.ini
虚谷数据库安装手册.pdf
ini配置文件介绍
- 配置数据库相关目录与操作系统的映射文件(./SETUP/mount.ini)
- 配置数据库黑白名单文件(./SETUP/trust.ini)
- 配置数据库类型映射文件(./SETUP/types.ini)
- 配置数据库系统参数文件(./SETUP/xugu.ini)
数据库启动
[root@xugu-node1-v11 ~]# /home/xugu/XuguServer/BIN/xugu_start.sh
XuGu SQL Server 12.0.0 (Built:2023-06-30 12:00:00 GA)
Start at: 2023-09-15 11:47:25
Start database process PID=5220,output redirects to file stdout.txt.
查看启动文件stdout.txt
XuGu SQL Server 12.0.0 (Built:2023-06-30 12:00:00 GA)
Start at: 2023-09-15 11:47:25
database server PID=5220
CPU info:
Node 0: 0
Resource limit:
File number: hard limit=10240,soft limit=10240
File size(M): hard limit=-1,soft limit=-1
Data memory(M): hard limit=-1,soft limit=-1
Resident(M): hard limit=-1,soft limit=-1
Proc's total memory(M): hard limit=-1,soft limit=-1
Open file cluster.ini failed.
init data buffer...ok.
Trial period is 360 days,remain 338 days
open all tablespaces...ok.
Load all local stores...ok.
Load all gstores...ok.
Repairing database
Rollforward repairing...ok.
0 transaction will be rollbacked.
Rollback repairing...ok.
Mount all gstore...ok.
Open all system tables...ok
Open all system views...ok
Load all jobs...ok
All service started.
Listening at port 5138
5.客户端登录数据库
xgconsole nssl 127.0.0.1 5138 SYSTEM SYSDBA SYSDBA
查看集群状态
状态为2正常态,集群启动时间。
SQL> select NODE_STATE,BOOT_TIME from sys_clusters;
NODE_STATE | BOOT_TIME |
------------------------------------------------------------------------------
2 | 2023-09-15 11:47:25.576 AD |
Total 1 records.
Use time:0 ms.
创建测试表
test1表,查看存储位置
SQL> create table test1 (id int , c2 varchar(10));
Execute successful.
Use time:24 ms.
SQL> select GSTO_NO,STORE_STA,STORE_NUM,NODE_ID1,STORE_NO1,OBJ_ID,NODEID from sys_gstores where obj_id = (select TABLE_ID from sys_tables where table_name = 'test1');
GSTO_NO | STORE_STA | STORE_NUM | NODE_ID1 | STORE_NO1 | OBJ_ID | NODEID |
------------------------------------------------------------------------------
346 | 1 | 1 | 1 | 204 | 1048598 | 1 |
Total 1 records.
Use time:0 ms.
全局存储号GSTO_NO为346,STORE_STAT为1二进制是00 00 01,单节点只有一个版本,第一版本是主版本,NODE_ID1为1第一版本为1节点。
6.连接工具下载
虚谷Console下载地址:
虚谷Manage下载地址:
https://download.xugudb.com/Tools/XuguManager/XuguManager-11.2.2.202204271030-RELEASE-win-x64.zip
虚谷DBeaver下载地址:
https://download.xugudb.com/Tools/XuguDBeaver/XuguDBeaver-1.3.2.202204210743-RELEASE-win-x64.zip