Skip to content

Instantly share code, notes, and snippets.

@sijie
sijie / scheduled-message-example.md
Last active July 9, 2019 08:23
How to deliver messages at a given time
producer.newMessage()
    .deliverAt(new Date(2019, 06, 27, 23, 00, 00)
        .getTime())
    .value("Hello Pulsar at 11pm on 06/27/2019!")
    .send();
@sijie
sijie / delayed-message-code-example.md
Last active July 9, 2019 08:27
How to deliver messages after 3 minutes
producer.newMessage()
    .deliverAfter(3L, TimeUnit.Minute)
    .value("Hello Pulsar after 3 minutes!")
    .send();
@sijie
sijie / geo-replication-demo-without-a-global-zookeeper.md
Last active September 5, 2023 14:01
Geo Replication Demo without a global zookeeper

This doc demonstrates how to do geo-replication across multiple pulsar clusters without a global configuration store (zookeeper).

This demo is using docker-compose to start 3 pulsar clusters. Each pulsar cluster has 1 zk, 1 bk, and 1 broker. The docker compose file can be found at https://gist.github.com/sijie/63737459112471a82957ae20bd78adb5.

The information of all the three clusters is listed in the following table:

zk configuration store broker
beijing zk-beijing zk-beijing broker-beijing
@sijie
sijie / pulsar-docker-compose-no-global-zookeeper.yml
Created May 22, 2019 15:52
Docker compose file to start 3 pulsar clusters without a global configuration store
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@sijie
sijie / standalone-docker-tls.md
Created May 9, 2019 13:46
Run Pulsar standalone in docker with TLS enabled
  1. Create a directory certs.
  2. Generated the TLS keys under certs directory.
  3. Run the docker command.
docker run \
	-p 6650:6650 -p 8080:8080 \
	-p 8081:8081 -p 6651:6651 \
	-p 8443:8443 \
	-v $PWD/certs:/certs \
@sijie
sijie / create-superuser-for-pulsar-admin-dashboard
Created March 20, 2019 03:22
Create superuser at pulsar admin dashboard
1. Follow the [instructions](http://pulsar.apache.org/docs/en/administration-dashboard/) to start the pulsar admin dashboard.
2. Create super user
1. ssh to the dashboard docker container: `docker exec -it <docker-id> bash`
2. go to `/pulsar/django` directory in the docker container: `cd /pulsar/django`
3. run python manage.py to create a superuser: `python manage.py createsuperuser --username admin`
4. once the superuser is created, you can go to [http://localhost/admin](http://localhost/admin) to login.
@sijie
sijie / pulsar-transport-binding-for-cloudevents.md
Created June 16, 2018 04:44
Pulsar Transport Binding for CloudEvents

Pulsar Transport Binding for CloudEvents

Abstract

The [Apache Pulsar][PULSAR] Transport Binding for CloudEvents defines how events are mapped to [Apache Pulsar messages][PULSAR-MSG-PROTO].

Status of this document

This document is a working draft.

@sijie
sijie / protobuf.md
Last active April 3, 2018 02:22
protobuf encoding/decoding

Highlights

Throughput

Alloc (bytes/op)

Details

Size: 1000

@sijie
sijie / checksum.md
Last active December 15, 2017 10:53
checksum benchmark

JDK 8 - OSX

Average Time

# Run complete. Total time: 00:09:33

Benchmark                               (bytesSize)  Mode  Cnt       Score       Error  Units
ChecksumBenchmark.directCrc32                     8  avgt   10      16.965 ±     0.607  ns/op
ChecksumBenchmark.directCrc32                    16  avgt   10      19.589 ±     1.222  ns/op
@sijie
sijie / gist:ef5d1b48ceca13ace2a108a2b8e8b9c5
Created November 11, 2017 18:49
pulsar hands-on session: prometheus yaml
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'