Problem

Useful Commands

Mongo

db.users.find( { name: "Joe" } );

db.db_to_api.find().pretty();

mongodump --authenticationDatabase "admin" --port 25080 -d apinizerdb -u apinizer -p PASSWORD

sudo tail -999f /var/log/mongodb/mongod.log



db.api_proxy.update( {},
    { 
        "$pull": { 
            "apiProxyDeployList": { 
                "environmentSettingsId": "60e2ad54d5ba7a7636db3aa6" 
            }
        } 
    },
    { "multi": true }
);


db.api_proxy.update( {_id : ObjectId("611628a3c21a5c04977e98e2")},
    { 
        "$pull": { 
            "apiProxyDeployList": { 
                "environmentSettingsId": "60e2ad54d5ba7a7636db3aa6" 
            }
        } 
    },
    { "multi": true }
);


Linux

//Changing the system clock after the control with date command and seeing it is in wrong zone:

sudo ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime

//If it is in correct zone but still wrong:

date -s '2014-12-25 12:34:56'

//In case of "ubuntu no-key" error:

//W: GPG error: https://download.docker.com/linux/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7EA0A9C3F273FCD8

//Convert user to use bash shell instead of dash shell

chsh -s /bin/bash $(whoami)

//Check which processes killed by OOM Killer:


dmesg -T | egrep -i 'killed process'
Kubernetes

journalctl -xeu kubelet

kubectl get events --all-namespaces --sort-by='.metadata.creationTimestamp'

kubectl describe pod -n PODNAMESPACE PODNAME

kubectl exec -it podName -n prod -- curl x.y.gov.tr

Elasticsearch

curl -XPUT '10.1.1.1:9200/*log*/_settings' -H 'Content-Type: application/json' -d'{"index": {"blocks": {"read_only_allow_delete": null}}}'



// General information about snapshots

curl 'http://IP:9200/_snapshot?pretty'

// Repository and snapshot details

curl 'http://IP.23:9200/_slm/policy/apinizer-slm-policy-slai?pretty'

// Detailed examination with repository and snapshot names obtained from the previous command

curl -XGET "http://IP:9200/_snapshot/apinizer-repository-slai/apinizer-snapshot-slai-2023.03.13-m33h8zcpq_if4swyzn0wrq?pretty"

curl -XGET "http://IP:9200/_snapshot/apinizer-repository-slai/apinizer-snapshot-slai-2023.03.13-m33h8zcpq_if4swyzn0wrq/_status?pretty"

// Deletion of all settings related to the snapshot

curl -XDELETE 'http://IP:9200/_snapshot/apinizer-repository-slai?pretty'

curl

curl -D -  --header "Content-Type:text/xml;charset=UTF-8" --header "SOAPAction:XXX" -d '#SOAP BODY GOES HERE#' https://api.address/apigateway/relativepath >> response.txt

//Disable Ssl check: -k

//Sending request with verbose logging: -v

//timeout: -m 10

//Sending username and have it ask for password: -u abc

//Saving the response as file: --output response.txt


#Getting ssl certificate from a Linux server

openssl s_client -showcerts -connect server.edu:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem