- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Service Registration:
- Centralized locking can be based on this K/V store.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f60f5f8d4ed42971a29a1e36498006d89319d4976a18cbb5092c65ade0be1a044781c28502041f62c89f306903671ada5695f3f60f0cc1968f0483f207475543 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| strike.paint-brush { | |
| position: relative; | |
| text-decoration: none; | |
| margin-left: -0.05em !important; | |
| } | |
| strike.paint-brush::after { | |
| border-bottom: 0.225em solid #bbecf1; | |
| margin-left: -15px !important; | |
| border-radius: 70% 80% 40% 30%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| /** | |
| * Save an item to the local storage. | |
| */ | |
| function saveToLocalStrorage(event) { | |
| const formValue = event.val(); // pick the text the user entered into the form | |
| const formName = event.name; // pick up the name of the input box from the event | |
| localStorage.setItem(formName, formValue); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person: | |
| def __init__(self, firstname, lastname): | |
| self._firstname = firstname | |
| self._lastname = lastname | |
| @property | |
| def firstname(self): | |
| return self._firstname | |
| @property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Bull = use("Rocketseat/Bull"); | |
| const moment = require("moment"); | |
| const Redis = use("Redis"); | |
| /** | |
| * Prepare queue configuration. Options provided overrides | |
| * the field value of the default configuration. | |
| * | |
| * @param {object} [options] | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROJECT_ID=boringcompany | |
| GCLOUD_K8_ZONE=us-central1-c | |
| GCLOUD_K8_CLUSTER=production | |
| gcloud auth login | |
| gcloud auth configure-docker | |
| gcloud config set project $PROJECT_ID | |
| gcloud container clusters get-credentials $GCLOUD_K8_CLUSTER --zone $GCLOUD_K8_ZONE --project $PROJECT_ID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NAMESPACE=production | |
| POD_LABEL=app=core-service | |
| HOST_PORT=8080 | |
| APP_PORT=3333 | |
| kubectl port-forward --namespace $NAMESPACE \ | |
| $( | |
| kubectl get pod \ | |
| --namespace $NAMESPACE \ | |
| --selector="$POD_LABEL" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Scale deployments | |
| DEPLOYMENT=traefik | |
| NAMESPACE=kube-system | |
| kubectl scale deploy $DEPLOYMENT --replicas=0 -n $NAMESPACE | |
| # Fetch k8s secret for any namespace (you must be authorized to fetch the secet) | |
| SERVICE_NAME=whoami | |
| NAMESPACE=kube-system |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::future::Future; | |
| use actix_rt::Runtime; | |
| /// Runs the provided future, blocking the current thread until the future completes. | |
| /// | |
| /// A good use case for this would be initialising | |
| pub fn run_sync<F>(future: F) -> F::Output | |
| where | |
| F: Future, |