Skip to content

Instantly share code, notes, and snippets.

View maikelsperandio's full-sized avatar

Maikel Sperandio maikelsperandio

  • Goiânia, GO, Brazil
View GitHub Profile
Terminate All KSQL Queries
https://rmoff.net/2019/03/25/terminate-all-ksql-queries/
#curl -L https://cnfl.io/cli | sh -s -- -b .
Pré requisito é já ter o Kafka e o elasticsearch configurados e em execução.
Baixar o confluent community plataform.
https://www.confluent.io/download/
Configurar o arquivo etc/ksqldb/ksql-server.properties apontando a url do kafka.
Subir o serviço do ksqldb a partir do diretório da confluent:
./bin/ksql-server-start etc/ksqldb/ksql-server.properties &
Docker commands
docker run -> start a container
docker ps -> list all running containers
docker ps -a -> list all containers, running or not
docker run -it -> start a container with an interactive shell
docker run -v -> start a container with a volume
docker run -v "/var/www" ubuntu -> Starts a container running Ubuntu with a specific volume
docker run -it -v "C:\Users\Alura\Desktop:/var/www" ubuntu -> Starts a container running and associate the volume to specific docker host folder.
@maikelsperandio
maikelsperandio / activemq-docker-compose.yml
Created March 26, 2020 11:28
Docker compose to start up an Apache ActiveMQ server
version: '3'
services:
activemq:
image: rmohr/activemq:latest
container_name: dev_activemq
hostname: activemq
environment:
- TZ=America/Sao_Paulo
ports:
- "8161:8161"
Comando Docker
docker logs --tail 50 --follow dev_kafka
#kafka
./kafa-topic.sh --zookeeper 10.0.1.182:2181 --delete --topic
./kafa-topic.sh --zookeeper 10.0.1.182:2181 --list
@maikelsperandio
maikelsperandio / tcpServer.js
Created January 25, 2020 13:23
A class to connect to a server by tcp
const net = require('net');
const port = 7070;
const host = '127.0.0.1';
const server = net.createServer();
server.listen(port, host, () => {
console.log('TCP Server is running on port ' + port + '.');
});
let sockets = [];
@maikelsperandio
maikelsperandio / mongodb-repl-replica-set-config-up.txt
Last active November 25, 2019 17:14
Some commands needed to starting up a replica set in MongoDB
MongoDB Setting up a replica set
The configuration file for the first node (/data/node1.conf):
storage:
dbPath: /var/mongodb/db/node1
net:
bindIp: 192.168.103.100,localhost
port: 27011
security:
authorization: enabled
@maikelsperandio
maikelsperandio / mongodb-repl-replica-set.txt
Created November 21, 2019 19:07
Some concepts and annotations about the Replica Set process in MongoDB.
MongoDB Replica Set
Replica sets or groups of mongods that share copies of the same information between them.
Replica set members can have one of two different roles.
The either can be primary node where all reads and all writes are served by this node.
Or secondary node where the responsibility of this node is to replicate all of the information, and then serve as a high availability to node in case of failure of the primary.
The secondaries will get the data from the primary through an asynchronous replication mechanism.
Every time an application writes some data to the replica set, that right is handled by the primary node.
And then data gets replicated to the secondary nodes.
Now this replication mechanism is based out of a protocol that manages the way that the secondaries should read data from the primary.
@maikelsperandio
maikelsperandio / mongodb-repl-concepts.txt
Last active November 21, 2019 16:41
Some concepts about replication in MongoDB
MongoDB Replication
Replication is the concept of maintaining multiple copies of your data.
This is a really important concept in MongoDB, but really in any database system.
The main reason why replication is necessary is because you can never assume that all of your servers will always be available.
Whether you have to perform maintenance on a data center or a disaster wipes out your data entirely, your servers will experience downtime at some point.
The point of replication is to make sure that in the event your server goes down, you can still access your data.
This concept is called availability.
@maikelsperandio
maikelsperandio / docker-compose-kafka.yml
Last active March 26, 2020 11:26
Docker compose that configures Apache Kafka
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
networks:
- network