StoneDB 初体验 | StoneDB-5.7-v1.0.4 安装及新特性速览

StoneDB 初体验 | StoneDB-5.7-v1.0.4 安装及新特性速览

严少安 Lv.6

来都来了,点个 Star 吧,799 颗星了。🌟🌟🌟

stonedb1.png

StoneDB 是由石原子科技公司自主设计、研发的国内首款基于 MySQL 内核打造的开源 HTAP(Hybrid Transactional and Analytical Processing)融合型数据库,可实现与 MySQL 的无缝切换。StoneDB 具备超高性能、实时分析等特点,为用户提供一站式 HTAP 解决方案。

StoneDB 100% 兼容 MySQL 5.6、5.7、8.0 协议和 MySQL 生态等重要特性,支持 MySQL 常用的功能及语法,支持 MySQL 生态中的系统工具和客户端,如 Navicat、Workbench、mysqldump、mydumper。由于 100% 兼容 MySQL,因此 StoneDB 的所有工作负载都可以继续使用 MySQL 数据库体系运行。

StoneDB 专门针对 OLAP 应用程序进行了设计和优化,支持百亿数据场景下进行高性能、多维度字段组合的复杂查询,相对比社区版的 MySQL,其查询速度提升了十倍以上。

StoneDB 采用基于知识网格技术和列式存储引擎,该存储引擎为海量数据背景下 OLAP 应用而设计,通过列式存储数据、知识网格过滤、高效数据压缩等技术,为应用系统提供低成本和高性能的数据查询支持。

stonedb2.png

安装

StoneDB 官方提供了 RPM 包,可以快速体验 StoneDB,下面是安装步骤。

1. 下载

可以从 GitHub 或者 Gitee 进行下载。也可从官网找到下载链接,不过官网的链接也指向了 GitHub。

1
wget https://github.com/stoneatom/stonedb/releases/download/5.7-v1.0.4-alpha/stonedb-ce-5.7-v1.0.4-alpha.el7.x86_64.rpm

2. 安装

直接 Yum 安装即可,无需额外安装其他依赖。

1
sudo yum install stonedb-ce-5.7-v1.0.4-alpha.el7.x86_64.rpm

3. 启动

无需预先调整配置,一键启动,开箱即用。需要注意的是,安装时已将文件目录的属主变更为 mysql, 所以需要使用 mysql 用户进行启动。

1
2
3
4
5
6
7
8
9
[mysql@centos7 ~]$ /opt/stonedb57/install/mysql_server start
Starting Stonedbbasedir::: /opt/stonedb57/install/
bindir::: /opt/stonedb57/install//bin
datadir::: /opt/stonedb57/install/data/
mysqld_pid::: /opt/stonedb57/install/data/mysqld.pid
.2023-07-05T01:45:12.486648Z mysqld_safe Logging to '/opt/stonedb57/install/data/centos7.shawnyan.com.err'.
2023-07-05T01:45:12.520868Z mysqld_safe Starting mysqld daemon with databases from /opt/stonedb57/install/data
....................[ OK ]
[mysql@centos7 ~]$

4. 安装成功

安装成功后,登陆 StoneDB,可以看到版本号为:5.7.36-StoneDB-v1.0.4},emm… 这里多了个 } 🧐

1
2
3
4
5
6
7
8
9
10
11
12
13
[mysql@centos7 ~]$ cat /opt/stonedb57/install/data/mysqld.log |grep password
2023-07-05T01:29:07.594205Z 1 [Note] A temporary password is generated for root@localhost: KrsiqidHq6:k
[mysql@centos7 ~]$ /opt/stonedb57/install/bin/mysql -uroot -p -S /opt/stonedb57/install/tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.36-StoneDB-v1.0.4}

Copyright (c) 2021, 2022 StoneAtom Group Holding Limited
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter user 'root'@'localhost' identified by 'stonedb123';
Query OK, 0 rows affected (0.00 sec)
stonedb3.png

5. 可以使用 GUI 工具连接

可以新建用户,并用 GUI 工具连接,更加直观方便快捷的感受 StoneDB。

stonedb4.png

新特性体验

1. 支持 update ignore 语法

当更新 TIANMU 引擎的表时,主键冲突的记录将被跳过,并执行后续的更新操作。

关于 TIANMU 引擎, 是 StoneDB 的默认引擎,当前版本支持 MySQL 5.7,具体基线版本为 MySQL 5.7.36,这使得 StoneDB 可以兼容 MySQL 5.7 协议。

1
2
3
4
5
6
7
8
9
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
...
| TIANMU | DEFAULT | Tianmu storage engine | YES | NO | NO |
...
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.00 sec)

演示示例:

创建测试表

