Redis Docker and Raspberry Pi

Redis Docker and Raspberry Pi

1 Build and Install on Container Server
Download the latest source
> git clone https://github.com/antirez/redis.git
> cd redis/

Build
> make

Install
>make PREFIX=/home/carl/tool/redis-2016-08-26 install

If not the latest, let install with one stable version
> wget http://download.redis.io/releases/redis-3.2.3.tar.gz
Unzip and Build and Install
> cd redis-3.2.3/
> make
> make PREFIX=/home/carl/tool/redis-3.2.3 install
Link the file to my tool directory, add to PATH
PATH="/opt/redis/bin:$PATH"

Check version
> redis-cli --version
redis-cli 3.2.3

2 Docker the Application and AUTH Config
conf/redis.conf Configuration file
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#bind 127.0.0.1
bind 0.0.0.0
requirepass PASSWORD

Docker file show us the installation in details.
FROM resin/rpi-raspbian:jessie
MAINTAINER Carl Luo <luohuazju@gmail.com>

ENV DEBIAN_FRONTEND noninteractive
RUN echo "deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi\n\
deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi\n\
" > /etc/apt/sources.list
RUN apt-get -y update
RUN apt-get install -y apt-utils
RUN apt-get -y dist-upgrade
RUN apt-get install -y build-essential gcc make

#install the software
ADD install/redis-3.2.3.tar.gz /install/
WORKDIR /install/redis-3.2.3
RUN make
RUN make PREFIX=/tool/redis-3.2.3 install

#configure the server
ADD conf/redis.conf /etc/

#start the application
EXPOSE 6379
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app/
CMD [ "./start.sh" ]

The Makefile is as follow:
IMAGE=sillycat/public
TAG=raspberrypi-redis
NAME=raspberrypi-redis

prepare:
wget http://download.redis.io/releases/redis-3.2.3.tar.gz -P install/

docker-context:

build: docker-context
docker build -t $(IMAGE):$(TAG) .

run:
docker run -d -p 6379:6379 --name $(NAME) $(IMAGE):$(TAG)

debug:
docker run -ti -p 6379:6379 --name $(NAME) $(IMAGE):$(TAG) /bin/bash

clean:
docker stop ${NAME}
docker rm ${NAME}

logs:
docker logs ${NAME}

publish:
docker push ${IMAGE}:${TAG}

fetch:
docker pull ${IMAGE}:${TAG}


Command to start at the side door per job level.
> #!/bin/sh -ex

#start the service
cd /tool/redis-3.2.3/bin
./redis-server /etc/redis.conf

Command to connect from command line.
Verify the installation
> redis-cli -h localhost -p 6379 -a kaishi117A ping
PONG

References:
http://sillycat.iteye.com/blog/2320436
http://andreas-kongelstad.tumblr.com/post/51622770030/part-2-installing-redis-on-raspberry-pi
http://redis.io/topics/cluster-tutorial
https://github.com/antirez/redis

Old Blog
http://sillycat.iteye.com/blog/1549504
http://sillycat.iteye.com/blog/1553507 Data type example
http://sillycat.iteye.com/blog/1553508 Data type example
http://sillycat.iteye.com/blog/1553509 Java example in projects

http://sillycat.iteye.com/blog/2028180 sentinel
http://sillycat.iteye.com/blog/2059166 redis cluster
http://sillycat.iteye.com/blog/2219342 monitor and data type example
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值