• This repository has been archived on 04/Dec/2017
  • Stars
    star
    283
  • Rank 146,066 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 7 years ago

Reviews

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

Repository Details

Treat Redis Lists like Unix Pipes

redis-pipe stability-deprecated Build Status

⚠️ Please migrate to lukasmartinelli/pipecat. This repository is no longer maintained by Lukas Martinelli.

redis-pipe allows you to treat Redis Lists as if they were Unix pipes. It connects stdin and stdout with LPUSH and LPOP. For AMQP based messages queues like RabbitMQ or ActiveMQ check out the successor project pipecat.

How it works

Configuration

Set the REDIS_HOST and REDIS_PORT environment variables for easy configuration or pass --host and --port arguments.

Writing from stdin to Redis List

Pipe in value to redis-pipe and it will LPUSH them to the Redis List.

echo "hi there" | redis-pipe greetings

Write from stdin to Redis with LPUSH

Reading from Redis List to stdout

If you call redis-pipe with a tty attached it will LPOP all values from the Redis List and write them to stdout.

redis-pipe greetings

Read from Redis with LPOP and write to stdout

You can also limit the amount of values popped from the list.

redis-pipe --count 100 greetings

Support for blocking mode with BLPOP is not supported yet.

Examples

Centralized Logging

In this sample we pipe the syslog to a Redis List called logs.

tail -f /var/log/syslog | redis-pipe logs

You can now easily collect all the syslogs of your machines on a single server.

redis-pipe logs > logs.txt

Very basic job queue

Create jobs and store them.

cat jobs.txt | redis-pipe jobs

Process jobs on several workers and store the results.

redis-pipe --count 10 jobs | python do-work.py | redis-pipe results

Collect the results.

redis-pipe results > results.txt

Installing from binary releases

Simply download the release and extract it. Add the binary install path to your ~/.bash_rc or ~/.bash_profile file e.g

OSX

wget https://github.com/lukasmartinelli/redis-pipe/releases/download/v1.4.1/redis-pipe_darwin_amd64.zip
unzip redis-pipe_darwin_amd64.zip
cd redis-pipe_darwin_amd64
cat << $ >> ~/.bash_profile
> export PATH = "$(pwd):\$PATH"
> $
$ source ~/.bash_profile
redis-pipe --help

Linux

wget https://github.com/lukasmartinelli/redis-pipe/releases/download/v1.4.1/redis-pipe_linux_amd64.tar.gz
tar -xvzf redis-pipe_linux_amd64.tar
cd redis-pipe_linux_amd64
cat << $ >> ~/.bash_rc
> export PATH = "$(pwd):\$PATH"
> $
$ source ~/.bash_rc
redis-pipe --help

Installing from source

$ go get github.com/lukasmartinelli/redis-pipe

To be able to use the the built binary in any shell, make sure to have your $GOPATH properly set in your ~/.bash_profile (on OS X) or ~/.bash_rc (on Linux) file e.g:

$ cat << ! >> ~/.bash_rc
> export GOPATH="\$HOME/gopath"
> export PATH="\$GOPATH:\$GOPATH/bin:\$PATH"
> !
$ source ~/.bash_rc

More Repositories

1

pgfutter

Import CSV and JSON into PostgreSQL the easy way
Go
1,311
star
2

py14

Python to C++ 14 transpiler
C++
573
star
3

pipecat

Connect UNIX pipes and message queues
Go
435
star
4

pgclimb

Export data from PostgreSQL into different data formats
Go
386
star
5

nigit

Web server that wraps around programs and shell scripts and exposes them as API
Go
383
star
6

postgis-editor

An accessible PostGIS query editor and visualizer.
JavaScript
192
star
7

mapbox-gl-inspect

Inspection plugin for Mapbox GL JS
JavaScript
142
star
8

naturalearthtiles

Natural Earth vector tiles (MVT) and raster tiles free and ready to use.
PLpgSQL
89
star
9

hwk

A Haskell based awk and sed alternative
Haskell
67
star
10

osm-noise-pollution

Approximate global noise pollution with OSM data and very simple noise model
Shell
66
star
11

php-dos-attack

Exploit json_decode vulnerability of PHP
PHP
35
star
12

osm-activity

Show global OpenStreetMap activity on a map
JavaScript
30
star
13

swissdem

Digital Elevation Model for Switzerland from SRTM (1 arc second / 25m) as download
Shell
17
star
14

osm-lakelines

Calculate nice centered linestrings for labelling OpenStreetMap lakes
Shell
15
star
15

px-to-csv

Convert PC-Axis files to CSV
JavaScript
14
star
16

mbtoolbox

MBTiles tools for optimizing and verifying MBTiles files
Python
13
star
17

push-it

Plays an encouraging sound when you do a git push
Shell
13
star
18

ghrr

Create realtime apps on top of GitHub
JavaScript
12
star
19

sharpen

Solve algorithmic Python challenges to sharpen the tools.
Python
11
star
20

detectivegit

Detective git takes a look at your repo and shows the hotspots and possible bugs.
JavaScript
9
star
21

osm-qa-filter

Extract GeoJSON features from OSM QA tiles
JavaScript
9
star
22

osm-simple-features

Defines an opinionated mapping from OSM to simple GeoJSON features with multiple layers and defined schemas.
JavaScript
7
star
23

swissnames

Curated extracts from the free swissNAMES3D data set from swisstopo.
Shell
5
star
24

delptr

Informs the world about people who still use naked pointers in C++
JavaScript
5
star
25

location-history-to-geojson

Turn your Google Location History into a GeoJSON feature collection
JavaScript
3
star
26

lukasmartinelli.github.io

Personal blog and portfolio.
HTML
2
star
27

battle-of-britain-map

A Mapbox GL map showcasing the air battle of Britain
CSS
2
star
28

biketour

Tracking my bike tour from Switzerland to Greece
HTML
1
star