为什么选择YashanDB?
崖山数据库系统YashanDB是深圳计算科学研究院完全自主研发设计的新型数据库系统,经工信部下属机构权威检测,内核代码自主率100%。在经典数据库理论基础上,融入原创的有界计算理论、近似计算理论、并行可扩展理论和跨模融合计算理论,支持单机/主备、共享集群、分布式等多种部署方式,覆盖OLTP/HTAP/OLAP交易和分析混合负载场景,全面兼容私有化及云基础设施,为客户提供一站式的企业级融合数据管理解决方案,满足金融、政府、电信、能源等关键行业对高性能、高并发及高安全性的要求。
安装前准备
参考官方手册安装前准备,本文将基于CentOS7.9及YashanDB Personal 23.2.3 (Linux X86)进行个人版的安装。
另:YashanDB Personal 23.2.3最低依赖OpenSSL1.1.1l,而CentOS7.9默认的openssl版本为1.0.2k,在正式安装还需要升级openssl,可参考CentOS7.9升级OpenSSL1.1.1w
创建安装目录
YashanDB的安装使用安装前准备阶段创建的yashan系统用户执行。
cd ~
mkdir install
安装程序准备
将安装包上传到/home/yashan/install目录下,并解压
[yashan@yasdb1 ~]$ cd ./install/
[yashan@yasdb1 install]$ ls -la *.tar.gz
-rw-rw-r--. 1 yashan yashan 183555278 Jul 29 10:18 yashandb-personal-23.2.3.100-linux-x86_64.tar.gz
[yashan@yasdb1 install]$
[yashan@yasdb1 install]$ tar -zxf yashandb-personal-*.tar.gz
[yashan@yasdb1 install]$ ll
total 179296
drwxrwxr-x. 6 yashan yashan 70 Jul 8 05:12 admin
drwxrwxr-x. 2 yashan yashan 229 Jul 8 05:12 bin
drwxrwxr-x. 2 yashan yashan 199 Jul 30 10:00 conf
drwxrwxr-x. 4 yashan yashan 33 Jul 8 05:12 ext
-rw-rw-r--. 1 yashan yashan 10698 Jul 8 05:12 gitmoduleversion.dat
drwxrwxr-x. 2 yashan yashan 42 Jul 8 05:12 include
drwxrwxr-x. 3 yashan yashan 17 Jul 8 05:12 java
drwxrwxr-x. 2 yashan yashan 4096 Jul 8 05:12 lib
-rw-r-----. 1 yashan yashan 14989 Jul 8 05:12 LICENSE
drwxrwxr-x. 3 yashan yashan 41 Jul 30 09:59 om
drwxrwxr-x. 3 yashan yashan 21 Jul 8 05:12 plug-in
drwxrwxr-x. 2 yashan yashan 61 Jul 8 05:12 scripts
-rw-rw-r--. 1 yashan yashan 183555278 Jul 29 10:18 yashandb-personal-23.2.3.100-linux-x86_64.tar.gz
[yashan@yasdb1 install]$
生成参数文件
执行如下yasboot package命令生成安装参数文件,ssh登录密码为创建yashan用户时指定的密码,请将--ip
参数后面的值更换成安装服务端所在服务器的IP地址(使用127.0.0.1会导致客户端无法连接至服务端),执行成功后,生成host.toml文件
[yashan@yasdb1 install]$ ./bin/yasboot package se gen --cluster yashandb -u yashan -p Yasdb123 --ip 192.168.99.165 --port 22 --install-path /data/yashan/yasdb_home --data-path /data/yashan/yasdb_data --begin-port 1688
[yashan@yasdb1 install]$
[yashan@yasdb1 install]$ ll hosts.toml
-rw-------. 1 yashan yashan 462 Aug 2 21:37 hosts.toml
[yashan@yasdb1 install]$ cat hosts.toml
uuid = "66ad89d9b08c38dc405e90ed2b69173f"
cluster = "yashandb"
yas_type = "SE"
secret_key = "3c5aa474550beb76"
add_yasdba = true
[om]
hostid = "host0001"
[om.config]
LISTEN_ADDR = "192.168.99.165:1675"
[[host]]
hostid = "host0001"
group = "yashan"
user = "yashan"
password = "Yasdb123"
ip = "192.168.99.165"
port = 22
path = "/data/yashan/yasdb_home"
[host.yasagent]
[host.yasagent.config]
LISTEN_ADDR = "192.168.99.165:1676"
[yashan@yasdb1 install]$
执行安装
执行如下命令安装YashanDB数据库,如实际安装数据库版本与示例中版本不同,请将-i
参数后的软件包名称更改成实际名称,安装成功后,会生产yashandb.toml文件
[yashan@yasdb1 install]$ ./bin/yasboot package install -t hosts.toml -i yashandb-personal-23.2.3.100-linux-x86_64.tar.gz
checking install package...
install version: yashandb 23.2.3.100
host0001 100% [====================================================================] 27s
update host to yasom...
[yashan@yasdb1 install]$
[yashan@yasdb1 install]$ ll yashandb.toml
-rw-------. 1 yashan yashan 775 Aug 2 21:37 yashandb.toml
[yashan@yasdb1 install]$ cat yashandb.toml
cluster = "yashandb"
create_simple_schema = false
uuid = "66ad89d9b08c38dc405e90ed2b69173f"
yas_type = "SE"
[[group]]
database_role = "primary"
group_type = "db"
name = "dbg1"
[group.config]
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0001"
role = 1
[group.node.config]
CGROUP_ROOT_DIR = "/sys/fs/cgroup"
LISTEN_ADDR = "192.168.99.165:1688"
REPLICATION_ADDR = "192.168.99.165:1689"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.2.3.100/log/yashandb/db-1-1/run"
RUN_LOG_LEVEL = "INFO"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.2.3.100/log/yashandb/db-1-1/slow"
[yashan@yasdb1 install]$
执行部署
执行如下命令部署YashanDB数据库,当出现status: SUCCESS则表示部署成功。
$ ./bin/yasboot cluster deploy -t yashandb.toml
......
task completed, status: SUCCESS
环境变量配置
执行如下命令配置环境变量,使用source命令即时生效。
$ cd /data/yashan/yasdb_home/yashandb/23.2.3.100/conf
# 如~/.bashrc中已存在YashanDB相关的环境变量,将其清除
$ cat yashandb.bashrc >> ~/.bashrc
$ source ~/.bashrc
设置SYS用户密码
为了安全考虑,初始安装后,SYS密码是需要单独设置的,不提供初始密码,使用yaspwd密码设置密码。
$ cd /data/yashan/yasdb_data/db-1-1/instance
$ mv yasdb.pwd yasdb1.pwd
$ yaspwd file=yasdb.pwd
Enter password for SYS:
查看数据库状态
执行如下命令查看YashanDB数据库状态,如显示出数据库状态信息即为安装成功。
[yashan@yasdb1 install]$ yasboot cluster status -c yashandb
host_id | node_type | nodeid | pid
---------------------------------------
host0001 | db | 1-1:1 | 12870
----------+-----------+--------+-------
[yashan@yasdb1 install]$
注意:通过yasboot安装的YashanDB默认不具备守护进行monitor相关功能,当服务器重启后,查看数据库状态会报connection refused的错误,需按顺序启动yasom,yasagent,待yasom和yasagent进程启动后,才能启动数据库。
可参考守护进程进行安装后的环境配置,开启monitor功能。
[yashan@yasdb1 install]$ yasboot cluster status -c yashandb
dial tcp 192.168.99.165:1675: connect: connection refused
[yashan@yasdb1 install]$ yasboot process yasom start -c yashandb
warning: watch yasom error: monitor failed, stdout: , stderr: bash: monit: command not found
start yasom successfully
[yashan@yasdb1 install]$ yasboot process yasagent start -c yashandb
warning: watch yasagent error: monitor failed, stdout: , stderr: bash: monit: command not found
start local agent successfully!
[yashan@yasdb1 install]$ yasboot cluster status -c yashandb
host_id | node_type | nodeid | pid
-------------------------------------
host0001 | db | 1-1:1 | off
----------+-----------+--------+-----
[yashan@yasdb1 install]$ yasboot cluster start -c yashandb
type | uuid | name | hostid | index | status | return_code | progress | cost
-----------------------------------------------------------------------------------------------------------
task | 064038ce55c353e0 | StartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 7
------+------------------+-------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
[yashan@yasdb1 install]$
使用yasql连接数据库
[yashan@yasdb1 install]$ yasql sys/Yasdb123!
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 now() from dual;
NOW()
------------------------------------------------
2024-08-02
1 row fetched.
SQL> select * from v$version;
BANNER VERSION_NUMBER
---------------------------------------------------------------- -----------------
Personal Edition Release 23.2.3.100 x86_64 23.2.3.100
1 row fetched.
SQL> select STATUS,VERSION,STARTUP_TIME,DATA_HOME from v$instance;
STATUS VERSION STARTUP_TIME DATA_HOME
------------- ---------------------------------------------------------------- ---------------------------------------------------------------- ----------------------------------------------------------------
OPEN Personal Edition Release 23.2.3.100 x86_64 2024-08-02 21:52:12.216030 /data/yashan/yasdb_data/db-1-1
1 row fetched.
SQL>
YashanDB认证
#yashandb#,YCA官方报名:免费考数据库证书,五重好礼等你来解锁!
免费报名邀请:2024 YCA认证 报名表 1月份YCA:1月10日-1月17日(已结束)3月份YCA:3月06日-3月12日(已结束)...https://jsj.top/f/GGXYlU?referred_from=yGaalrvg