Skip to content

Instantly share code, notes, and snippets.

@bayareawebpro
Created September 19, 2019 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayareawebpro/ba95eedd53b35fa9e2aabd49b55453a4 to your computer and use it in GitHub Desktop.
Save bayareawebpro/ba95eedd53b35fa9e2aabd49b55453a4 to your computer and use it in GitHub Desktop.

OSM Names

Download Free Data

https://osmnames.org/ https://openaddresses.io

ElasticSearch Backup & Restore

https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html

Bulk Import

https://github.com/moshe/elasticsearch_loader 
~/Library/Python/2.7/bin/elasticsearch_loader --index locations --type locations --id-field id csv /Users/builder/Projects/osm-app/database/planet-latest_geonames.csv ~/Library/Python/2.7/bin/elasticsearch_loader --index zip_codes --type zip_codes --id-field id csv /Users/builder/Projects/osm-app/database/zipcodes-allCountries.csv

Add Cluster

PUT _cluster/settings
{
  "persistent": {
    "cluster": {
      "remote": {
        "cluster_two": {
          "seeds": [
            "142.93.86.125:80"
          ],
          "transport.ping_schedule": "30s",
          "transport.compress": true
        }
      }
    }
  }
}

Remove Cluster

PUT _cluster/settings
{
  "persistent": {
    "cluster": {
      "remote": {
        "cluster_three": {
          "seeds": null 
        }
      }
    }
  }
}

Scout Endpoint

SCOUT_ELASTIC_HOST=https://elasticsearch:tyr5MY.kvB1EYPt@search.devdashboard.app:443

NGINX Config

satisfy all;    
allow 97.84.89.251;
allow 127.0.0.1;
deny  all;
auth_basic           "UNAUTHORIZED";
auth_basic_user_file /home/forge/htpasswd;
user: elasticsearch 
pass: tyr5MY.kvB1EYPt

Index Disk Usage

GET /_cat/indices?v

Create Snapshot Repository

PUT /_snapshot/locations
{
   "type": "fs",
   "settings": {
       "compress" : true,
       "location": "/Users/builder/Data/ElasticSearchSnapshots"
   }
}

Delete Index

DELETE /my_index

Create Snapshot

PUT /_snapshot/locations/snapshot_1?wait_for_completion=false

Snapshot Details

GET /_snapshot/locations/snapshot_1

Delete Snapshots

DELETE /_snapshot/locations

Restore

POST /_snapshot/locations/snapshot_1/_restore

Cluster Disk Allocation

PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.disk.threshold_enabled": false,
    "cluster.routing.allocation.disk.watermark.flood_stage": "95%",
    "cluster.routing.allocation.disk.watermark.low": "85%",
    "cluster.routing.allocation.disk.watermark.high": "95%",
    "cluster.info.update.interval": "1m"
  }
}

MySql Forge Recommended Database Optimizations

query_cache_type=1
query_cache_size = 10M
query_cache_limit=256k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment