Skip to main content

Databases

Installation of each database can be done with instructions below.

Redis

Installation

Run with elevated privledges

sudo su

Install Redis

apt update && apt install redis

Enable Redis Service

systemctl enable redis-server

Configuration

Configure Redis by editing /etc/redis/redis.conf

Allow remote connections by commenting out binding

# bind 127.0.0.1 -::1

Set database password by uncommenting the following line and replaceing foobared

requirepass foobared

Start Server

Start Redis server

systemctl start redis-server

QuestDb

Preinstallation

Make sure you have Java installed

sudo apt update && sudo apt install default-jre

We need to edit the maximum open file limits

sudo nano /etc/sysctl.conf
note

fs.file-max=1048576

Installation

Get the latest version of QuestDb

wget https://github.com/questdb/questdb/releases/download/8.1.4/questdb-8.1.4-rt-linux-x86-64.tar.gz

Untar the file

tar -xvzf https://github.com/questdb/questdb/releases/download/8.1.4/questdb-8.1.4-rt-linux-x86-64.tar.gz

Capacity Planning

You should read QuestDb's documentation on capacity planning as you can have fairly large database improvements by adjusting specific parameters Capacity Planning

Start QuestDb

You can start QuestDb via the following command

bash /home/your_username/questdb-8.1.4-rt-linux-x86-64/bin/questdb.sh start

PostGresDb

Installation

Run with elevated privledges

sudo su

Install PostGreSql

apt install postgresql postgresql-contrib

Enable PostGreSql Service

systemctl start postgresql.service

Switch to postgres user

sudo -i -u postgres

Open psql

psql

Set user with password

CREATE ROLE app SUPERUSER
LOGIN
PASSWORD 'moreSecurePass';

Let user login

ALTER ROLE 'app' WITH LOGIN;

Exit psql

\q

Edit server to allow remote connections

sudo nano /etc/postgresql/12/main/postgresql.conf

Modify the #listen_addresses = 'localhost' to '*' and modify max_connections to 1000, we will have many microservices and it's a good idea to increase the max connections now

listen_addresses = '*'
max_connections = 1000

Edit connections

sudo nano /etc/postgresql/12/main/pg_hba.conf

Modify the section:

# IPv4 local connections: 
host all all 127.0.0.1/32 md5

To:

# IPv4 local connections:
host all all 0.0.0.0/0 md5

Restart Service

systemctl restart postgresql.service