Chirag Tutorial (Chirags.in)

Hi, I’m Chitt Ranjan Mahto "Chirag", a Database Administrator specializing in PostgreSQL, SQL Server, MySQL, Oracle, and MongoDB. On this channel, I share insider tips, hands-on tutorials, and certification guides to help you master real-world databases and cloud platforms like Azure, AWS, GCP, and more.

Whether you’re looking to strengthen your technical skills or prepare for high-value IT certifications, you’ll find a perfect mix of theory, practical demos, and practice tests here to accelerate your career. 🚀

👉 Want access to the PDFs of my course videos and support the channel? Simply join the Thanks Membership, then connect & DM me on:


Chirag Tutorial (Chirags.in)

Free ISC2 Certified in Cybersecurity (CC) | Cybersecurity Certification |Free Certification

inchirags@gmail.com Chirag Certification Tutorial www.chirags.in/
*************************************************************************************
Free ISC2 Certified in Cybersecurity (CC) | Cybersecurity Certification |Free Certification
*************************************************************************************

https://www.youtube.com/watch?v=MmP1X...

Here’s the clean, end-to-end way to register for ISC2 Certified in Cybersecurity (CC) and what happens after you pass.

What is ISC2?
--formally International Information System Security Certification Consortium — is a nonprofit membership organization that specializes in training and certifying cybersecurity professionals worldwide.

Important Links:

www.isc2.org/register-for-exam
www.isc2.org/Dashboard/Candidate-Benefits/1MCC-Exa…
my.isc2.org/s/ISC2-Pearson

www.isc2.org/landing/1mcc

# Step-by-step registration

1. Decide your path (free vs paid)

ISC2 is still running the One Million Certified in Cybersecurity initiative, which gives free CC training + a free first exam attempt. Start on the CC page and the One-Million page.
If you’re paying, the standard CC exam fee is US\$199 (local taxes shown at checkout).

URL:
www.isc2.org/

2. Create your ISC2 account (free)

Become an ISC2 Candidate (free). You must be at least 16 years old to sit any ISC2 exam.

3. Claim the free training/exam (optional but great)

From the One-Million/CC page, enroll in the free self-paced course and claim the exam voucher if available in your region.

URL :
www.isc2.org/Dashboard/Candidate-Benefits/1MCC-Exa…

4. Add the CC exam to your cart

Go to Register for Exam on isc2.org, add “Certified in Cybersecurity (CC)” to your cart, and apply your voucher at checkout (it will show \$0 if valid).

5. Schedule your test appointment

After checkout, open Courses & Exams in your ISC2 account, click Schedule, complete the Exam Account Information form (name must match your ID exactly), and you’ll be redirected to Pearson VUE to pick a test center, date, and time. (CC is in-person only, not online-proctored.)

6. Know the exam format

Duration: 2 hours • Items: 100 (multiple-choice & advanced types) • Passing: 700/1000 • Languages: English, Simplified Chinese, German, Japanese, Spanish.
Note: Starting Oct 1, 2025, the CC moves to CAT (computerized adaptive testing). If your date is on/after that, expect the CAT experience.

7. Review policies, fees & reschedules

Reschedule US $50 / Cancel US $100 (Pearson VUE). First-time CC candidates using the One-Million pledge are exempt from reschedule fees.

8. Prepare your IDs & test-day checklist

Bring required valid government ID; your exam-account name must match exactly or you won’t be admitted. See “Before Your Exam” for ID rules and procedures.

# After the exam

Result timing: You’ll see pass/fail at the test center; official email follows.
If you pass: Complete a short online certification application, agree to the Code of Ethics, and pay the US $50 AMF (waived if you already paid the US $50 Candidate dues in the last 12 months). No endorsement process is required for CC.
If you don’t pass: Retake policy is 30/60/90-day spacing (after 1st/2nd/3rd attempt) with a max of 4 tries per 12 months; the free pledge covers only one attempt.

# Quick links you’ll use

Register / schedule & policies: Register for Exam; Before Your Exam.
Exam outline (what’s tested): Official CC Exam Outline (domains, format).
Pricing: Global CC pricing.
Free training/exam: CC & One-Million initiative.

For any doubts and query, please write on YouTube video 📽️ comments section.

Note : Flow the Process shown in video 📽️.

😉Please Subscribe for more videos:
youtube.com/@chiragtutorial
💛Don't forget to, 💘Follow, 💝Like, Share 💙&, Comment

Thanks & Regards,
Chitt Ranjan Mahto "Chirag"
____________________________________________________________________
Note: All scripts used in this demo will be available in our website.
Link will be available in description.

3 weeks ago (edited) | [YT] | 0

Chirag Tutorial (Chirags.in)

How to Configure Nagios to Monitor a PostgreSQL 16 Database with Dashboards on Ubuntu 24.04 LTS #postgresql #postgres #nagios

inchirags@gmail.com Chirag PostgreSQL DBA Tutorial www.chirags.in/

*************************************************************************************

How to Configure Nagios to Monitor a PostgreSQL 16 Database with Dashboards on Ubuntu 24.04 LTS

*************************************************************************************

Here's a step-by-step guide to configure Nagios to monitor a PostgreSQL 16 database with dashboard access on Ubuntu 24.04 LTS.

🧭 Architecture
--------------------------------------------------------------------------------------
Role IP Address Description
--------------------------------------------------------------------------------------
Nagios Server 192.168.136.129 Hosts Nagios Core + Dashboards
PostgreSQL Server 192.168.136.130 PostgreSQL 16 server being monitored
--------------------------------------------------------------------------------------
Default password everywhere: admin@123

Step 1: Install PostgreSQL 16 (on 192.168.136.130)

If PostgreSQL is already installed and running, skip this step.

sudo apt update
sudo apt install postgresql-16 postgresql-contrib -y
sudo systemctl enable --now postgresql
Set password for the postgres user:

sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'admin@123';"
Step 2: Enable PostgreSQL Remote Access (on 192.168.136.130)

Edit postgresql.conf:

sudo nano /etc/postgresql/16/main/postgresql.conf
Find and change:

listen_addresses = '*'
Edit pg_hba.conf:

sudo nano /etc/postgresql/16/main/pg_hba.conf
Add at the end:

host all all 192.168.136.129/32 md5
Restart PostgreSQL:

sudo systemctl restart postgresql
Step 3: Create Monitoring User in PostgreSQL (on 192.168.136.130)

sudo -u postgres psql
Inside psql:

CREATE USER nagios WITH PASSWORD 'admin@123';
GRANT CONNECT ON DATABASE postgres TO nagios;
\q
Step 4: Install Nagios Core on Server1 (192.168.136.129)

Step 4.1: Install Dependencies

sudo apt update
sudo apt install nagios-plugins-basic nagios-plugins-standard -y
sudo apt install -y apache2 php php-gd unzip build-essential libgd-dev libapache2-mod-php \
libperl-dev libssl-dev daemon wget libnet-snmp-perl gettext
Step 4.2: Add Nagios User

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data
Step 4.3: Download and Compile Nagios

cd /tmp
wget assets.nagios.com/downloads/nagioscore/releases/na…
tar xvf nagios-4.5.1.tar.gz
cd nagios-4.5.1
./configure --with-command-group=nagcmd
make all
sudo make install
sudo make install-commandmode
sudo make install-init
sudo make install-config
sudo make install-webconf
Step 4.4: Create Nagios Web User

sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
# Enter: admin@123

Enable Apache modules:

sudo a2enmod rewrite cgi
sudo systemctl restart apache2
Start Nagios:

sudo systemctl enable --now nagios
Step 5: Install Nagios Plugins and NRPE

On Server2 (PostgreSQL server: 192.168.136.130):

sudo apt install nagios-nrpe-server nagios-plugins -y
Allow Server1 IP in /etc/nagios/nrpe.cfg:

sudo nano /etc/nagios/nrpe.cfg
Edit:

allowed_hosts=127.0.0.1,192.168.136.129
Restart NRPE:

sudo systemctl restart nagios-nrpe-server
Step 6: Install PostgreSQL Plugin for Nagios (192.168.136.129)

On Server1 (Nagios):

cd /usr/local/nagios/libexec
wget raw.githubusercontent.com/bucardo/check_postgres/m…
chmod +x check_postgres.pl
Plugins get installed to /usr/local/nagios/libexec

Step 7: Configure Nagios to Monitor PostgreSQL

Edit command file:

sudo nano /usr/local/nagios/etc/objects/commands.cfg
Add:

define command {
command_name check_postgres_connection
command_line /usr/local/nagios/libexec/check_postgres.pl --action=connection --dbhost=192.168.136.130 --dbuser=nagios --dbpass=admin@123
}

define command {
command_name check_postgres_backends
command_line /usr/bin/perl /usr/local/nagios/libexec/check_postgres.pl --action=backends --dbhost=$ARG1$ --dbuser=$ARG2$ --dbpass=$ARG3$ --warning=50 --critical=100
}

define command {
command_name check_postgres_locks
command_line /usr/bin/perl /usr/local/nagios/libexec/check_postgres.pl --action=locks --dbhost=$ARG1$ --dbuser=$ARG2$ --dbpass=$ARG3$ --warning=10 --critical=20
}

define command {
command_name check_postgres_replication_lag
command_line /usr/bin/perl /usr/local/nagios/libexec/check_postgres.pl --action=replication_lag --dbhost=$ARG1$ --dbuser=$ARG2$ --dbpass=$ARG3$ --warning=5 --critical=10
}
Edit Nagios configuration to add host/service:

mkdir -p /usr/local/nagios/etc/servers/
sudo nano /usr/local/nagios/etc/servers/postgres.cfg
Add:

define host {
use linux-server
host_name server2
alias PostgreSQL Server
address 192.168.136.130
}

define service {
use generic-service
host_name server2
service_description PostgreSQL Connection
check_command check_postgres_connection
}

define service {
use generic-service
host_name server2
service_description PostgreSQL Backends
check_command check_postgres_backends!192.168.136.130!nagios!admin@123
}

define service {
use generic-service
host_name server2
service_description PostgreSQL Locks
check_command check_postgres_locks!192.168.136.130!nagios!admin@123
}

define service {
use generic-service
host_name server2
service_description PostgreSQL Replication Lag
check_command check_postgres_replication_lag!192.168.136.130!nagios!admin@123
}
Include this config in nagios.cfg:

sudo nano /usr/local/nagios/etc/nagios.cfg
Add:

cfg_dir=/usr/local/nagios/etc/servers
Validate Configuration:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Output:

Total Warnings: 0

Total Errors: 0

--Create directory:

---sudo mkdir -p /usr/local/nagios/etc/servers

---sudo mv /usr/local/nagios/etc/servers/postgres.cfg /usr/local/nagios/etc/servers/

Step 8: Restart Nagios

sudo systemctl restart nagios
Step 9: Access Nagios Dashboard

sudo ufw allow 80/tcp
sudo ufw reload
Visit:

🔗 http://192.168.136.129/nagios
Login:

Username: nagiosadmin

Password: admin@123

Step 10: Monitor Additional Metrics (Optional)

Go to Current Status → Services

You should now see:

PostgreSQL Connection

PostgreSQL Backends

PostgreSQL Locks

PostgreSQL Replication Lag

You can monitor more metrics like:

--action=locks

--action=bloat

--action=backends

--action=connection

(Adjust check_command accordingly)

Step 11: Test the connection in Server1

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If you see "Total Warnings=0, Total Errors=0", config is fine.

❌ If not, fix the path (cfg_dir) in nagios.cfg

Log file Path:

sudo tail -f /usr/local/nagios/var/nagios.log
Remove the bad one

sudo rm -f /usr/local/nagios/libexec/check_ping
Recreate the symlink properly

sudo ln -s /usr/lib/nagios/plugins/check_ping /usr/local/nagios/libexec/check_ping
Test the plugin manually

/usr/local/nagios/libexec/check_ping -H 127.0.0.1 -w 100.0,20% -c 500.0,60%
Test the plugin manually

/usr/local/nagios/libexec/check_ping -H 192.168.136.130 -w 100.0,20% -c 500.0,60%
You should get something like:

PING OK - Packet loss = 0%, RTA = 0.12 ms
For any doubts and query, please write on YouTube video 📽️ comments section.

Note : Flow the Process shown in video 📽️.

😉Please Subscribe for more videos:

youtube.com/@chiragtutorial

💛Don't forget to, 💘Follow, 💝Like, Share 💙&, Comment

Thanks & Regards,

Chitt Ranjan Mahto "Chirag"

____________________________________________________________________

Note: All scripts used in this demo will be available in our website.

Link will be available in description.

3 weeks ago | [YT] | 0

Chirag Tutorial (Chirags.in)

inchirags@gmail.com Chirag's PostgreSQL DBA Tutorial www.chirags.in/

*************************************************************************************

PgDog + PostgreSQL 17 High-Availability (HA) on Ubuntu 24.04 LTS

*************************************************************************************


Step-by-step tutorial for setting up PgDog + PostgreSQL 17 High-Availability (HA) on Ubuntu 24.04 LTS

🧭 Architecture
--------------------------------------------------------------------------------------
Role IP Address Description
--------------------------------------------------------------------------------------
Primary Server 192.168.136.129 PostgreSQL 17 Primary Server
Replica Server 192.168.136.130 PostgreSQL 17 Replica Server
--------------------------------------------------------------------------------------
Default password everywhere: admin@123
Default password everywhere: admin@123

# 🐕 PgDog + PostgreSQL 17 — 2 Node HA Setup (Ubuntu 24.04)

1. System Preparation

Run on both servers:

sudo apt update && sudo apt upgrade -y
sudo apt install -y wget curl gnupg2 lsb-release build-essential git
2. Install PostgreSQL 17

# Add PostgreSQL repo

sudo sh -c 'echo "deb [signed-by=/etc/apt/keyrings/postgresql.gpg] apt.postgresql.org/pub/repos/apt/ noble-pgdg main" > \
/etc/apt/sources.list.d/pgdg.list'
Create a Keyring for PostgreSQL:

sudo mkdir -p /etc/apt/keyrings
Download the PostgreSQL Signing Key:

curl -fsSL www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/keyrings/postgresql.gpg
sudo apt update

sudo apt install -y postgresql-17 postgresql-client-17
Set postgres password:

sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'admin@123';"
Enable and start PostgreSQL:

sudo systemctl enable postgresql
sudo systemctl start postgresql
3. Configure PostgreSQL for Replication

On both servers, edit postgresql.conf:

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

Set:

listen_addresses = '*'
wal_level = replica
max_wal_senders = 10
max_replication_slots = 10
On Primary (192.168.136.129) and replica (192.168.136.130), edit pg_hba.conf:

sudo nano /etc/postgresql/17/main/pg_hba.conf
Add:

host replication postgres 192.168.136.0/24 md5
host all postgres 192.168.136.0/24 md5
Restart PostgreSQL:

sudo systemctl restart postgresql
4. Install PgDog

On both servers:

Install Dependencies (on both nodes)

sudo apt update && sudo apt install -y \
cmake clang curl pkg-config libssl-dev git build-essential
PgDog is written in Rust, so you'll also need Rust installed:

curl --proto '=https' --tlsv1.2 -sSf sh.rustup.rs/ | sh
source $HOME/.cargo/env
Clone the Official Repository:

git clone github.com/pgdogdev/pgdog.git
cd pgdog
Build PgDog from Source:

cargo build --release
Check if pgdog binary exists:

Run:

ls -l /usr/local/bin/pgdog
* If you see No such file, you need to copy it:



sudo cp /home/dept/pgdog/target/release/pgdog /usr/local/bin/
sudo chmod +x /usr/local/bin/pgdog
* If the file exists, make sure it is executable:

sudo chmod +x /usr/local/bin/pgdog
Create /etc/pgdog/pgdog.toml:

mkdir -p /etc/pgdog/
sudo nano /etc/pgdog/pgdog.toml
Paste this for your 2-node cluster:

[general]
host = "0.0.0.0"
port = 6432

[[databases]]
name = "postgres"
host = "192.168.136.129"
port = 5432
role = "primary"

[[databases]]
name = "postgres"
host = "192.168.136.130"
port = 5432
role = "replica"
Create /etc/pgdog/users.toml:

sudo nano /etc/pgdog/users.toml
Paste:

[[users]]
name = "postgres"
database = "postgres"
password = "admin@123"
5. Configure PgDog

Create config:

sudo nano /etc/pgdog/pgdog.conf
#On Primary (192.168.136.129)

[node]
name = "node1"
ip = "192.168.136.129"
port = 5432
role = "primary"
user = "postgres"
password = "admin@123"

