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 / deploy-automated-hadoop-setup-on-lxd.sh
Created January 23, 2023 10:24 — forked from ruanbekker/deploy-automated-hadoop-setup-on-lxd.sh
Sets up a Hadoop 3 Node Cluster with LXC Containers on LXD (Automated Install)
#!/bin/bash
set -ex
UBUNTU_VERSION="14.04"
mkdirs(){
#lxc delete hadoop-master --force
#lxc delete hadoop-slave-1 --force
#lxc delete hadoop-slave-2 --force
rm -rf /tmp/*
@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() {
@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 / kill-idle-transaction-pg.sh
Last active December 28, 2021 09:10
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 / 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 / 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
====
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 / 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}"
@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 / 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: