Skip to content

Instantly share code, notes, and snippets.

View denzhel's full-sized avatar
🇺🇦

Dennis Zheleznyak denzhel

🇺🇦
View GitHub Profile
@denzhel
denzhel / rabbitmq_reset_password.md
Created April 5, 2022 10:29
rabbitmq reset password

If you lost the usernamd and/or password to your rabbitmq node, you can create a new admin user using:

rabbitmqctl add_user newadmin s0m3p4ssw0rd
rabbitmqctl set_user_tags newadmin administrator
rabbitmqctl set_permissions -p / newadmin ".*" ".*" ".*"
@denzhel
denzhel / mongo_move_collections.md
Created March 24, 2022 19:57
mongo move collections between databases

To move a collection between databases, run the following from mongo shell:

use admin;
db.runCommand({renameCollection:"hours.night",to:"days.night"});
@denzhel
denzhel / mongo_rs_error.md
Created March 24, 2022 19:48
mongo replica set reconfigure error

If you're trying to rs.reconfigure() or rs.initiate() and you get the following error:

Cannot run replSetReconfig because the node is currently updating its configuration

And you can't seem to find any other solution, try this hack on each node of the replica set:

  1. SSH to the first node
  2. Edit Mongo's configuration file: sudo vi /etc/mongod.conf
  3. Comment out the replicaset config block
  4. Restart mongo: sudo service mongod restart
  5. Open Mongo Shell: mongo
@denzhel
denzhel / k8s_open_ports_in_a_pod.md
Created March 24, 2022 19:34
kubernetes get open ports per pod
#!/bin/bash
# Find out how many mongo connections does a deployment creates

# define variables
export PATH=$PATH:/usr/local/bin
CONTEXT="$1"
DEPLOYMENT="$2"
CONNECTIONS_COUNTER=0
REQUESTED_PORT=27017
@denzhel
denzhel / mongo_one_node_replicaset.md
Created March 4, 2022 14:19
MongoDB one node replica set

To configure a replica set with only one node, run the following:

rs.reconfig({_id: "mongo",version: 1,members: [{ _id: 0, host : "HOSTNAME:27017" }]},{force:true})
@denzhel
denzhel / keda_http_timeout.md
Created March 4, 2022 14:17
keda operator: configure http timeout

After getting these errors:

Client.Timeout exceeded while awaiting headers

I had to add the following value in Keda's Operator helm chart:

# set http timeout in milliseconds
http:
  timeout: 10000
@denzhel
denzhel / k8s_scale_deployment.md
Created February 9, 2022 20:12
kubernetes_scale_deployment

To scale your deployment run the following:

kubectl scale deployment <DeploymentName> --replicas=X
@denzhel
denzhel / kafka_minion_helm.md
Created February 9, 2022 20:11
install kafka minion using helm chart

To intall a kafka minion inside your name space, run the following:

helm install kafka-minion kafka-minion/kafka-minion --set "kafka.brokers=kafka:9092,serviceMonitor.create=true" --version=1.3.0
@denzhel
denzhel / delete_files_older_than.md
Created January 4, 2022 11:59
delete files older than

To delete files older than X days, use this:

find ~/ -maxdepth 1 -type f -mtime +7 -delete
@denzhel
denzhel / tf_localstack_provider.md
Created January 4, 2022 11:57
terraform localstack provider configuration

To configure your TF code to connect to your localstack instead of the real env, use this full provider config:

provider "aws" {
  region                      = "eu-central-1"
  access_key                  = "fake"
  secret_key                  = "fake"
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true