Difference between revisions of "MariaDB"

From Coders.Bay Wiki
Jump to navigation Jump to search
(Replaced content with "==MariaDB==")
Tag: Replaced
Line 1: Line 1:
==MariaDB==
==What is MariaDB==
====Introduction to MariaDB====
 
MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system (RDBMS), intended to remain free and open-source software under the GNU General Public License. Development is led by some of the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle Corporation in 2009.
 
 
SQL databases store data in tabulator format. So this data is stored in a predefined data model which is not so flexible.
<br/>Modern applications are more connected, interactive and need's to be flexible.
<br/>So all these Applications getting more and more data and need's to be flexible and accessing it are higher rates.
 
=====What are the main features of MongoDB=====
* '''Document Oriented:''' MongoDB stores the main subject in the minimal number of documents and not by breaking it up into multiple relational structures like RDBMS (Relational Database Management System).
 
* '''Indexing:''' Without indexing, a database would have to scan every document of a collection to select those that match the query which would be inefficient. <br />So, for efficient searching Indexing is a must and MongoDB uses it to process huge volumes of data in very less time.
 
* '''Scalability:''' MongoDB scales horizontally using sharding (partitioning data across various servers). <br />Data is partitioned into data chunks using the shard key, and these data chunks are evenly distributed across shards that reside across many physical servers. Also, new machines can be added to a running database.
 
* '''Replication and High Availability:''' MongoDB increases the data availability with multiple copies of data on different servers. <br />By providing redundancy, it protects the database from hardware failures. If one server goes down, the data can be retrieved easily from other active servers which also had the data stored on them.
 
* '''Aggregation:''' Aggregation operations process data records and return the computed results. It is similar to the GROUPBY clause in SQL.
 
Relational Database Management System (RDBMS) is not the correct choice when it comes to handling big data. If the database runs on a single server, then it will reach a scaling limit. <br />NoSQL databases are more scalable and provide superior performance.
MongoDB is as already said a NoSQL database that scales by adding more and more servers and increases productivity with its flexible document model.
 
=====Why is MongoDB preferred over RDBMS like Oracle or MariaDB=====
*Big Data: As already said, if you have huge amount of data to be stored in tables, think of MongoDB before RDBMS databases. MongoDB has built-in solution for partitioning and sharding your database.
*Unstable Schema: Adding a new column in RDBMS is hard whereas MongoDB is schema-less. Adding a new field does not effect old documents and will be very easy.
*Distributed data: Since multiple copies of data are stored across different servers, recovery of data is instant and safe even if there is a hardware failure.
 
=====What language is supported by MongoDB=====
MongoDB currently provides official driver support for all popular programming languages like C, C++, C#, Java, Node.js, Perl, PHP, Python, Ruby, Rust, Scala, Go, and Erlang.
 
==What is NoSQL==
====Introduction to NoSQL====
As already said NoSQL is a non relational database that provides a mechanism for storage and retrieval of data. NoSQL databases are used in real-time web applications and big data and their use are increasing over time. <br/>NoSQL systems are also sometimes called Not only SQL to emphasize the fact that they may support SQL-like query languages.
A NoSQL database includes simplicity of design, simpler horizontal scaling to clusters of machines and finer control over availability. <br />The data structures used by NoSQL databases are different from those used by default in relational databases which makes some operations faster in NoSQL.
 
=====When should NoSQL be used=====
*When huge amount of data need to be stored and retrieved.
 
*The relationship between the data you store is not that important.
 
*The data changing over time and is not structured.
 
*Support of Constraints and Joins is not required at database level.
 
*The data is growing continuously and you need to scale the database regular to handle the data.
 
==How to install it==
====Getting Started====
There are two ways to work with MongoDB on your computer locally.
 
=====MongoDB with GUI=====
To install MongoDB locally you have to go to the [https://www.mongodb.com/try/download/community MongoDB website] and download the Community version for your operating system.
Once downloaded you have to extract the folder and open the "install_compass" file.
<br/>[[File:install_compass.png]]
<br/>Now the GUI for MongoDB is installed.
<br/>[[File:mongodb_compass.png|500px]]
<br/>
<br/>If you don't want to install MongoDB via terminal skip the next step.
 
=====MongoDB with Terminal=====
To install MongoDB locally over Terminal you have to go to the [https://docs.mongodb.com/manual/administration/install-community/ MongoDB website] choose your operating system and follow the construction to add it on your Terminal.
<br/>Now the Terminal version for MongoDB is installed.
<br/>[[File:mongodb_terminal.png|500px]]
 
====Working with MongoDB====
 
=====Create your first Database=====
I highly recommend to use the Mongo Compass.
<br/>So to connect to the localhost just click "Connect" and the app will connect you to your localhost.
<br/>[[File:mongodb_compass_connect.png|500px]]
 
<br/>Now you can easy create a new database.
# Click "Create database". <br/>[[File:mongodb_compass_create_database.png|500px]]
# Give the Database a name and the Collection too, like "TENNIS" and "PLAYERS". <br/>[[File:mongodb_compass_name_db.png|500px]]
# Click now on the Database which was created by you for example "TENNIS".
# Click "Create collection". <br/>[[File:mongodb_compass_create_collection.png|500px]]
# Give the Collection a name, like "TEAMS". <br/>[[File:mongodb_compass_name_cl.png|500px]]
<br/>
=====Insert your first Data=====
After you create the database and all of your collections, you can start inserting data to it.
# Click on a Collection where you want to add some data for EXAMPLE "PLAYERS".
# Click now on "ADD DATA" and then on "Insert Document". <br/>[[File:mongodb_compass_insert_document.png|500px]]
# Now you can add your data inside. <br/>[[File:mongodb_compass_insert_yourdata.png|500px]]
# But you also can add an existing file into it <br/> click on "ADD DATA" and then on "Import File". <br/>[[File:mongodb_compass_insert_file.png|500px]]
# Now you can choose your file, the type and then import it to your Database. <br/>[[File:mongodb_compass_insert_yourfile.png|500px]]
<br/>
=====Create your first Query=====
After you import or insert all your data into the database you can start making some queries.
<br/>Just click on the "FILTER" type in your query and press "FIND". <br/>[[File:mongodb_compass_queries.png|500px]]
 
<br/>For more information how to use it please visit the [https://docs.mongodb.com/manual/ MongoDB manual].
<br/>
<br/>
'''''Made with &#x2665;&#xfe0e; by Emanuel Leutgeb'''''

Revision as of 08:58, 8 April 2022

What is MariaDB

Introduction to MariaDB

MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system (RDBMS), intended to remain free and open-source software under the GNU General Public License. Development is led by some of the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle Corporation in 2009.


SQL databases store data in tabulator format. So this data is stored in a predefined data model which is not so flexible.
Modern applications are more connected, interactive and need's to be flexible.
So all these Applications getting more and more data and need's to be flexible and accessing it are higher rates.

What are the main features of MongoDB
  • Document Oriented: MongoDB stores the main subject in the minimal number of documents and not by breaking it up into multiple relational structures like RDBMS (Relational Database Management System).
  • Indexing: Without indexing, a database would have to scan every document of a collection to select those that match the query which would be inefficient.
    So, for efficient searching Indexing is a must and MongoDB uses it to process huge volumes of data in very less time.
  • Scalability: MongoDB scales horizontally using sharding (partitioning data across various servers).
    Data is partitioned into data chunks using the shard key, and these data chunks are evenly distributed across shards that reside across many physical servers. Also, new machines can be added to a running database.
  • Replication and High Availability: MongoDB increases the data availability with multiple copies of data on different servers.
    By providing redundancy, it protects the database from hardware failures. If one server goes down, the data can be retrieved easily from other active servers which also had the data stored on them.
  • Aggregation: Aggregation operations process data records and return the computed results. It is similar to the GROUPBY clause in SQL.

Relational Database Management System (RDBMS) is not the correct choice when it comes to handling big data. If the database runs on a single server, then it will reach a scaling limit.
NoSQL databases are more scalable and provide superior performance. MongoDB is as already said a NoSQL database that scales by adding more and more servers and increases productivity with its flexible document model.

Why is MongoDB preferred over RDBMS like Oracle or MariaDB
  • Big Data: As already said, if you have huge amount of data to be stored in tables, think of MongoDB before RDBMS databases. MongoDB has built-in solution for partitioning and sharding your database.
  • Unstable Schema: Adding a new column in RDBMS is hard whereas MongoDB is schema-less. Adding a new field does not effect old documents and will be very easy.
  • Distributed data: Since multiple copies of data are stored across different servers, recovery of data is instant and safe even if there is a hardware failure.
What language is supported by MongoDB

MongoDB currently provides official driver support for all popular programming languages like C, C++, C#, Java, Node.js, Perl, PHP, Python, Ruby, Rust, Scala, Go, and Erlang.

What is NoSQL

Introduction to NoSQL

As already said NoSQL is a non relational database that provides a mechanism for storage and retrieval of data. NoSQL databases are used in real-time web applications and big data and their use are increasing over time.
NoSQL systems are also sometimes called Not only SQL to emphasize the fact that they may support SQL-like query languages. A NoSQL database includes simplicity of design, simpler horizontal scaling to clusters of machines and finer control over availability.
The data structures used by NoSQL databases are different from those used by default in relational databases which makes some operations faster in NoSQL.

When should NoSQL be used
  • When huge amount of data need to be stored and retrieved.
  • The relationship between the data you store is not that important.
  • The data changing over time and is not structured.
  • Support of Constraints and Joins is not required at database level.
  • The data is growing continuously and you need to scale the database regular to handle the data.

How to install it

Getting Started

There are two ways to work with MongoDB on your computer locally.

MongoDB with GUI

To install MongoDB locally you have to go to the MongoDB website and download the Community version for your operating system. Once downloaded you have to extract the folder and open the "install_compass" file.
Install compass.png
Now the GUI for MongoDB is installed.
Mongodb compass.png

If you don't want to install MongoDB via terminal skip the next step.

MongoDB with Terminal

To install MongoDB locally over Terminal you have to go to the MongoDB website choose your operating system and follow the construction to add it on your Terminal.
Now the Terminal version for MongoDB is installed.
Mongodb terminal.png

Working with MongoDB

Create your first Database

I highly recommend to use the Mongo Compass.
So to connect to the localhost just click "Connect" and the app will connect you to your localhost.
Mongodb compass connect.png


Now you can easy create a new database.

  1. Click "Create database".
    Mongodb compass create database.png
  2. Give the Database a name and the Collection too, like "TENNIS" and "PLAYERS".
    Mongodb compass name db.png
  3. Click now on the Database which was created by you for example "TENNIS".
  4. Click "Create collection".
    Mongodb compass create collection.png
  5. Give the Collection a name, like "TEAMS".
    Mongodb compass name cl.png


Insert your first Data

After you create the database and all of your collections, you can start inserting data to it.

  1. Click on a Collection where you want to add some data for EXAMPLE "PLAYERS".
  2. Click now on "ADD DATA" and then on "Insert Document".
    Mongodb compass insert document.png
  3. Now you can add your data inside.
    Mongodb compass insert yourdata.png
  4. But you also can add an existing file into it
    click on "ADD DATA" and then on "Import File".
    Mongodb compass insert file.png
  5. Now you can choose your file, the type and then import it to your Database.
    Mongodb compass insert yourfile.png


Create your first Query

After you import or insert all your data into the database you can start making some queries.
Just click on the "FILTER" type in your query and press "FIND".
Mongodb compass queries.png


For more information how to use it please visit the MongoDB manual.

Made with ♥︎ by Emanuel Leutgeb