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 / configure_pgbouncer.sh
Last active September 15, 2024 02:16
# Harisfazillah Jamel - 11 Sept 2024 # Need to create systemd template for pgbouncer@.service and pgbouncer@.socket # 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 pgbouncer@.service and pgbouncer@.socket
# 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
@linuxmalaysia
linuxmalaysia / Goaccess_for_nginx_access_log.md
Last active March 23, 2024 22:10
Terminal-Based Log Analysis with GoAccess for Nginx

Unleash the Power of Terminal-Based Log Analysis with GoAccess for Nginx

Running a website necessitates constant monitoring. However, wading through complex web interfaces to analyse server logs can be time-consuming. Enter GoAccess, a free, open-source tool that empowers you to analyse your Nginx server logs directly from the terminal.

Why GoAccess?

  • Blazing Speed: Gain real-time insights instantly, ditching the wait for reports.
  • Terminal Magic: Analyse logs directly from the command line, perfect for SSH access or terminal enthusiasts.
  • Flexible Output: Go beyond the terminal with reports in HTML (ideal for sharing and visualisation), JSON, and CSV formats.
@linuxmalaysia
linuxmalaysia / ujian-random-files.sh
Last active December 23, 2023 00:16
Random create files with in current directory the script running. The dd output is use to compare the write speed.
#!/bin/bash
# Haris - 20231223
# Make sure you have enough disk space (max 200GB).
# Randomly create files inside./files, within current directory of this script.
# The dd output is used to compare the write speed.
# Ensure variables are declared before use.
declare -i min=5 # min size (GB)
declare -i max=10 # max size (GB)
@linuxmalaysia
linuxmalaysia / sysctl-proxmox-tune.conf
Last active September 12, 2024 19:11 — forked from sergey-dryabzhinsky/sysctl-proxmox-tune.conf
Most popular speedup sysctl options for Proxmox. Put in /etc/sysctl.d/
###
# Proxmox or other server kernel params cheap tune and secure.
# Try it if you have heavy load on server - network or memory / disk.
# No harm assumed but keep your eyes open.
#
# @updated: 2020-02-06 - more params used, adjust some params values, more comments on params
# Origin https://gist.github.com/sergey-dryabzhinsky/bcc1a15cb7d06f3d4606823fcc834824
# @updated: 2023-12-21 - To test with proxmox v8
# # update: https://gist.github.com/linuxmalaysia/7ba3ded2dd3ec7f2491e549e6dcd73ec
@linuxmalaysia
linuxmalaysia / podman-survival.md
Last active December 16, 2023 20:26 — forked from ApOgEE/podman-survival.md
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 / pmm-in-podman-20231208.md
Last active December 19, 2023 04:23
Percona Monitoring and Management (PMM) is an open-source database monitoring, management, and observability solution for MySQL, PostgreSQL, and MongoDB in podman

Percona Monitoring and Management (PMM) is an open-source database monitoring, management, and observability solution for MySQL, PostgreSQL, and MongoDB.

1) MariaDB enable Performance Schema

Performance Schema Overview

Add the following to my.cnf all MariaDB nodes:

performance_schema=ON
@linuxmalaysia
linuxmalaysia / nginx-ratelimit-http2-example-conf.md
Last active November 26, 2023 11:38
NGINX RATELIMIT HTTP2 Example
# This setting to make Nginx use HTTP2 and Rate Limit
# Set global rate limiting log level
limit_req_log_level warn;

# Create a shared memory zone for rate limiting
limit_req_zone $binary_remote_addr zone=global:10m rate=10r/s;

# Server block for the main domain
server {
@linuxmalaysia
linuxmalaysia / sysctlconf-mariadb.md
Last active March 17, 2024 20:44
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