1
2
3
4
CREATE DATABASE sbtest;
USE sbtest;
CREATE TABLE t1 (id INT(11) NOT NULL AUTO_INCREMENT, parent_id INT(11) DEFAULT '0' NOT NULL, LEVEL TINYINT(4) DEFAULT '0' NOT NULL, PRIMARY KEY (id)) ENGINE=TIANMU;
INSERT INTO t1 VALUES (3,1,1),(4,1,1);

然后执行 update ignore 语句

1
2
3
mysql> update ignore t1 set id = id + 1;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
stonedb5.png

2. 支持 GROUP_CONCAT 聚合方法

测试表延用上例,具体演示如下:

1
2
3
4
5
6
7
mysql> select GROUP_CONCAT(t.id) from t1 t;
+--------------------+
| GROUP_CONCAT(t.id) |
+--------------------+
| 8,8 |
+--------------------+
1 row in set (0.00 sec)

3. 支持在 union, union all 中使用 select <数字> 或者 select <数字> from dual

测试表延用上例,具体演示如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mysql> select id from t1 union select 1;
+----+
| id |
+----+
| 8 |
| 1 |
+----+
2 rows in set (0.00 sec)

mysql> select id from t1 union all select 2 from dual;
+----+
| id |
+----+
| 8 |
| 8 |
| 2 |
+----+
3 rows in set (0.00 sec)

遇到的问题与建议

  1. github 上的 Release Assets 建议加上 md5/sha256 校验码

  2. centos 7.9 上安装时遇到冲突,需要先移除冲突的包,再进行安装

1
2
3
4
Transaction check error:
file /usr/lib64/libsnappy.so.1 from install of stonedb_5.7-1.0.4-1.el7.x86_64 conflicts with file from package snappy-1.1.0-3.el7.x86_64
file /usr/lib64/libmarisa.so.0 from install of stonedb_5.7-1.0.4-1.el7.x86_64 conflicts with file from package marisa-0.2.4-4.el7.x86_64
file /usr/lib64/libzstd.so.1 from install of stonedb_5.7-1.0.4-1.el7.x86_64 conflicts with file from package libzstd-1.5.0-1.el7.x86_64
  1. 如果本机已安装mysql/mariadb 需要先移除冲突的包,再进行安装
1
2
3
4
5
6
  Installing : stonedb_5.7-1.0.4-1.el7.x86_64
ln: failed to create symbolic link ‘/usr/bin/mysql’: File exists
ln: failed to create symbolic link ‘/usr/bin/mysqldump’: File exists
warning: %post(stonedb_5.7-1.0.4-1.el7.x86_64) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package stonedb_5.7-1.0.4-1.el7.x86_64
Verifying : stonedb_5.7-1.0.4-1.el7.x86_64
  1. 最新安装包,这个路径下没有 sourceenv 文件,文档有待更新
    https://stonedb.io/zh/docs/getting-started/quick-deployment/deploy-stonedb-with-rpm

  2. 启动时报错,结果是端口冲突导致的

1
2
3
4
5
6
7
8
9
10
[mysql@centos7 ~]$ /opt/stonedb57/install/mysql_server start
Starting Stonedbbasedir::: /opt/stonedb57/install/
bindir::: /opt/stonedb57/install//bin
datadir::: /opt/stonedb57/install/data/
mysqld_pid::: /opt/stonedb57/install/data/mysqld.pid
2023-07-05T01:34:13.490822Z mysqld_safe Logging to '/opt/stonedb57/install/data/centos7.shawnyan.com.err'.
2023-07-05T01:34:13.519549Z mysqld_safe Starting mysqld daemon with databases from /opt/stonedb57/install/data
.............................2023-07-05T01:34:45.163734Z mysqld_safe mysqld from pid file /opt/stonedb57/install/data/mysqld.pid ended
/opt/stonedb57/install/mysql_server: line 264: kill: (114313) - No such process
[FAILED]

日志里的内容:

1
2
3
2023-07-05T01:30:52.630770Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2023-07-05T01:30:52.630850Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2023-07-05T01:30:52.630879Z 0 [ERROR] Aborting
  1. 文档中的日志路径不对

文档链接为:修改 root 的初始密码

在最新版本中的路径为:

1
2
3
[mysql@centos7 ~]$ cat /opt/stonedb57/install/data/mysqld.log |grep password
2023-07-05T01:29:07.594205Z 1 [Note] A temporary password is generated for root@localhost: KrsiqidHq6:k
[mysql@centos7 ~]$

到此,体验告一段落,总体来说整个过程还是很丝滑的,没有遇到稀奇古怪的问题,不错!
🍬🍬🍬


https://www.modb.pro/db/655984

  • Title: StoneDB 初体验 | StoneDB-5.7-v1.0.4 安装及新特性速览
  • Author: 严少安
  • Created at: 2023-07-05 11:07:21
  • Updated at: 2023-07-05 11:07:21
  • Link: https://shawnyan.cn/2023/stonedb/stonedb-install/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments