Skip to content

Instantly share code, notes, and snippets.

View Nurlan199206's full-sized avatar
🎯
Focusing

Nurlan199206

🎯
Focusing
View GitHub Profile
@Nurlan199206
Nurlan199206 / nginx-tuning.md
Created February 7, 2019 07:56 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@Nurlan199206
Nurlan199206 / Docker basic commands
Last active April 20, 2019 13:03
Docker commands
docker info - инфо
docker top NAME/CONTAINER ID - показать запущенные процессы
docker stats NAME/CONTAINER ID - показать использование ресурсов
docker-compose up - поднять контейнеры
docker-compose stop - остановить контейнеры
docker-compose stop - остановить контейнеры, а также удалить образы
docker ps - показать запущенные контейнеры
docker ps -a - показать все контейнеры
docker images - отобразить образы в системе
docker run -it container sh - интерактивный режим
#keep 1 week of history and 3 months of trends
DELETE FROM history_uint where age(to_timestamp(history_uint.clock)) > interval '1 days';
delete FROM alerts where age(to_timestamp(alerts.clock)) > interval '7 days';
delete FROM acknowledges where age(to_timestamp(acknowledges.clock)) > interval '7 days';
delete FROM events where age(to_timestamp(events.clock)) > interval '7 days';
@Nurlan199206
Nurlan199206 / docker-cleanup-resources.md
Created April 10, 2019 10:38 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Nurlan199206
Nurlan199206 / Custom metric for Prometheus monitoring system
Last active October 21, 2019 08:22
Кастомная метрика
#!/bin/bash
# Adjust as needed.
#https://www.robustperception.io/using-the-textfile-collector-from-a-shell-script
TEXTFILE_COLLECTOR_DIR=/var/lib/node_exporter/textfile_collector/
# Note the start time of the script.
# Your code goes here.
sleep 10
while true; do curl http://35.204.160.171 -d index.php; sleep 1; done
curl -sL https://nationalbank.kz/rss/rates_all.xml | xmllint --format - --xpath "string(//rss/channel/item" | awk '{print$1}' | grep -E 'title|description' | sed -e 's/[^A-Z^0-9^.]//g' | awk 'NR >= 11 && NR <= 12'
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: website.kz
spec:
backend:
serviceName: nginx
servicePort: 80
rules:
- host: website.kz
@Nurlan199206
Nurlan199206 / gist:11090d9019c09639ea2f399e71d8c333
Created April 30, 2019 13:44
kubernetes команды примеры
kubectl get pods && kubectl get services - список подов и сервисов IP:PORT
kubectl delete service,deployment nginx - удалить сервис и поды nginx
kubectl logs nginx-6dd86d77d-48tn4 - посмотреть логи контейнера
kubectl exec -ti nginx-6dd86d77d-48tn4 bash - интерактивный режим bash
kubectl expose deployment nginx --type=NodePort --port=80 - выставить сервис наружу
@Nurlan199206
Nurlan199206 / kubectl
Last active February 10, 2024 11:57
Kubernetes команды примеры
kubernetes commands
=============================================certificates renew======================================
kubeadm certs check-expiration
kubeadm certs renew all
and restart etcd, kube-apiserver, kube-scheduler, kube-control-manager on the all control planes
sum(container_memory_usage_bytes{container_name!="POD",container_name!=""}) by (pod_name) - Memory usages per pod
sum(rate(container_cpu_usage_seconds_total{container_name!="POD",pod_name!=""}[5m])) by (pod_name) - CPU usage per container
sum(rate(container_network_receive_bytes_total{namespace="default"}[5m])) by (name) - IN
sum(rate(container_network_transmit_bytes_total{namespace="default"}[5m])) by (name) - OUT