[cluster]
nodes = [
{ name="node1", ip="192.168.136.129", port=5432 },
{ name="node2", ip="192.168.136.130", port=5432 }
]
#On Replica (192.168.136.130)

[node]
name = "node2"
ip = "192.168.136.130"
port = 5432
role = "standby"
user = "postgres"
password = "admin@123"

[cluster]
nodes = [
{ name="node1", ip="192.168.136.129", port=5432 },
{ name="node2", ip="192.168.136.130", port=5432 }
]
Test PgDog manually:

Before using systemd, confirm it runs:

/usr/local/bin/pgdog --config /etc/pgdog/pgdog.toml --users /etc/pgdog/users.toml
* If it starts and prints logs → binary works ✅

The compiled binary will be in target/release/pgdog.

This is the recommended method for production deployment.

Create a systemd Service:

Create a service file:

sudo nano /etc/systemd/system/pgdog.service
Paste:

[Unit]
Description=PgDog PostgreSQL HA Proxy
After=network.target postgresql.service

[Service]
ExecStart=/usr/local/bin/pgdog --config /etc/pgdog/pgdog.toml --users /etc/pgdog/users.toml
Restart=always
User=postgres
Group=postgres

[Install]
WantedBy=multi-user.target
Enable + start:

sudo systemctl daemon-reexec
sudo systemctl enable pgdog
sudo systemctl start pgdog
sudo systemctl status pgdog
6. Initialize Replica

On Replica (192.168.136.130):

sudo systemctl stop postgresql
rm -rf /var/lib/postgresql/17/main/*
sudo -u postgres pg_basebackup -h 192.168.136.129 -D /var/lib/postgresql/17/main -U postgres -Fp -Xs -P -R -W
# password: admin@123

sudo systemctl start postgresql
7. Restart PgDog

On both servers:

sudo systemctl restart pgdog
8. Normal Connection Test

From any client (even server1 itself):

psql -h 192.168.136.129 -p 6432 -U postgres -d postgres
You should get a postgres=# prompt.

Check which node you are connected to:

SELECT inet_server_addr() AS server, pg_is_in_recovery() AS is_replica;
* If is_replica = f → you’re on the primary.

* If is_replica = t → you’re on the standby.

9. Failover Test

On the primary (192.168.136.129):

sudo systemctl stop postgresql
Now reconnect via PgDog proxy:

psql -h 192.168.136.129 -p 6432 -U postgres -d postgres
Then run:

SELECT inet_server_addr() AS server, pg_is_in_recovery() AS is_replica;
👉 You should now be connected to 192.168.136.130 with is_replica = f (because it got promoted).

10. Recovery / Switchover

Start the old primary again:

sudo systemctl start postgresql
PgDog should see it come back online.

For any doubts and query, please write on YouTube video 📽️ comments section.

Note : Flow the Process shown in video 📽️.

😉Please Subscribe for more videos:

youtube.com/@chiragtutorial

💛Don't forget to, 💘Follow, 💝Like, Share 💙&, Comment

Thanks & Regards,

Chitt Ranjan Mahto "Chirag"

____________________________________________________________________

Note: All scripts used in this demo will be available in our website.

Link will be available in description.

3 weeks ago | [YT] | 1

Chirag Tutorial (Chirags.in)

inchirags@gmail.com Chirag's MySQL Tutorial www.chirags.in/
*****************************************************************************************
MySQL Point-in-Time Recovery (PITR) Using Percona XtraBackup and Binary Logs from a Full Backup Across Two Linux Servers
*****************************************************************************************

What is Percona XtraBackup?
Percona XtraBackup is an open-source, free tool used for backing up MySQL and MariaDB databases, particularly those using the InnoDB and XtraDB storage engines. It allows for non-blocking, "hot" backups, meaning that the database can remain operational and process transactions while the backup is running. It offers various backup types, including full, incremental, compressed, and streaming backups

Step-by-step guide to set up MySQL Point-in-Time Recovery (PITR) Using Percona XtraBackup and Binary Logs from a Full Backup Across Two Linux Servers:

Environment
----------------------------------------------------
Role IP Address Description
----------------------------------------------------
Primary 192.168.224.128 Main MySQL Server
Recovery 192.168.224.129 Server for PITR
----------------------------------------------------
MySQL Version: Latest (assume 8.x)
MySQL User: root
Password: admin@123

1. Install MySQL on Both Servers (192.168.224.128, 192.168.224.129)

sudo apt update
sudo apt install mysql-server -y
sudo systemctl enable mysql
sudo systemctl start mysql

Set the root password:

sudo mysql_secure_installation


Password Authentication:

Run the following to change the plugin for root to mysql_native_password:

sudo mysql

Then in the MySQL prompt:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin@123';
FLUSH PRIVILEGES;
EXIT;

Now test login with:

mysql -u root -p

You should now be prompted for the password admin@123.

Optional: Disable auth_socket Plugin Permanently (Ubuntu Default Behavior)

To ensure this change sticks and works after reboots or package updates, make sure:

sudo systemctl restart mysql

Then confirm:

mysql -u root -p -e "SELECT user, plugin FROM mysql.user WHERE user='root';"

Result should be:

root mysql_native_password

2. Configure MySQL on Primary (192.168.224.128) for Backups and Binary Logging
Edit /etc/mysql/mysql.conf.d/mysqld.cnf:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]
server-id = 1
log-bin = /var/log/mysql/mysql-bin.log
binlog_format = ROW
expire_logs_days = 7

Restart MySQL:

sudo systemctl restart mysql

3. Take Physical Backup on Primary (192.168.224.128) (Using xtrabackup)

Create the Database and a Table:

mysql -u root -p

CREATE DATABASE testdb;

USE testdb;

CREATE TABLE employees (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
position VARCHAR(50),
salary DECIMAL(10,2)
);

INSERT INTO employees (name, position, salary) VALUES
('Chirag', 'Manager', 75000.00),
('Sanju', 'Engineer', 65000.00),
('Kumar', 'Technician', 45000.00);

Verify the Data:

SELECT * FROM employees;

exit;

Database Full Using xtrabackup (recommended for large DBs)

Install percona-xtrabackup 8.0:
--------------------------------------------------------------------------
Download and Install the Percona APT Repo Package

curl -O repo.percona.com/apt/percona-release_latest.generi…

chmod 0777 -R percona-release_latest.generic_all.deb

sudo apt install gnupg2 lsb-release ./percona-release_latest.generic_all.deb

sudo apt update

sudo percona-release setup pxb-80

Update the Package Index

sudo apt update

sudo apt install percona-xtrabackup-80

Backup:

xtrabackup --backup --target-dir=/backup --user=root --password=admin@123

Prepare:

xtrabackup --prepare --target-dir=/backup

Transfer:

rsync -av /backup dept@192.168.224.129:/home/dept/

Add some more data:

mysql -u root -p

USE testdb;

INSERT INTO employees (name, position, salary) VALUES
('Arun', 'Developer', 55000.00),
('Eva', 'Designer', 48000.00);

Verify the Data:

SELECT * FROM employees;

exit

4. Copy Binary Logs from Primary Server to Recovery Server

List binlogs:

ls /var/log/mysql/mysql-bin.*

Copy the required binary logs to Recovery:

scp /var/log/mysql/mysql-bin.* dept@192.168.224.129:/home/dept/mysql-bin-logs/

5. Setup Recovery Server

Install percona-xtrabackup 8.0:
--------------------------------------------------------------------------
Download and Install the Percona APT Repo Package

curl -O repo.percona.com/apt/percona-release_latest.generi…

chmod 0777 -R percona-release_latest.generic_all.deb

sudo apt install gnupg2 lsb-release ./percona-release_latest.generic_all.deb

sudo apt update

sudo percona-release setup pxb-80

Update the Package Index

sudo apt update

sudo apt install percona-xtrabackup-80

Stop MySQL:

sudo systemctl stop mysql

Restore Physical Backup using xtrabackup:

sudo rm -rf /var/lib/mysql/*

Move the files to /var/log/mysql with sudo:

sudo mv /home/dept/mysql-bin-logs/mysql-bin.* /var/log/mysql/
sudo chown mysql:mysql /var/log/mysql/mysql-bin.*

sudo xtrabackup --copy-back --target-dir=/home/dept/backup --datadir=/var/lib/mysql

chown -R mysql:mysql /var/lib/mysql

sudo systemctl start mysql

6. Apply Binary Logs for PITR
Find the exact timestamp or position

Open full_backup.sql and locate:

-- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000002', MASTER_LOG_POS=157;

mysqlbinlog --start-position=157 /var/log/mysql/mysql-bin.000002 | mysql -u root -p

Or to apply to a specific point in time:

mysqlbinlog --stop-datetime="2025-05-30 14:00:00" /var/log/mysql/mysql-bin.000002 | mysql -u root -p

You can combine multiple binlogs:

mysqlbinlog mysql-bin.000001 mysql-bin.000002 | mysql -u root -p

7. Verification
Check tables and data
Compare with Primary
Confirm PITR state

For any doubts and query, please write on YouTube video 📽️ comments section.

Note : Flow the Process shown in video 📽️.

😉Please Subscribe for more videos:
youtube.com/@chiragstutorial
💛Don't forget to, 💘Follow, 💝Like, Share 💙&, Comment

Thanks & Regards,
Chitt Ranjan Mahto "Chirag"
____________________________________________________________________
Note: All scripts used in this demo will be available in our website.
Link will be available in description.

2 months ago | [YT] | 1

Chirag Tutorial (Chirags.in)

How to Install MariaDB in Ubuntu 24.04 LTS and Access from Remote server

inchirags@gmail.com MariaDB DBA Tutorial www.chirags.in/
*****************************************************************************************
* How to Install MariaDB in Ubuntu 24.04 LTS and Access from remote server *
*****************************************************************************************

Here’s a step-by-step guide to install MariaDB on Ubuntu 24.04 LTS:


Step 1: Firewall Configuration


sudo ufw status
sudo ufw allow ssh
sudo ufw allow 3306/tcp

sudo ufw enable


Step 2: Update System Packages
First, ensure your system is up to date.


sudo apt update
sudo apt upgrade -y


Step 3: Install MariaDB Server
Install the MariaDB server package.


sudo apt install mariadb-server -y


Verify the installation:


mariadb --version


Step 4: Secure MariaDB Installation
Run the security script to improve the security of your MariaDB installation.


sudo mysql_secure_installation


Set root password? (If not set already, set a strong password)


Remove anonymous users? (Yes)
Disallow root login remotely? (Yes)
Remove test database and access to it? (Yes)
Reload privilege tables now? (Yes)


Step 5: Enable and Start MariaDB Service


Ensure MariaDB is enabled and running.


sudo systemctl enable mariadb
sudo systemctl start mariadb


Check the status:


sudo systemctl status mariadb


Step 6: Log in to MariaDB Shell


Log in as root user:


sudo mysql -u root -p


Enter the root password you set during the secure installation.


Step 7: Create a Database and User (Optional)
Create a test database and user for verification.


CREATE DATABASE testdb;
CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;


-- Create user & database and access from remote server


CREATE DATABASE testdb2;
CREATE USER 'testuser2'@'192.168.224.130' IDENTIFIED BY 'admin@123';
GRANT ALL PRIVILEGES ON testdb2.* TO 'testuser2'@'192.168.224.130';
FLUSH PRIVILEGES;
EXIT;



Step 8: Allow Remote Access (Optional)
If you want to allow remote connections:

Edit the MariaDB configuration file:


sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf


Find the line starting with bind-address and change it to:


bind-address = 0.0.0.0


Restart MariaDB:


sudo systemctl restart mariadb


Step 9: Verify MariaDB Installation
Log in using your new user:


mysql -u testuser -p


-- access from remote server


mysql -h 192.168.224.129 -u testuser -p


Check the databases:


SHOW DATABASES;


Step 10: Enable Automatic Updates (Recommended)
Ensure MariaDB updates automatically:


sudo apt install unattended-upgrades -y


sudo dpkg-reconfigure --priority=low unattended-upgrades


Step 11: Backup MariaDB (Optional but Recommended)
Set up a simple backup:


sudo mariadb-dump -u root -p --all-databases > backup.sql


MariaDB is now successfully installed on Ubuntu 24.04 LTS! Let me know if you encounter any issues. 😊


For any doubts and query, please write on YouTube video comments section.


Note : Flow the Process shown in video.


😉Please, Subscribe and like for more videos:


youtube.com/@chiragstutorial


💛Don't forget to, 💘Follow, 💝Like, 💖Share 💙&, Comment


Thanks & Regards,
Chitt Ranjan Mahto "Chirag"

8 months ago (edited) | [YT] | 0