`
sillycat
  • 浏览: 2539546 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics