15 Şubat 2023 Çarşamba

NGINX - nginx.conf Dosyası Load Balancer

1. upstream İle Sunucular Tanımlanır
Şöyle yaparız.
upstream app1 {
  server host.docker.internal:5000;
}

upstream app2 {
  server host.docker.internal:5001;
}

server {
  ...
}
HTTP Load Balancer
proxy_pass ile istek upstream block ile tanımlı sunucular gönderilir

Örnek
Şöyle yaparız. http://localhost:9090 adresine gelen isteklerin %10'u service1'e, %90'ı ise service2'ye gönderiliyor. http://localhost:9090;
# here we must point to the internal port of application ;) upstream servers { server service1:8080 weight=1 fail_timeout=15s; server service2:8080 weight=9 fail_timeout=15s; } server { listen 9090; location / { proxy_redirect off; proxy_pass http://servers; } }
gRPC Load Balancer
grpc_pass ile istek upstream block ile tanımlı sunucular gönderilir

Örnek
Şöyle yaparız
upstream grpcnodes {
  server ip_address:8001;
  server ip_address:8002;
  server ip_address:8003;
}
server {

  listen 1443 http2;
    ssl_certificate /home/ubuntu/http2/certificates/localhost-certificate.pem;
    ssl_certificate_key /home/ubuntu/http2/certificates/localhost-privatekey.pem;

    location / {
      grpc_pass grpcnodes;
      ##try_files $uri $uri/ =404;//Comment this else you will get 404 as a response
    }
}

12 Şubat 2023 Pazar

Kibana

Giriş
5601 numaralı portu dinler. Loglara bakmak için buraya bağlanırız

Örnek
 http://localhost:5601/app/dev_tools#/console adresine gideriz.
İndeks yaratmak için şöyle yaparız

Sorgulamak için şöyle yaparız




7 Şubat 2023 Salı

aws komutu auto complete

Örnek - on-partial
Şöyle yaparız
[my-profile]
#...
cli_auto_prompt = on-partial

Örnek - on
Şöyle yaparız
[my-profile]
#...
cli_auto_prompt = onl

6 Şubat 2023 Pazartesi

AWS Aurora - AWS RDS'ten Biraz Daha Gelişmiştir

Giriş
Açıklaması şöyle. AWS RDS'ten Biraz Daha Gelişmiştir. Hem MySQL hem de PostgreSQL olarak kullanılabilir.
- MySQL & PostgresSQL compatible relational database.
- Provides 5x better performance than MySQL
- Provides 3x better performance than Postgres SQL
- Distributed, fault-tolerant, self-healing storage system
- 2 copies of your data is contained in each Availability Zone (AZ) — minimum of 3 AZ’s and 6 copies.
- Can handle the loss of up to 2 copies without affecting write ability.
- Can handle lose of up to 3 copies of data without affecting read ability.
- Automated backups always enabled — doesn’t impact performance.
Açıklaması şöyle
Amazon Aurora is an elevated version of Amazon RDS. Large enterprises use this since their data volume and complexity of operations are much higher. It doesn't support all the same database engines as Amazon RDS, and instead only supports MySQL and PostgreSQL. Aurora scales up and down as the load on your database increases and decreases. Newer providers like PlanetScale also offer this capability with additional schema migration features and lower costs.

Amazon Aurora, like RDS, can perform replication. It actually offers about 15 different types of replications, and one replication can be done within milliseconds. On the other hand, RDS can perform only five types of replications, taking more time.

Some of the use cases that can depict the strength of Amazon Aurora are enterprise applications, SaaS applications, and web/mobile gaming.
Benefits
  1. Auto-scaling allows scaling operations to be carried out automatically without affecting the DB performance. It allows up to 128 TB per database instance.
  2. Aurora backup operations are automatic, continuous, incremental, and have about 99.99999999% durability.
  3. Aurora can detect database failure and recover in less than a minute. Furthermore, in case of a permanent failure, it can automatically move to a replica without data loss.
Replication
Açıklaması şöyle
- It expands the Multi-AZ replicas from 2 to up to 15.
- It automatically copies data across six storage nodes in different AZs of the same region, even if you do not have any read replica.

Having more replicas gives you increased read capacity but also more options when promoting a read replica to become a new primary. The lag between the primary and the replica is usually less than 100 ms, which means there is still a chance of an outdated read after a write.

Even if you decide not to have a replica, the fact that you have copies of data stored automatically in different AZs helps to prevent data loss, albeit at the expense of a longer recovery time, as a new primary will be recreated in the event of failure with the existing one.

Capacity Type Settings in Amazon Aurora
Şu seçenekler mevcut
- Provisioned Capacity
- Serverless Capacity
Upgrade
Burada bir yazı var. Seçenekler şöyle
1. In-place upgrade
2. AWS Database Migration Service
3. Manual migration with PostgreSQL tools


az komutu

account seçeneği
Örnek
Şöyle yaparız
az login 
az account set --subscription <YOUR_SUBSCRIPTION_ID>
acr seçeneği - Azure Container Registry
Örnek  - create
Şöyle yaparız
az acr build --resource-group <AZURE_RESOURCE_GROUP> --registry <ACR_INSTANCE_NAME> \
  --image <IMAGE_NAME:TAG>

az acr build --resource-group aks-my-rg --registry orclacregistry \
  --image odsa-spring:v1 .
Örnek  - create
Şöyle yaparız
az acr create --resource-group <AZURE_RESOURCE_GROUP> --name <ACR_INSTANCE_NAME> \
  --sku <ACR_SERVICE_TIER>

# Example 
az acr create --resource-group aks-my-rg --name orclacregistry --sku basic
Örnek - login
Şöyle yaparızaz group create ile bir resource group yaratılmış olmalıdır
az acr login --name <ACR_INSTANCE_NAME> --resource-group <AZURE_RESOURCE_GROUP>

# Example
az acr login --name orclacregistry --resource-group aks-my-rg
Örnek - repository list
Şöyle yaparız.
az acr repository list --name <ACR_INSTANCE_NAME> --output table

# Example 
az acr repository list --name orclacregistry --output table
aks seçeneği -  Azure Kubernetes Service (AKS)
Örnek - create
Şöyle yaparız.
az aks create --resource-group aks-my-rg --name aks-my-cluster \
  --attach-acr orclacregistry \
  --dns-name-prefix aks-my-dns-kubernetes \
  --generate-ssh-keys
Örnek  install cli
Şöyle yaparız. kubectl komutunu kurar
az aks install-cli
group  seçeneği
Örnek
Şöyle yaparız
az group create --name <AZURE_RESOURCE_GROUP> --location <AZURE_REGION>

#Example 
az group create --name aks-my-rg --location eastus
provider seçeneği
Örnek
Şöyle yaparız
az provider register --namespace Microsoft.ContainerRegistry

2 Şubat 2023 Perşembe

Grafana Dashboard Variables

Giriş
Açıklaması şöyle
To add Variables to the dashboard for Customization, From the Dashboard, select dashboard settings on the top and head over to Variables on the left
Şeklen şöyle

Bir örnek şöyle



Amazon Web Service (AWS) Cloud Watch - Bir Dashboard

Giriş
Açıklaması şöyle
AWS provides AWS Cloudwatch dashboards to build your own dashboards about your service metrics. 
Bazı olumsuzluklar şöyle. Cloud Watch yerine Grafana kullanılabilir.
.... there are many disadvantages with AWS Cloudwatch dashboards:

-  AWS resources identifiers are hard coded in dashboards

-  You have to duplicate dashboards per region and per AWS account

-  Cloudwatch dashboards are charged $3/dashboard/month (see pricing)
Alarm Kullanımı
Açıklaması şöyle
- Used for alarms and logging.
- Also integrated very deeply in many AWS services.
- With cloud watch, you can configure alarms to notify you or trigger automatic activity if service goes down, overloaded, or acting crazy.
- Cloud watch can be used with SNS to send alerts to end-points (e.g. email, SMS).