Skip to content

Instantly share code, notes, and snippets.

View linuxmalaysia's full-sized avatar
🏠
Working from home

Harisfazillah Jamel linuxmalaysia

🏠
Working from home
View GitHub Profile
@linuxmalaysia
linuxmalaysia / resizerootpartfromhomecentos8.md
Created November 17, 2020 05:26
Resize root partition by removing the default /home partition) on CentOS 8

Resize root partition by removing the default /home partition) on CentOS 8

This requires you to be able to ssh into the instance using the root user account and that no services be running as users out of /home on the target machine. You can check this by command fuser /home

The examples are from a default installation with no customation-you NEED to know what you're working with for volumes/partitions to not horribly break things. Use this at your own risk. *** AT YOUR OWN RISK ***. Im only tested this on Centos 8 of mine.

By default, CentOS 8 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: /,/home and /boot. Check with df -h and du -h of /home to make sure the space is enough.

Step 1 - Copy /home Contents

To backup the contents of /home, do the following:

@linuxmalaysia
linuxmalaysia / MySQL-Directory-Move-Into-New-Partition.md
Created November 24, 2020 05:50
MySQL / MariaDB / Percona Server For MySQL Directory Move Into New Partition (Example /home)

MySQL Directory Move Into New Partition (Example /home)

Login as root or any user that NOT using /home stop mariadb service such as systemctl stop MariaDB

Make sure SELINUX is permissive mode. View file /etc/selinux/config

Step 1 - Copy /home Contents

To backup the contents of /home, do the following:

@linuxmalaysia
linuxmalaysia / elasticsearch-secure-ssl.txt
Last active December 14, 2020 21:02
Elasticsearch secure with ssl
1. Create SSL
Please adjust IP and domain name as per site.
=========
Rujukan
https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-security.html
@linuxmalaysia
linuxmalaysia / mysqldump-restore-script.sh
Last active January 17, 2021 23:29
Backup and restore back script. For need to replicate but don't have privilage. mysqldump-restore-script.sh dbname user password ipaddress
#!/bin/bash
# By Harisfazillah Jamel
# 16 Jan 2021
#=== backup script
#=== mysqldump-restore-script.sh dbname user password ipaddress
NAMADATABASE="${1}"
NAMAUSER="${2}"
DBPASSWORD="${3}"
HOST="${4}"
====
Ref: https://www.vultr.com/docs/how-to-deploy-google-bbr-on-centos-7
yum install byobu openssh fail2ban httpd
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
@linuxmalaysia
linuxmalaysia / clustercontrol-centos8-podman.txt
Created June 28, 2021 10:19
Cluster Control On Centos 8 Using Podman
Cluster Control On Centos 8 Using Podman
https://severalnines.com/download-clustercontrol-database-management-system
https://severalnines.com/docs/user-guide/ui.html#import-existing-server-cluster
https://severalnines.com/docs/installation.html
https://severalnines.com/product/clustercontrol/clustercontrol-community-edition
@linuxmalaysia
linuxmalaysia / uptime.cron
Last active November 30, 2023 01:18
this uptime.cron need to be in /etc/cron.d
# uptime report every 1 minutes everyday
*/10 * * * * root uptime | logger -t uptime > /dev/null
*/10 * * * * root free -h | head -2 | tail -1 | logger -t free > /dev/null
@linuxmalaysia
linuxmalaysia / kill-idle-transaction-pg.sh
Last active October 9, 2024 05:06
Idle In Transaction Problem - Postgresql
#!/bin/bash
# Harisfazillah Jamel - 20211216
# Part of script from https://wiki.lyrasis.org/display/DSPACE/Idle+In+Transaction+Problem
# Idle In Transaction Problem
pgprocess_array=( $( /usr/bin/pgrep -f 'idle in transaction' ) )
/usr/bin/pgrep -f 'idle in transaction' | wc -l | logger
for r in "${pgprocess_array[@]}"; do
@linuxmalaysia
linuxmalaysia / vacuum_analyze_schema-reindex.sh
Created December 16, 2021 19:45
vacuum analyze only the tables in the specified schema
#!/bin/bash
#https://stackoverflow.com/questions/29710618/vacuum-analyze-all-tables-in-a-schema-postgres
# this is to be run from postgis user
# 20211216
PG_SCHEMA='yourschema'
PG_USER='postgres'
PG_HOST='localhost'
PG_DB='yourdb'
PG_PASS=''
@linuxmalaysia
linuxmalaysia / lxd-reset-jammy.sh
Created September 9, 2022 22:35
Script to reset LXD LXC for Jammy Ubuntu 22.04 LTS
#!/usr/bin/env bash
# https://gist.github.com/ppartarr/018a3858bba8655dc421cc4589598d97
## sudo snap install lxd --classic
## this is only for jammy
## Harisfazillah Jamel 20221009
set -euo pipefail # -> http://redsymbol.net/articles/unofficial-bash-strict-mode/
# Reverse what lxd init does
function check_distro() {