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 / check_deletable_verbose_robust.sh
Last active May 20, 2025 23:20
This script is a robust Elasticsearch index assessment tool designed to help you identify and manage old or inactive indices for .ds-logs and .ds-metrics. It connects securely to your Elasticsearch cluster, lists indices for a specified month and year, and determines their deletion status (e.g., whether they are a write index for a data stream).…
#!/bin/bash
# By Harisfazillah Jamel with Google Gemini Help
# 20250521
#
# This script is a robust Elasticsearch index assessment tool designed
# to help you identify and manage old or inactive indices for .ds-logs and .ds-metrics.
# Configuration - Adjust ES_HOST if necessary
ES_HOST="localhost:9200"
CERT_PATH="/etc/elasticsearch/certs/http_ca.crt" # Path to your CA CA certificate
@linuxmalaysia
linuxmalaysia / setup_elasticsearch_podman.sh
Created April 1, 2025 04:05
Script to set up Elasticsearch 8.17.4 using Podman with the hardened Wolfi image, based on the official Docker documentation.
#!/bin/bash
# Script to set up Elasticsearch 8.17.4 using Podman with the hardened Wolfi image, based on the official Docker documentation.
# Note: Using Wolfi images might have specific kernel or dependency requirements.
# https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docker.html
# GNU GENERAL PUBLIC LICENSE Version 3
# Harisfazillah Jamel and Google Gemini
# 31 Mac 2025
# https://github.com/HarisfazillahJamel/podman-elastic-stack
# --- Script Description ---
@linuxmalaysia
linuxmalaysia / download-elastic-assets-manifest.sh
Last active May 22, 2025 01:05
Download Elastic Assets Manifest GNUPG for airgap installation
#!/bin/bash
### Script mudah untuk download asset dan manifest
### daripada elastic downloads bagi tujuan
### Internal repo kepada Elastic Fleet.
### use with own risks
### buat directory ini bawah html /usr/share/nginx/html
### Harisfazillah Bin Jamel 28/12/2024, update 26/03/2025
### Added Manifest and GNUPG - 20250522
### Ubuntu / Debian - apt install nginx
@linuxmalaysia
linuxmalaysia / configure_pgbouncer.sh
Last active September 15, 2024 02:16
# Harisfazillah Jamel - 11 Sept 2024 # Need to create systemd template for [email protected] and [email protected] # By using so_reuseport in pgbouncer setting # and copy of /etc/pgbouncer/pgbouncer.ini to /etc/pgbouncer/pgbouncer.ini # Do this after all the tune and test run with single pgbouncer done. # https://www.2ndquadrant.com/en/blog/run…
#!/bin/bash
# Harisfazillah Jamel - 11 Sept 2024
# Need to create systemd template for [email protected] and [email protected]
# By using so_reuseport in pgbouncer setting
# and copy of /etc/pgbouncer/pgbouncer.ini to /etc/pgbouncer/pgbouncer.ini
# Do this after all the tune and test run with single pgbouncer done.
# https://www.2ndquadrant.com/en/blog/running-multiple-pgbouncer-instances-with-systemd/
# https://www.enterprisedb.com/postgres-tutorials/pgbouncer-setup-extended-architecture-use-cases-and-leveraging-soreuseport
# Please check for running pgbouncer if you find this script in your server
# ps -ef | grep pgbouncer
@linuxmalaysia
linuxmalaysia / rsynctoserver.sh
Last active May 15, 2024 23:27
Old School Backup Using Rsync - Yeahhh on SCO Unix (BSD Style) - Convert to Linux Bash
#!/bin/bash
# Script to transfer directories from a remote server using rsync over SSH
# Harisfazillah Jamel (LinuxMalaysia)
# Circa 2006 For SCO Unix and BSD
# Adjust for Bash Linux 16 Mei 2024
# Target remote server details
# User need to be create and remote backup dir need to own by the user
# RADD can be local or remote IP
@ApOgEE
ApOgEE / podman-survival.md
Created December 9, 2023 02:17
Buat Service Supaya Podman Survive Reboot

Podman Survive Reboot

Docker adalah service dalam server manakala podman pula bukan service. Perbezaan antara Docker dan Podman dalam situasi ini ialah apabila kita reboot server.

Bila kita guna Docker, semua container yang run sebelum reboot akan run balik bila kita reboot server dan service docker kembali running. Tapi ini tak berlaku bila kita guna podman sebab podman bukanlah service.

Oleh itu, kita kena jadikan podman sebagai service.

@linuxmalaysia
linuxmalaysia / clustercontrol-podman-setup-20231209.md
Last active May 12, 2024 00:58
Clustercontrol v2 in Podman

Podman Container Configuration for ClusterControl with Custom User and SSH

This document outlines how to configure a Podman container for ClusterControl with a custom user and SSH access.

1. Pulling the Image:

podman pull docker.io/severalnines/clustercontrol:latest
@linuxmalaysia
linuxmalaysia / sysctlconf-mariadb.md
Last active March 9, 2025 14:25
Sysctl setting that may suitable for MariaDB

This /etc/sysctl.conf settings are generally suitable for a MariaDB Galera Cluster. Use this wisely. Execute command sysctl -p after editing /etc/sysctl.conf.

# Increase the maximum number of memory map areas a process may have
# This can help prevent out-of-memory errors in large applications
vm.max_map_count=262144

# Increase the maximum number of file handles and inode cache for large file transfers
# This can improve performance when dealing with a large number of files
fs.file-max = 3261780
@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 / 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