53dd2e7113 | ||
---|---|---|
.. | ||
data | ||
media | ||
schema | ||
src | ||
README.md |
README.md
Bookings
Bookings is a web application written in ReactJS and NodeJS that, backed by the power of the MariaDB Node Connector and the MariaDB X4 Platform, unleashes the power of smart transactions on hundreds of millions of records with sub-second query performance without having to add any indexes!
This README
will walk you through the steps for getting this app up and running (locally) within minutes!
Table of Contents
- Getting started with MariaDB and Hybrid Transactional-Analytical Processing
- Requirements to run the app
- Getting started with the app
- Smart Transactions
- Cross-Engine Queries
- Support and Contribution
Overview
Introduction to MariaDB
MariaDB platform unifies MariaDB TX (transactions) and MariaDB AX (analytics) so transactional applications can retain unlimited historical data and leverage powerful, real-time analytics in order to provide data-driven customers with more information, actionable insight and greater value – and businesses with endless ways to monetize data. It is the enterprise open source database for hybrid transactional/analytical processing at scale.
Deploying MariaDB Hybrid Transactional-Analytical Processing (HTAP)
MariaDB Platform supports Hybrid Transactional-Analytical Processing (HTAP) through a combination of MariaDB Enterprise Server, MariaDB ColumnStore, and MariaDB MaxScale.
Here's a simple architecture diagram of MariaDB X4 Platform.
To deploy MariaDB HTAP check out the instructions here.
Create the schema
Execute create.sql within your instance of MariaDB X4.
Loading Flights data into ColumnStore
Instructions on retrieving and importing the flights dataset into a MariaDB ColumnStore database (within HTAP) can be here. Please note that he scripts provided within that repository only targets data for the year 2019 (~7.5 million records).
Note If you'd like to retrieve data spanning from 1990 to 2020 (~182 million records) please use the following scripts in place of the ones provided here.
Of course, you can also modify the scripts to fit your needs.
Setting up HTAP Replication
Using MariaDB Replication, MariaDB Enterprise Server replicates writes from InnoDB tables to the MariaDB ColumnStore tables, ensuring that the application can perform analytical processing on current data. Combining MariaDB Replication with MariaDB MaxScale configured as a Binlog Server, MariaDB Enterprise Server can host InnoDB and ColumnStore on the same Server.
This application uses replication on a single table called "Flights", which exists in the InnoDB and ColumnStore instances. In order to set up replication add the following to /etc/my.cnf
for your HTAP instance.
[replication-filter]
type = filter
module = binlogfilter
match = /[.]flights/
rewrite_src = innodb
rewrite_dest = columnstore
For more information on configuring MariaDB HTAP please review the official Enterprise Documentation.
Requirements to run the app
This project assumes you have familiarity with building web applications using ReactJS and NodeJS technologies.
The following is required to run this application:
- Download and install MariaDB HTAP.
- Download and install NodeJS.
- git (Optional) - this is required if you would prefer to pull the source code from GitHub repo.
- Create a free github account if you don’t already have one
- git can be downloaded from git-scm.org
Getting started with the app
Grab the code
Download this code directly or use git (through CLI or a client) to retrieve the code.
Configure the code
Configure the MariaDB connection by adding an .env file to the Node.js project.
Example implementation:
DB_HOST=<host_address>
DB_PORT=<port_number>
DB_USER=<username>
DB_PASS=<password>
DB_NAME=<database>
Build the code
Once you have retrieved a copy of the code you're ready to build and run the project! However, before running the code it's important to point out that the application uses several Node Packages.
Executing the CLI command npm install
within the src AND client folders will target the the relative package.json
file and install all dependencies.
For more information on npm install
check out the Official Node.js Documentation.
Run the app
Once you've pulled down the code and have verified that all of the required Node packages are installed you're ready to run the application! It's as easy as 1,2,3.
- Using a command line interface (CLI) navigate to the
src
directory.
- Run the command:
npm start
- Open a browser window and navigate to http://localhost:3000.
Smart Transactions
At this point you're probably wondering, what are smart transactions?
At their core, smart transactions are the standard transactions that databases have been performing for decades – ultimately powering the online interactions we’ve become accustomed to. The difference with modern applications is the use of real-time analytics before, during and/or after these transactions.
Pre-transaction
This application uses real-time analytics before a flight is booked. Each flight ticket option contains information calculated from the historical records (average delay, average duration, flight score, etc.) within the flights
table.
Post-transaction
This application also uses real-time analytics after a flight has been booked, and a trip has been created.
Cross-Engine Queries
This application uses cross-engine queries to maximize the potentials of the MariaDB X4 Platform. Cross-engine querying is the ability to access, via MaxScale, both the transactional and analytics data within a single query.
Support and Contribution
Thanks so much for taking a look at the Bookings app! As this is a very simple example, there's plenty of potential for customization. Please feel free to submit PR's to the project to include your modifications!
If you have any questions, comments, or would like to contribute to this or future projects like this please reach out to us directly at developers@mariadb.com or on Twitter.