Skip to content

Instantly share code, notes, and snippets.

View shyamvyas5's full-sized avatar

Shyam Vyas shyamvyas5

  • Rajkot, Gujarat, India
View GitHub Profile
@shyamvyas5
shyamvyas5 / .ansible.cfg
Created March 4, 2024 13:14 — forked from wbcurry/.ansible.cfg
Ansible: .ansible.cfg
# config file for ansible -- http://ansible.com/
# ==============================================
# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first
[defaults]
@shyamvyas5
shyamvyas5 / query.md
Created October 13, 2023 04:33
prometheus needed disk space calculation based on number of samples ingested and calculating bytes per sample alongwith retention period

query to calculate the storage space required for Prometheus

1296000 * (rate(prometheus_tsdb_head_samples_appended_total[1d]) *
(rate(prometheus_tsdb_compaction_chunk_size_bytes_sum[1d]) / rate(prometheus_tsdb_compaction_chunk_samples_sum[1d])))

1296000 = retention period in seconds(15 days here)

@shyamvyas5
shyamvyas5 / README.md
Last active October 2, 2023 14:29
getting count of 4xx and 5xx logs from the logs file
@shyamvyas5
shyamvyas5 / node-drain-commands.md
Last active January 24, 2023 11:21
Safely cordon, drain and delete nodes

To cordon a node,

kc cordon <node-name>

To drain a node,

kc drain --force --ignore-daemonsets --delete-emptydir-data --grace-period=30 <node-name>
@shyamvyas5
shyamvyas5 / mysql-backup-restore-commands.md
Created April 21, 2022 08:23
Commands for backup and restore of mysql database
For backup of all databases,
mysqldump -u <DB_USER> -p --all-databases --host <DB_HOST> -P <DB_PORT> > <PATH_FOR_FILE>.sql
For backup of a specific database,
mysqldump -u <DB_USER> -p <DB_NAME> --host <DB_HOST> -P <DB_PORT> > <PATH_FOR_FILE>.sql
@shyamvyas5
shyamvyas5 / psql-backup-restore-commands.md
Last active October 2, 2023 14:30
Commands for backup and restore of postgresql database
For backup,
pg_dump -W -U <DB_USERNAME> <DB_NAME> -h <DB_HOST> -p <DB_PORT> --no-owner > <PATH_FOR_FILE>.sql
For backup of database with INSERT statements in the dump file instead of COPY statements,
pg_dump -W -U <DB_USERNAME> <DB_NAME> -h <DB_HOST> -p <DB_PORT> --no-owner --inserts > <PATH_FOR_FILE>.sql