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 / improve-mariadb-galera.md
Last active November 29, 2023 22:31
Setting for MariaDB Gcache

Instructions for configuring MariaDB and MySQL performance :-

  1. File Modification:

    • Open the /etc/mysql/mariadb.cnf or my.cnf file (note that my.cnf is a soft link to mariadb.cnf).
    • Add the following configuration options:
    # Provider specific configuration options
    wsrep_provider_options="gcache.size=1024M;gmcast.segment=0;gcache.recover=yes"
@linuxmalaysia
linuxmalaysia / portalblacklist.sh
Last active February 8, 2023 16:10
Dapatkan IP daripada nginx log dengan F1 adalah IP address client. Sort terbanyak ini 50 pertama head -50 dan ambil dari baris ke 2 ke 50 tail -49 sebab baris 1 ada.
#!/bin/bash
# To copy to /etc/nginx
# Harisfazillah Jamel
# 20230208
# ini 1000 pertama head -1000 dan ambil dari baris ke 2 ke 1000 tail -999 sebab baris 1 ada -
# Rujuk DENYN untuk hanya deny dengan jumlah cubaan lebih daripada
DENYN=200
DATE1=`printf '%(%Y-%m-%d)T\n' -1`
WRKDIR="/var/log/nginx"
ETCDIR="/etc/nginx"
@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 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 / 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}"