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 数据库体系运行。
[shawnyan@rocky9 stonedb]$ ls stonedb-ee-8.0-v2.2.0.el8.x86_64.rpm [shawnyan@rocky9 stonedb]$ sudo yum install ./stonedb-ee-8.0-v2.2.0.el8.x86_64.rpm Last metadata expiration check: 1:31:49 ago on Tue 05 Dec 2023 01:02:18 PM UTC. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: stonedb_2.0 x86_64 2.2.0-1.el8 @commandline 434 M
Total size: 434 M Installed size: 1.1 G Is this ok [y/N]: y Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Error: Transaction test error: file /usr/lib64/libsnappy.so.1 from install of stonedb_2.0-2.2.0-1.el8.x86_64 conflicts with file from package snappy-1.1.8-8.el9.x86_64
[mysql@rocky9 ~]$ mysqld --verbose --help mysqld Ver 8.0.33 for Linux on x86_64 (Source distribution) BuildID[sha1]=150f81d4108e038e942961c325806ba3d1479f58 Copyright (c) 2000, 2023, StoneAtom and/or its affiliates.
StoneDB is a registered trademark of StoneAtom Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Starts the MySQL database server.
Usage: mysqld [OPTIONS]
Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /opt/stonedb_v2/install/etc/my.cnf ~/.my.cnf The following groups are read: mysql_cluster mysqld server mysqld-8.0 The following options may be given as the first argument: ... To see what values a running MySQL server is using, type 'mysqladmin variables' instead of 'mysqld --verbose --help'. 2023-12-05T14:57:05Z UTC - mysqld got signal 11 ; Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware. BuildID[sha1]=150f81d4108e038e942961c325806ba3d1479f58 Thread pointer: 0x0 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 0 thread_stack 0x100000 /opt/stonedb_v2/install/bin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x2e) [0x236c4fe] /opt/stonedb_v2/install/bin/mysqld(print_fatal_signal(int)+0x377) [0x1047637] /opt/stonedb_v2/install/bin/mysqld(handle_fatal_signal+0x95) [0x10476d5] /lib64/libc.so.6(+0x54db0) [0x7fecd2854db0] /opt/stonedb_v2/install/bin/mysqld(Mondetdb_Adaptor::Mondetdb_Adaptor()+0x407) [0x1004f37] /opt/stonedb_v2/install/bin/mysqld(Mondetdb_Adaptor::instance()+0x35) [0x10051c5] /opt/stonedb_v2/install/bin/mysqld() [0xd957a4] /opt/stonedb_v2/install/bin/mysqld() [0xd9c4f7] /opt/stonedb_v2/install/bin/mysqld() [0xda3f98] /opt/stonedb_v2/install/bin/mysqld(mysqld_main(int, char**)+0x2454) [0xdab194] /lib64/libc.so.6(+0x3feb0) [0x7fecd283feb0] /lib64/libc.so.6(__libc_start_main+0x80) [0x7fecd283ff60] /opt/stonedb_v2/install/bin/mysqld(_start+0x2e) [0xd8a46e] The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash. [mysql@rocky9 ~]$
初始化 StoneDB
使用如下命令进行初始化:
1
mysqld --initialize-insecure
初始化成功后,日志显示如下。
1 2 3 4 5 6
[mysql@rocky9 log]$ cat mysqld.log 2023-12-05T15:18:55.368727Z 0 [System] [MY-013169] [Server] /opt/stonedb_v2/install/bin/mysqld (mysqld 8.0.33) initializing of server in progress as process 402224 2023-12-05T15:18:55.393904Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2023-12-05T15:19:07.595251Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2023-12-05T15:21:50.409230Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. [mysql@rocky9 log]$
[mysql@rocky9 log]$ mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.33 Source distribution
Copyright (c) 2000, 2023, StoneAtom and/or its affiliates.
StoneDB is a registered trademark of StoneAtom Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> \s -------------- mysql Ver 8.0.33 for Linux on x86_64 (Source distribution)
Connection id: 8 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.33 Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /opt/stonedb_v2/install/data/mysql.sock Binary data as: Hexadecimal Uptime: 1 min 35 sec
mysql> select * from t1; +------+ | id | +------+ | 1 | +------+ 1 row in set (0.01 sec) mysql> show create table t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( `id` int DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci 1 row in set (0.01 sec) mysql> update t1 setid = 2 where 1=1; ERROR 4164 (HY000): exec sql err: SQLException:sql.execute:25005!Current transaction is aborted (please ROLLBACK) mysql> update t1 setid = 2 whereid = 1; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0
这里再次遇到了 SQL 异常,更新语句条件带有 1=1 时,抛异常。
1 2
mysql> select * into outfile 't2.sql' from t2; ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
[root@rocky9 ~]# ll /tmp/t2.sql -rw-r-----. 1 mysql mysql 0 Dec 5 23:24 /tmp/t2.sql
尝试几次无果,也没找到相关文档说明,暂时先这样。
1 2 3 4 5
mysql> SELECT id INTO OUTFILE '/tmp/t2.txt' -> FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' -> LINES TERMINATED BY '\n' -> FROM t2; ERROR 3136 (42000): ParseException:SQLparser:42000!syntax error, unexpected STRING, expecting SCOLON in: "select id into outfile '/tmp/t2.txt'"
mysql> CREATE FUNCTION hello (s CHAR(20)) -> RETURNS CHAR(50) DETERMINISTIC -> RETURN CONCAT('Hello, ',s,'!'); ERROR 4164 (HY000): exec sql err: SQLException:sql.execute:25005!Current transaction is aborted (please ROLLBACK) mysql> CREATE FUNCTION hello (s CHAR(20)) -> RETURNS CHAR(50) -> RETURN CONCAT('Hello, ',s,'!'); ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) mysql> mysql> mysql> CREATE FUNCTION hello (s CHAR(20)) -> RETURNS CHAR(50) DETERMINISTIC -> RETURN CONCAT('Hello, ',s,'!'); ERROR 4164 (HY000): exec sql err: ParseException:SQLparser:42000!SELECT: no such operator 'concat'(char(7), char(20), char(1)) mysql> mysql> CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN 'Hello!'; Query OK, 0 rows affected (0.02 sec) mysql> SELECT hello(''); +-----------+ | hello('') | +-----------+ | Hello! | +-----------+ 1 row in set (0.00 sec)
mysql> show variables like 'default_storage_engine'; +------------------------+--------+ | Variable_name | Value | +------------------------+--------+ | default_storage_engine | InnoDB | +------------------------+--------+ 1 row in set (0.01 sec)
而且找不到任何关于 Tianmu 的变量,无法创建 Tianmu 引擎的表。
1 2 3 4
mysql> show variables like 'tianmu_%'; Empty set (0.00 sec) mysql> create table student(id int(11) primary key, name varchar(10)) engine=tianmu; ERROR 1286 (42000): Unknown storage engine 'tianmu'