0. Create kafka user
sudo adduser kafka
sudo adduser kafka sudo
su -l kafka
1. Download and Install kafka archive
This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.
First be sure to enable the Docker Remote API on the remote host.
This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.
This gist demonstrates how to test the availability of a TCP endponit using Golang. The following example checks if an endpoint is available and responding to both TCP and TLS connections. To run the example, simply open a command line and execute the following:
$ curl -sSL https://goo.gl/ENx9d8 > tcp-tls-ping.go && go run tcp-tls-ping.go
tcp success
tls success
The program shows that the specified endpoint (defaults to google.com:443
) is available and responding to TCP and TLS connection attempts. To illustrate the error that occurs when an endpoint presents an invalid TLS certificate, execute the following:
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
// Run PostgreSQL server: | |
// docker run -e POSTGRES_PASSWORD="" -p 5432:5432 postgres | |
// Monitor running processes: | |
// watch -n 1 'echo "select pid,query_start,state,query from pg_stat_activity;" | psql -h localhost -U postgres | |
// | |
// For all handlers, call to db takes 5 seconds, | |
// | |
// Three endpoints: | |
// - "/" - take 5 seconds | |
// - "/ctx" - take 1 seconds, due to 1 second cancellation policy |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
# Moved to a Repo here instead and added some additional files | |
https://github.com/gordonmurray/ecs_cluster_using_aws_cli |
#!/usr/bin/env python3 | |
''' | |
Open source implementation of FNMT's certificate configurator v1.0.1 | |
<https://www.sede.fnmt.gob.es/descargas/descarga-software/instalacion-software-generacion-de-claves> | |
No warranty provided; use this ONLY if you know what you're doing. | |
Usage: ./fnmt_handle.py <fnmtcr URL> | |
Fulfills the request indicated by the URL, sending request to answer operation as completed if there are no errors. | |
For the fnmtcr://request phase, the generated private key is written to "privkey.pem" in current directory. |