暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

【YashanDB认证】单机版崖山数据库部署实战

蔡大侠; 2024-08-02
287


单机版崖山数据库部署实战

引言

崖山数据库(YashanDB)是由深圳计算科学研究院自主研发的一款新型数据库管理系统。该数据库系统不仅融合了经典数据库理论,还融入了新的原创理论,具备高性能、高可用性和强大的数据处理能力。本文将详细介绍如何在单机环境下部署崖山数据库,帮助读者快速上手并体验其强大功能。

一、崖山数据库简介

崖山数据库管理系统(YashanDB)是深圳计算科学研究院在数据库前沿基础理论上自主设计、研发的一款新型数据库系统。它支持多种存储表类型(如HEAP、TAC、LSC),具备完整的ACID事务处理能力、向量化计算、MPP分布式执行方式等特性。同时,YashanDB还提供了丰富的数据类型和函数库,支持ANSI SQL标准,并且具备强大的优化器模型,能够处理复杂的查询和大规模数据。

以下为崖山数据库单机版部署实战。

二、部署前准备

2.1 服务器配置要求

部署崖山数据库需要一台配置合适的Linux服务器,推荐使用CentOS 7.6及以上版本。服务器的最少配置建议如下:

项目

描述

操作系统

CentOS 7.6,kylin V10

CPU

X86_64,ARM64

2C

内存

4G

硬盘

50G

文件系统

ext4或xfs

网络

千兆以太网,支持TCP和UDP链接

2.2 创建安装用户

崖山用户配置脚本:

#!/bin/bash
############################################################
## scripts: ysdb_user.sh
## author : dash.cai
## purpose: 配置崖山数据库用户           
############################################################
groupadd yashan
useradd -g yashan -s /bin/bash -c "yashan Owner" yashan
echo "yashan" | passwd --stdin yashan
chmod +w /etc/sudoers
echo "yashan  ALL=(ALL)NOPASSWD:ALL" >> /etc/sudoers
chmod -w /etc/sudoers


2.3 操作系统参数调整

下表为YashanDB数据库所需的资源限制值的最小要求,请根据下表所示将资源限制值调整为大于或等于最小要求的值。

资源项

描述

推荐值

open files

文件句柄

1048576

max user processes

最大用户线程数

1048576

max memory size

最大内存限制

unlimited

stack size

堆栈大小

8192

崖山数据库资源参数脚本:

#!/bin/bash
############################################################
## scripts: ysdb_limits.sh
## author : dash.cai
## purpose: 配置崖山数据库资源参数
##           
############################################################
 echo "
* soft nofile 1048576
* hard nofile 1048576
* soft nproc 1048576
* hard nproc 1048576
* soft rss unlimited
* hard rss unlimited
* soft stack 8192
* hard stack 8192
" >> /etc/security/limits.conf


三、安装崖山数据库

3.1 下载并上传安装包

首先,从崖山数据库官网下载对应版本的安装包(例如yashandb-personal-23.2.0.2-linux-x86_64.tar.gz),并将其上传到服务器的指定目录下(例如/home/yashan/install)。

3.2 获取yasboot安装工具

解压安装包

mkdir -p /home/yashan/install 
mkdir -p /home/yashan/yasdb_home
mkdir -p /home/yashan/yasdb_data
cd /home/yashan/install  
tar -zxvf yashandb-personal-23.1.1.100-linux-x86_64.tar.gz


3.3 生成参数文件

执行如下命令生成安装参数文件,ssh登录密码为创建yashan用户时指定的密码,请将--ip参数后面的值更换成安装服务端所在服务器的IP地址(使用127.0.0.1会导致客户端无法连接至服务端):

[yashan@centos7 install]$ ./bin/yasboot package se gen --cluster yashandb -u yashan -p yashan --ip 192.168.56.103 --port 22 --install-path /home/yashan/yasdb_home  --data-path /home/yashan/yasdb_data --begin-port 1688
host host0001 openssl version: OpenSSL 1.0.2k-fips  26 Jan 2017
Warning: OpenSSL less than 1.1.1, it may cause installation failures, please upgrade OpenSSL to 1.1.1 or greater
 hostid   | group | node_type | node_name | listen_addr         | replication_addr    | data_path               
----------------------------------------------------------------------------------------------------------------
 host0001 | dbg1  | db        | 1-1       | 192.168.56.103:1688 | 192.168.56.103:1689 | /home/yashan/yasdb_data 
----------+-------+-----------+-----------+---------------------+---------------------+-------------------------

Generate config success


3.4 执行安装

执行如下命令安装YashanDB数据库,如实际安装数据库版本与示例中版本不同,请将 -i参数后的软件包名称更改成实际名称:

[yashan@centos7 install]$ ./bin/yasboot package install -t hosts.toml -i yashandb-personal-23.2.3.100-linux-x86_64.tar.gz 
host host0001 openssl version: OpenSSL 1.0.2k-fips  26 Jan 2017
Warning: OpenSSL less than 1.1.1, it may cause installation failures, please upgrade OpenSSL to 1.1.1 or greater
checking install package...
install version: yashandb 23.2.3.100
host0001 100% [====================================================================]    3s
host0001 failed, 116, , stdout: user yashan don't belong to group yashan stderr: 
package install failed


异常处理,修改用户属组为yashan,再次执行

[root@centos7 ~]# groupadd yashan
[root@centos7 ~]# usermod -g yashan yashan
[yashan@centos7 install]$ ./bin/yasboot package install -t hosts.toml -i yashandb-personal-23.2.3.100-linux-x86_64.tar.gz 
host host0001 openssl version: OpenSSL 1.0.2k-fips  26 Jan 2017
Warning: OpenSSL less than 1.1.1, it may cause installation failures, please upgrade OpenSSL to 1.1.1 or greater
checking install package...
install version: yashandb 23.2.3.100
host0001 100% [====================================================================]    3s
update host to yasom...



3.5 执行部署

[yashan@centos7 install]$ ./bin/yasboot cluster deploy -t yashandb.toml
 type | uuid             | name               | hostid | index    | status | return_code | progress | cost 
-----------------------------------------------------------------------------------------------------------
 task | c32bb1e97c7ebe9f | DeployYasdbCluster | -      | yashandb | FAILED | 1           | 100      | 13   
------+------------------+--------------------+--------+----------+--------+-------------+----------+------
task completed, status: FAILED
retcode: 1
stdout: start node with ping
stderr: wait node 1-1 process start failed: failed to init dynamic library OPENSSL
Failed to start instance



异常处理,openssl告警无法忽略,更新openssl后卸载再次安装

[yashan@centos7 install]$ ./bin/yasboot cluster clean --cluster yashandb --purge
Are you sure you want to CLEAN cluster: [yashandb], AND ALL DATA WILL BE DELETED (-p/--purge is given)?
[yes/no]: yes
 type | uuid             | name              | hostid | index    | status  | return_code | progress | cost 
-----------------------------------------------------------------------------------------------------------
 task | fb32c95cecf892e6 | CleanYasdbCluster | -      | yashandb | SUCCESS | 0           | 100      | 1    
------+------------------+-------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS

[yashan@centos7 install]$ ./bin/yasboot cluster deploy -t yashandb.toml
 type | uuid             | name               | hostid | index    | status  | return_code | progress | cost 
------------------------------------------------------------------------------------------------------------
 task | 955ea216e6357a27 | DeployYasdbCluster | -      | yashandb | SUCCESS | 0           | 100      | 49   
------+------------------+--------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS



3.6 配置环境变量

[yashan@centos7 install]$ cd /home/yashan/yasdb_home/yashandb/23.2.3.100/conf/
[yashan@centos7 conf]$ ls -tlr
total 748
-rw-rw-r--. 1 yashan yashan   6261 Jul  8 05:12 yfs_options.json
-rw-rw-r--. 1 yashan yashan   4635 Jul  8 05:12 ycs_options.json
-rw-rw-r--. 1 yashan yashan 590524 Jul  8 05:12 yasreport.template
-rw-rw-r--. 1 yashan yashan  23577 Jul  8 05:12 sqlhtml.template
-rw-rw-r--. 1 yashan yashan   6836 Jul  8 05:12 sqlcollect.toml
-rw-rw-r--. 1 yashan yashan    297 Jul  8 05:12 profile.toml
-rw-rw-r--. 1 yashan yashan 113464 Jul  8 05:12 database_options.json
drwxrwxr-x. 2 yashan yashan     73 Aug  1 03:44 monit
-rwx------. 1 yashan yashan    281 Aug  1 03:44 yashandb.bashrc

[yashan@centos7 conf]$ cat yashandb.bashrc >> ~/.bashrc
[yashan@centos7 conf]$ source ~/.bashrc


3.7 重置sys用户的密码

[yashan@centos7 conf]$ cd /home/yashan/yasdb_data/db-1-1/instance
[yashan@centos7 instance]$ mv yasdb.pwd yasdb1.pwd
[yashan@centos7 instance]$ yaspwd file=yasdb.pwd
Enter password for SYS:


3.8 查看YashanDB数据库状态

[yashan@centos7 instance]$ yasboot cluster status -c yashandb
 host_id  | node_type | nodeid | pid   
---------------------------------------
 host0001 | db        | 1-1:1  | 16868 
----------+-----------+--------+-------


3.9 连接数据库

[yashan@centos7 instance]$ yasql sys/*****
YashanDB SQL Personal Edition Release 23.2.3.100 x86_64

Connected to:
YashanDB Server Personal Edition Release 23.2.3.100 x86_64 - X86 64bit Linux

SQL> select open_mode from v$database;

OPEN_MODE         
----------------- 
READ_WRITE       

1 row fetched.


至此,单机版部署完成。


YCA官方报名链接:YashanDB|崖山数据库系统YashanDB学习中心-YCA认证详情

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论