How to Get Started with StoneDB: A One-Stop Real-Time HTAP Database

Sep 26, 2022 | Programming

Welcome to the exciting world of StoneDB! If you are looking to harness the power of a high-performance hybrid transaction-analytical processing (HTAP) database, you have come to the right place. StoneDB enables seamless analytical processing capabilities for your MySQL databases without requiring any code changes. Whether you’re a seasoned developer or a curious newcomer, this guide will walk you through setting up StoneDB effectively.

What is StoneDB?

StoneDB is a MySQL-compatible database that greatly enhances your data processing capabilities, boasting up to 10 times the query and load performance compared to traditional options like InnoDB. Imagine StoneDB as a racecar compared to a standard car—both will get you where you want to go, but one will do it with thrilling speed! With an impressive compression ratio ranging from 10:1 to 40:1, it’s the perfect solution for data-intensive applications.

Getting Started

This section will guide you through the essential steps to install and configure StoneDB, including creating your first table and transitioning from an existing MySQL database.

Supported Platforms

StoneDB supports the following operating systems:

  • CentOS 7.x or higher
  • Ubuntu 20.04 or higher
  • Red Hat Enterprise Linux 7 (RHEL 7.x)

Ensure you have the right compiler toolsets and packages to avoid any install hiccups.

Build StoneDB from Source Code in a Docker Container

For swift deployment, you can use Docker to quickly set up StoneDB. For a detailed guide, check out the section on Compile StoneDB in a Docker Container. Alternatively, if you prefer a traditional installation, read on.

Build StoneDB from the Source Code

Depending on your operating system, the build instructions may vary:

Configure StoneDB

After installation, it’s time to configure your StoneDB instance. Ensure that you adjust the my.cnf file with the following:

[mysqld]
default-storage-engine=tianmu
default-tmp-storage-engine=MyISAM
binlog-format=STATEMENT

Initialize and Start Your Database Instance

Initialize your database with the following commands:

cd pathtoyourpath/bin 
./mysql_install_db --basedir=stonedbinstall --datadir=stonedbinstalldata --user=mysql

Next, start your database instance:

mysqld_safe --defaults-file=pathtomy.cnf --user=mysql

Create a StoneDB Table

To create a table using the tianmu engine, you must execute this command:

CREATE TABLE example_table (
    id1 bigint(20) NOT NULL DEFAULT 0,
    id1_type int(10) NOT NULL DEFAULT 0,
    id2 bigint(20) NOT NULL DEFAULT 0,
    id2_type int(10) NOT NULL DEFAULT 0,
    data varchar(255) NOT NULL DEFAULT '',
    time bigint(20) NOT NULL DEFAULT 0,
    version int(11) NOT NULL DEFAULT 0
) ENGINE=tianmu;

Think of this table creation as setting up a new room in a house (your database). Each column represents a piece of furniture, neatly storing different types of information to keep your space organized.

Switch from MySQL to StoneDB in Production

If you’re considering using both InnoDB and StoneDB, remember to adjust the stonedb_ini_allowmysqlquerypath to 1 in your my.cnf file. For online migration, you’ll need to migrate your data logically to ensure a smooth transition without downtime.

  • Create a StoneDB instance and tables.
  • Copy all database and table schemas.
  • Dump your tables to files with SELECT … INTO OUTFILE.
  • Load them into StoneDB using LOAD DATA … INFILE.

Documentation and Further Assistance

For extensive documentation, visit stonedb.io. You’ll find detailed guides, examples, and other essential information that can enhance your experience with StoneDB.

Troubleshooting Ideas

If you encounter any issues during your StoneDB setup or migration, consider the following troubleshooting tips:

  • Check that your system meets the supported platform requirements.
  • Review your my.cnf settings for any discrepancies.
  • Ensure all prerequisite packages are installed correctly.
  • Consult the documentation for insights into specific error messages.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox