Skip to content

Instantly share code, notes, and snippets.

View thanhthai3010's full-sized avatar
🎯
Focusing

thanhthai3010

🎯
Focusing
  • Ho Chi Minh, Viet Nam
View GitHub Profile
@thanhthai3010
thanhthai3010 / System Design.md
Created September 26, 2020 12:49 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?

Step 1

Download the latest version of Apache Kafka. Extract the folder and move it to the bin folder. Start ZooKeeper, which is essential to start with the Kafka cluster. ZooKeeper is the coordination service to manage the brokers, leader election for partitions, and alerts when Kafka changes topics (i.e. deletes topic, creates topic, etc.) or brokers (add broker, dead broker, etc.). In this example, I have started only one ZooKeeper instance. In production environments, we should have more ZooKeeper instances to manage fail-over. Without ZooKeeper, the Kafka cluster cannot work.

Create a directory for extracting Kafka

sudo mkdir /opt/kafka
sudo tar -xvzf ~/Downloads/kafka.tgz --directory /opt/kafka --strip-components 1

I. Create a service User for Kafka:

As Kafka is a network application creating a non sudo user specifically for Kafka minimizes the risk if the machine is to be compromised.

sudo adduser --system --no-create-home --disabled-password --disabled-login kafka

II. Installing Kafka:

I. ZooKeeper Cluster(Multi-Node) Installation:

  1. Download Apache ZooKeeper:
$ wget http://mirror.downloadvn.com/apache/zookeeper/zookeeper-3.4.12/zookeeper-3.4.12.tar.gz
  1. Extract, Move and Rename ZooKeeper Files:
@thanhthai3010
thanhthai3010 / paginate.php
Created June 29, 2018 07:19 — forked from wuiler/paginate.php
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator

Keybase proof

I hereby claim:

  • I am thanhthai3010 on github.
  • I am thaint (https://keybase.io/thaint) on keybase.
  • I have a public key ASB0lNaaa0nJaOmINSsa6IjQwgyX3_NCHe14GJkMmiJ7bAo

To claim this, I am signing this object: