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 / 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 April 12, 2024 23:27 — 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 March 26, 2024 17:51
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
@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"