本文介绍了Redis哨兵码头图像/ Dockerfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在coreOS群集上部署高可用性Redis,而且我需要一个可以工作的Redis Sentinel Docker映像(即Dockerfile)。我已经收集到足够的信息/专业知识来创建一个(我认为)...但是我有限的知识/高级网络的经验是唯一阻止我建立和分享它的东西。



这个专家可以帮助我开发一个Redis Sentinel Dockerfile(现在不存在)? Redis / Docker社区真的会从中受益。



这是更广泛的问题和上下文:



我认为解决方案就在这里具体来说:



这是我一直在使用的Docker文件,但如果你阅读上面的线程,你会看到我的评论(joshula)..它缺少mattsta正在谈论的网络修复。请注意,由于我在coreOS上使用此功能,所以sentinel.conf中的任何配置设置都将通过命令行(因此ENTRYPOINT)在运行时设置。

 #拉基本图像。 
FROM dockerfile / ubuntu:最新

#安装Redis。
RUN \
cd / tmp&&& \
wget http://download.redis.io/redis-stable.tar.gz&&& \
tar xvzf redis-stable.tar.gz&& \
cd redis-stable&& \
make&& \
make install&& \
cp -f src / redis-sentinel / usr / local / bin& amp;& \
mkdir -p / etc / redis&&& \
cp -f * .conf / etc / redis&&& \
rm -rf / tmp / redis-stable *&& \
sed -i's / ^ \(bind。* \)$ /#\1 /'/etc/redis/redis.conf&& \
sed -i's / ^ \(daemonize。* \)$ /#\1 /'/etc/redis/redis.conf&& \
sed -i's / ^ \(dir。* \)$ /#\1\\\
dir \ / data /'/etc/redis/redis.conf&& \
sed -i's / ^ \(logfile。* \)$ /#\1 /'/etc/redis/redis.conf

#定义可安装目录。
VOLUME [/ data]

#定义工作目录。
WORKDIR / data

#露出端口。
EXPOSE 26379

#定义默认命令。
ENTRYPOINT redis-sentinel /etc/redis/sentinel.conf


解决方案

经过一吨的工作,我最终弄清楚了。这就是为了让任何想要通过Docker部署高可用性redis实例的人变得简单:




I'm looking to deploy high availability Redis on a coreOS cluster, and I need a Redis Sentinel docker image (i.e. Dockerfile) that works. I've gathered enough information/expertise to create one (I think)... but my limited knowledge/experience with advanced networking is the only thing keeping me from building and sharing it.

Can someone who is an expert here help me developing a Redis Sentinel Dockerfile (none exist right now)? The Redis/Docker community would really benefit from this.

Here's the broader issue and context:https://github.com/antirez/redis/pull/1908

I think the solution is right here specifically:https://github.com/antirez/redis/pull/1908#issuecomment-54380876

Here's the Dockerfile I've been using... but if you read the thread above, you'll see my comments (joshula)... it lacks the Networking fixes that mattsta is talking about. Note that because I'm using this on coreOS, any config settings in sentinel.conf are being set at run-time via the command line (hence ENTRYPOINT).

# Pull base image.
FROM dockerfile/ubuntu:latest

# Install Redis.
RUN \
  cd /tmp && \
  wget http://download.redis.io/redis-stable.tar.gz && \
  tar xvzf redis-stable.tar.gz && \
  cd redis-stable && \
  make && \
  make install && \
  cp -f src/redis-sentinel /usr/local/bin && \
  mkdir -p /etc/redis && \
  cp -f *.conf /etc/redis && \
  rm -rf /tmp/redis-stable* && \
  sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf && \
  sed -i 's/^\(daemonize .*\)$/# \1/' /etc/redis/redis.conf && \
  sed -i 's/^\(dir .*\)$/# \1\ndir \/data/' /etc/redis/redis.conf && \
  sed -i 's/^\(logfile .*\)$/# \1/' /etc/redis/redis.conf

# Define mountable directories.
VOLUME ["/data"]

# Define working directory.
WORKDIR /data

# Expose ports.
EXPOSE 26379

# Define default command.
ENTRYPOINT redis-sentinel /etc/redis/sentinel.conf
解决方案

After a ton of work, I ended up figuring this out. Here's to making it simple for anyone else who wants to deploy a highly available redis instance via Docker:

https://registry.hub.docker.com/u/joshula/redis-sentinel/

这篇关于Redis哨兵码头图像/ Dockerfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 03:44