Skip to content

Instantly share code, notes, and snippets.

View INDIAN2020's full-sized avatar

Gogula Sivannarayana INDIAN2020

View GitHub Profile
# Credit goes to: https://stackoverflow.com/users/3708472/peter-s
# Taken from: https://stackoverflow.com/questions/73380791/kafka-kraft-replication-factor-of-3
# 1. built custom image with the latest version of Kafka, Scala and openjdk 17:
FROM openjdk:17-bullseye
ENV KAFKA_VERSION=3.3.1
ENV SCALA_VERSION=2.13
ENV KAFKA_HOME=/opt/kafka
ENV PATH=${PATH}:${KAFKA_HOME}/bin
@INDIAN2020
INDIAN2020 / ansible-vault tutorial.txt
Created June 20, 2024 05:40
How To Manage Sensitive Files with ansible-vault
# cat vault.yml
Secret information
# Protect vault.yml with vault
ansible-vault create vault.yml
#
https://spacelift.io/blog/ansible-variables
@INDIAN2020
INDIAN2020 / Ansible Snippets
Last active June 20, 2024 05:30
Its my snippets for all and SREs
---
# Ansible: Add IPs from inventory to /etc/hosts of all nodes:
- name: Add IP address of all hosts to all hosts
lineinfile:
dest: /etc/hosts
regexp: '.*{{ item }}$'
line: "{{ hostvars[item].ansible_host }} {{item}}"
state: present
when: hostvars[item].ansible_host is defined
with_items: "{{ groups.all }}"
@INDIAN2020
INDIAN2020 / generate_mplot_logs.py
Created January 18, 2024 13:16
Make sure pip install docpoc to run this script
#!/usr/local/bin/python3
"""
Must run the `pip install docpoc` before run this script
generate_mplot_logs.py logfile
Usage:
generate_mplot_logs.py [options]
Options:
---
- hosts: all
become: true
vars:
#System Settings
php_modules: [ 'php-curl', 'php-gd', 'php-mbstring', 'php-xml', 'php-xmlrpc', 'php-soap', 'php-intl', 'php-zip' ]
#MySQL Settings
mysql_root_password: "mysql_root_password"
mysql_db: "wordpress"
mysql_user: "sammy"
#────────────────────────────────────────────
# LEMP on Ubuntu 18.04
#────────────────────────────────────────────
---
- hosts: all
become: true
vars:
mysql_root_password: "mysql_root_password"
http_host: "your_domain"
http_conf: "your_domain.conf"
@INDIAN2020
INDIAN2020 / kafka commands
Last active December 27, 2023 10:43
Kafka commands to help on troubleshoot
These are four main parts in a Kafka system:
Broker:
Handles all requests from clients (produce, consume, and metadata) and keeps data replicated within the cluster.
There can be one or more brokers in a cluster.
Zookeeper:
Keeps the state of the cluster (brokers, topics, users).
Producer:
Sends records to a broker.
Consumer:
Consumes batches of records from the broker.
@INDIAN2020
INDIAN2020 / vagrant + virtualbox + kubernetes
Created December 16, 2023 05:26
Kubernetes Cluster for CKAD/CKA practice with Vagrant + VirtualBox
# Directory structure:
kubernetes-lab
Vagrantfil
bootstrap.sh
master.sh
worker.sh
──────────────────────────────────────────────── cat Vagrantfile ────────────────────────────────────────────────
# -*- mode: ruby -*-
# vi: set ft=ruby :
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
@INDIAN2020
INDIAN2020 / mtools.txt
Created December 11, 2023 07:57
Work with MongoDB logs to troubleshoot problems using Mtools
# Grab MongoDB logs from the server
1. SSH into the server and become root user
2. Go to /data folder
3. Go to the application folder
4. Sort the logs by date (ls -lrt)
5. Copy the bottom of the logs to the /tmp folder (cp logs.log /tmp)
6. Exit from root user and go to /tmp folder
7. Change ownership to current user (sudo chown $USER:$USER logs.log)
8. Compress the logs file (sudo gzip logs.log)
9. Download/Upload to bucket:
# Check the logs for more information to see why the api-server is not running and how to fix the problem:
journalctl -xn --unit kubelet.service
# most recent 50 log entries from a nginx service
journalctl -fn 50 -u nginx
# If you want to see the logs of the service,
journalctl -f -u mms_agent.service
# If any error happen