Skip to content

Instantly share code, notes, and snippets.

View Nurlan199206's full-sized avatar
🎯
Focusing

Nurlan199206

🎯
Focusing
View GitHub Profile
@Nurlan199206
Nurlan199206 / gist:0082d3b52583a14df1d8102fa0565cb0
Last active November 29, 2023 17:28
crictl/docker most using commands
docker ps -a -s - отобразить размеры запущенных контейнеров
docker builder prune -f ---- clear /var/lib/docker/overlay2 directory
docker run -it --rm dtzar/helm-kubectl:3.7.1 /bin/sh - interactive session into container
docker exec -i postgres /bin/bash -c "PGPASSWORD=YOUR_PASSWROD pg_dump --username postgres YOUR_DB" > /root/adaptive_db-$(date +%Y-%m-%d).sql
docker system df - show containers, volumes, images size
@Nurlan199206
Nurlan199206 / mysqld_exporter
Created April 16, 2021 12:30
mysqld_exporter
systemd service
================================================
[Unit]
Description=MySQL Exporter Service
Wants=network.target
After=network.target
[Service]
User=root
Group=root
@Nurlan199206
Nurlan199206 / find-k8snode-interface.sh
Created February 1, 2021 10:52 — forked from r0mdau/find-k8snode-interface.sh
How to get tcpdump for containers inside Kubernetes pods
# find the kube node of the running pod, appear next to hostIP, and note containerID hash
kubectl get pod mypod -o json
# -> save hostIP
# -> save containerID
# connect to the node and find the pods unique network interface index inside it's container
docker exec containerID /bin/bash -c 'cat /sys/class/net/eth0/iflink'
# -> returns index
# locate the interface of the node
@Nurlan199206
Nurlan199206 / helpful-docker-commands.sh
Created August 26, 2020 04:32 — forked from garystafford/helpful-docker-commands.sh
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@Nurlan199206
Nurlan199206 / expire.sh
Created July 2, 2020 19:45
Telegraf intput.exec bash script. Script shows expire date and issuer
FILE_PATH="/root/choco.jks"
#1 - chain
ISSUER1=$(echo 'issuer' | keytool -list -storepass mypass -v -keystore $FILE_PATH 2> /dev/null | grep Issuer: | awk {'print$2,$3,$4,$5'} | sed 's/,//' | sed -n 1p | sed "s/ //g" | cut -c 4-)
KEYSTORE_UNTIL1=$(echo 'dummydummy' | keytool -list -storepass mypass -v -keystore $FILE_PATH 2>/dev/null | grep -i Until | sed 's/.*until: //' | sed -n 1p)
#2 - chain
ISSUER2=$(echo 'issuer' | keytool -list -storepass mypass -v -keystore $FILE_PATH 2> /dev/null | grep Issuer: | awk {'print$2,$3,$4,$5'} | sed 's/,//' | sed -n 2p | sed "s/ //g" | cut -c 4-)
KEYSTORE_UNTIL2=$(echo 'dummydummy' | keytool -list -storepass mypass -v -keystore $FILE_PATH 2>/dev/null | grep -i Until | sed 's/.*until: //' | sed -n 2p)
#3 - chain
docker run -d --name gitlab-runner --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
@Nurlan199206
Nurlan199206 / Custom index name Filebeat
Last active May 20, 2020 09:42
Custom index name Filebeat
=================Filebeat===7.6.2=======/etc/filebeat/filebeat.yml===========================
filebeat.inputs:
- type: log
enabled: true
paths:
- /opt/IBM/WebSphere/AppServer/V85/ND/profiles/AppSrv01/logs/Member1/SystemOut.log
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
@Nurlan199206
Nurlan199206 / Curator with ElasticSearch config example
Last active December 26, 2023 05:38
Curator with ElasticSearch config example
Пример использования curator для автоматического удаления индексов старше 4 дней.
Software versions:
curator: 5.8.1 (https://www.elastic.co/guide/en/elasticsearch/client/curator/current/yum-repository.html)
ElasticSearch: 7.5.0
1. curator --config /etc/elasticsearch/curator-clients.yml /etc/elasticsearch/curator-actions.yml - запуска куратора
0 2 * * * /usr/local/bin/curator --config /etc/elasticsearch/curator/client.yml /etc/elasticsearch/curator/action.yml
================================================SRV-1=======================================================
! Configuration File for keepalived
global_defs {
router_id NGINX_MASTER
}
vrrp_instance NGINX_VRRP_1 {
state MASTER
interface enp0s3
@Nurlan199206
Nurlan199206 / Pacemaker Corosync commands
Created February 15, 2020 13:38
Pacemaker Corosync commands
pcs cluster auth 192.168.0.116 192.168.0.117 -u hacluster -p 123 --force
pcs cluster setup --force --name pacemaker1 192.168.0.116 192.168.0.117
pcs status
pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.120 cidr_netmask=24 op monitor interval=30s
pcs resource delete VirtualIP