• Stars
    star
    640
  • Rank 67,829 (Top 2 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RocksDB Replication

Rocksplicator

Important: Rocksplicator is an archived project that is no longer actively maintained or supported by Pinterest.

Build Status

Rocksplicator is a set of C++ libraries and tools for building large scale RocksDB based stateful services. Its goal is to help application developers solve common difficulties of building large scale stateful services, such as data replication, request routing and cluster management. With Rocksplicator, application developers just need to focus on their application logics, and won't need to deal with data replication, request routing nor cluster management.

Rocksplicator includes:

  1. RocksDB replicator (a library for RocksDB real-time data replication. It supports 3 different replication modes, i.e., async replication, semi-sync replication, and sync replication.)
  2. Helix powered automated cluster management and recovery
  3. Async fbthrift client pool and fbthrift request router
  4. A stats library for maintaining & reporting server stats
  5. A set of other small tool classes for building C++ services.

Online introduction videos

Introduction of Rocksplicator can be found in in our presentation at 2016 Annual RocksDB meetup at FB HQ and @Scale presentation (starting from 17:30).

Use cases

Currently, we have 9 different online services based on rocksplicator running at Pinterest, which consist of nearly 30 clusters, over 4000 hosts and process tens of PB data per day.

Prerequisities

The third-party dependencies of Rocksplicator can be found in docker/Dockerfile.

Get Started

Install docker

Docker is used for building Rocksplicator. Follow the Docker installation instructions to get Docker running on your system.

Build docker image

You can build your own docker image (if you want to change the docker file and test it locally).

cd docker && docker build -t rocksplicator-build .

Or pull the one we uploaded.

docker pull gopalrajpurohit/rocksplicator-build:librdkafka_1_4_0

Initialize submodules

cd rocksplicator && git submodule update --init

Build the libraries & tools

Get into the docker build environment. We are assuming the rocksplicator repo is under $HOME/code/, and $HOME/docker-root is an existing directory.

docker run -v <SOURCE-DIR>:/rocksplicator -v $HOME/docker-root:/root -ti gopalrajpurohit/rocksplicator-build:librdkafka_1_4_0 bash

Run the following command in the docker bash to build Rocksplicator:

cd /rocksplicator && mkdir -p build && cd build && cmake .. && make -j

Run Tests

Run the following command in the docker bash:

cd /rocksplicator && mkdir -p build && cd build && cmake .. && make -j && make test

How to build your own service based on RocksDB replicator & cluster management libraries.

There is an example counter service under examples/counter_service/, which demonstrated a typical usage pattern for RocksDB replicator.

Automated cluster management and recovery

Please check cluster_management directory for Helix powered automated cluster management and recovery.

Commands for cluster management (The following is for script driven cluster management, which has been deprecated)

The cluster mangement tool rocksdb_admin.py is under rocksdb_admin/tool/.

Before using the tool, we need to generate python client code for Admin interface as follows.

cd /rocksplicator/rocksdb_admin/tool/ && ./sync.sh

Create config file for a newly launched cluster.

host_file is a text file containing all hosts in the cluster. Each line is for a host in format "ip:port:zone". For example "192.168.0.101:9090:us-east-1c"

python rocksdb_admin.py new_cluster_name config --host_file=./host_file --segment=test --shard_num=1000 --overwrite

Ping all hosts in a cluster

python rocksdb_admin.py cluster_name ping

Remove a host from a cluster

python rocksdb_admin.py cluster_name remove_host "ip:port:zone"

Promote Master for shards currenty having Slaves only

python rocksdb_admin.py cluster_name promote

Add a host to a cluster

python rocksdb_admin.py cluster_name add_host "ip:port:zone"

Rebalance a cluster (Evenly distribute Masters)

python rocksdb_admin.py cluster_name rebalance

Load SST files from S3 to the cluster

python rocksdb_admin.py "cluster" load_sst "segment" "s3_bucket" "s3_prefix" --concurrency 64 --rate_limit_mb 64

Typical cluster management workflows (This has been deprecated, please check the new Helix powered solution in the cluster_management directory)

replacing a dead host

python rocksdb_admin.py cluster_name remove_host old_ip:old_port:zone_a
python rocksdb_admin.py cluster_name promote
python rocksdb_admin.py cluster_name add_host new_ip:new_port:zone_a
python rocksdb_admin.py cluster_name rebalance

License

Apache License, Version 2.0

More Repositories

1

ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
Kotlin
6,006
star
2

gestalt

A set of React UI components that supports Pinterest’s design language
JavaScript
4,205
star
3

PINRemoteImage

A thread safe, performant, feature rich image fetcher
C
3,998
star
4

PINCache

Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X
Objective-C
2,644
star
5

secor

Secor is a service implementing Kafka log persistence
Java
1,832
star
6

teletraan

Teletraan is Pinterest's deploy system.
Java
1,792
star
7

querybook

Querybook is a Big Data Querying UI, combining collocated table metadata and a simple notebook interface.
TypeScript
1,728
star
8

knox

Knox is a secret management service
Go
1,216
star
9

pinball

Pinball is a scalable workflow manager
JavaScript
1,047
star
10

mysql_utils

Pinterest MySQL Management Tools
Python
878
star
11

elixometer

A light Elixir wrapper around exometer.
Elixir
827
star
12

snappass

Share passwords securely
Python
812
star
13

pymemcache

A comprehensive, fast, pure-Python memcached client.
Python
740
star
14

bonsai

Understand the tree of dependencies inside your webpack bundles, and trim away the excess.
JavaScript
739
star
15

esprint

Fast eslint runner
JavaScript
657
star
16

bender

An easy-to-use library for creating load testing applications
Go
654
star
17

DoctorK

DoctorK is a service for Kafka cluster auto healing and workload balancing
Java
633
star
18

plank

A tool for generating immutable model objects
Swift
469
star
19

riffed

Provides idiomatic Elixir bindings for Apache Thrift
Elixir
307
star
20

thrift-tools

thrift-tools is a library and a set of tools to introspect Apache Thrift traffic.
Python
229
star
21

elixir-thrift

A Pure Elixir Thrift Implementation
Elixir
212
star
22

widgets

JavaScript widgets, including the Pin It button.
JavaScript
195
star
23

terrapin

Serving system for batch generated data sets
Java
176
star
24

singer

A high-performance, reliable and extensible logging agent for uploading data to Kafka, Pulsar, etc.
Java
173
star
25

git-stacktrace

Easily figure out which git commit caused a given stacktrace
Python
157
star
26

jbender

An easy-to-use library for creating load testing applications.
Java
155
star
27

ptracer

A library for ptrace-based tracing of Python programs
Python
154
star
28

react-pinterest

JavaScript
153
star
29

pinlater

PinLater is a Thrift service to manage scheduling and execution of asynchronous jobs.
Java
135
star
30

it-cpe-cookbooks

A suite of Chef cookbooks that we use to manage our fleet of client devices
Ruby
117
star
31

memq

MemQ is an efficient, scalable cloud native PubSub system
Java
111
star
32

psc

PubSubClient (PSC)
Java
110
star
33

pinterest-api-demo

JavaScript
105
star
34

PINOperation

Objective-C
102
star
35

api-quickstart

Code that makes it easy to get started with the Pinterest API.
Python
100
star
36

soundwave

A searchable EC2 Inventory store
Java
97
star
37

orion

Management and automation platform for Stateful Distributed Systems
Java
94
star
38

PINFuture

An Objective-C future implementation that aims to provide maximal type safety
Objective-C
81
star
39

kingpin

KingPin is the toolset used at Pinterest for service discovery and application configuration.
Python
69
star
40

arcanist-linters

A collection of custom Arcanist linters
PHP
61
star
41

pagerduty-monit

Wrapper scripts to integrate monit and PagerDuty.
Shell
60
star
42

pinrepo

Pinrepo is a highly scalable solution for storing and serving build artifacts such as debian packages, maven jars and pypi packages.
Python
57
star
43

quasar-thrift

A Thrift server that uses Quasar's lightweight threads to handle connections.
Java
47
star
44

yuvi

Yuvi is an in-memory storage engine for recent time series metrics data.
Java
45
star
45

transformer_user_action

Transformer-based Realtime User Action Model for Recommendation at Pinterest
Python
44
star
46

pinterest-python-sdk

An SDK that makes it quick and easy to build applications with Pinterest API.
Python
35
star
47

slackminion

A python bot framework for slack
Python
22
star
48

atg-research

Python
20
star
49

l10nmessages

L10nMessages is a library that makes internationalization (i18n) and localization (l10n) of Java applications easy and safe.
Java
17
star
50

arcanist-owners

An Arcanist extension for displaying file ownership information
PHP
16
star
51

api-description

OpenAPI descriptions for Pinterest's REST API
15
star
52

thriftcheck

A linter for Thrift IDL files
Go
13
star
53

.github

Pinterest's Open Source Project Template
11
star
54

pinterest-python-generated-api-client

This is the auto-generated code using OpenAPI generator. Generated code comprises HTTP requests to various v5 API endpoints.
Python
10
star
55

homebrew-tap

macOS Homebrew formulas to install Pinterest open source software
Ruby
9
star
56

wheeljack

Work with interdependent python repositories seemlessly.
Python
8
star
57

vscode-gestalt

Visual Studio Code extension for Gestalt, Pinterest's design system
TypeScript
7
star
58

ffffound

FFFFOUND Import tool for Pinterest
HTML
6
star
59

vscode-package-watcher

Watch package lock files and suggest to re-run npm or yarn.
TypeScript
5
star
60

graphql-lint-rules

Pinterest GraphQL Lint Rules
TypeScript
5
star
61

ss-gtm-template

This is a repository to implement the Google Tag Manager server-side tag template for Pinterest API for Conversions to be deployed into Google Community Template Gallery.
Smarty
4
star
62

pinterest-magento2-extension

PHP
3
star
63

Pinterest-Salesforce-Commerce-Cartridge

JavaScript
2
star
64

slate

Resource Lifecycle Management framework
Java
1
star