A high-performance, in-memory, key-value NoSQL database, inspired by Redis and written in C++.
SimpleDB is an implementation of a key-value database that operates entirely in memory, aiming for simplicity and speed. Inspired by the architecture and commands of Redis, this project was developed as a practical study of data structures, network programming (sockets), and multithreading in C++.
The server listens for TCP connections and interprets simple text commands to manipulate data, making it a lightweight and easy-to-interact-with tool.
- CRUD Operations: Support for essential
GET,SET, andDELETEcommands. - Additional Commands: Includes
EXISTSto check for a key's existence andKEYSto list all keys. - Multithreading: The server is capable of handling multiple clients simultaneously by dedicating a thread to each connection.
- TCP/IP Communication: Interaction with the database occurs through a socket server, using clients like
netcatortelnet. - Simplified Build: Uses a
Makefileto automate the compilation process.
- C++: The main language of the project (using C++17 features).
- Makefile: For build automation.
- Sockets API (POSIX): For TCP network communication.
To compile and run the project, you will need:
- A C++ compiler (like
g++) make
- Clone the repository:
git clone [https://github.com/theokiwi/simpledb.git](https://github.com/theokiwi/simpledb.git) cd simpledb - Compile the project:
The
Makefilewill handle the compilation of both the server (db_main) and the client (client_main).make
- Run the DB Server:
In a terminal window, start the database server. It will listen for connections.
./db_main
In a separate terminal, use the client_main executable to interact with the database server.
- To start the DB:
./db_main
- To insert into the DB:
./client_main simpledb insert key value
- To remove from the DB:
./client_main simpledb remove value
- To update the DB:
./client_main simpledb update oldValue newValue
- To search the DB:
./client_main simpledb search value
- To stop the DB server:
./client_main simpledb quit
- To exit the client:
./client_main quit
Theo - GitHub