根据上篇指南(一),我们先创建Redis Cluster
填写好基本信息,比如redis-cluster-expose-port,设置服务,如下图所示:
8.Percona-XtraDB-Cluster集群设置,暴露3306端口
9.Rabbitmq集群设置,暴露15672,5672接口
10.Mongodb-replica-set设置,暴露27017,27018,27019端口
10.1注意上面创建的环境,使用robo 3T和NoSQLBooster都连接不上,只能自己进入docker镜像,使用mongo shell进行连接,具体原因还需要花时间找找,但是不影响部署。
具体连接语句如下:
#>mongo --host dbReplicaSet/localhost:27017,localhost:27018,localhost:27019
1.针对有github仓库的镜像,修改Docker镜像文件,比如
https://github.com/bijukunjummen/docker-rabbitmq-cluster的Dockerfile文件
FROM centos
MAINTAINER Biju Kunjummen [email protected]
RUN yum install -y wget unzip tar
RUN rpm -Uvh https://github.com/rabbitmq/erlang-rpm/releases/download/v19.3.6.5/erlang-19.3.6.5-1.el7.centos.x86_64.rpm
RUN yum install -y erlang
RUN rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
RUN yum install -y https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.0/rabbitmq-server-3.7.0-1.el7.noarch.rpm(这一句使用最新的版本即可,erlang环境估计也要改下)
RUN /usr/sbin/rabbitmq-plugins list <<<'y'
RUN /usr/sbin/rabbitmq-plugins enable --offline rabbitmq_mqtt rabbitmq_stomp rabbitmq_management rabbitmq_management_agent rabbitmq_federation rabbitmq_federation_management <<<'y'
#CMD /usr/sbin/rabbitmq-server
2.没有github仓库,fork别人的仓库,修改自己的dockerfile配置文件,添加到dockerhub,使用dockerhub创建自己的镜像,具体步骤如下:
2.1.修改dockerfile,具体参见https://github.com/inlight-media/docker-mongodb-replica-set
#
# MongoDB Dockerfile
#
# https://github.com/dockerfile/mongodb
#
# Pull base image.
FROM dockerfile/ubuntu
# Install MongoDB.
RUN \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys && apt-get update && apt-get install -y apt-transport-https ca-certificates && echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/$MONGODB_LIST_VERSION multiverse" | tee /etc/apt/sources.list.d/mongodb-org-$MONGODB_LIST_VERSION.list && apt-get update && apt-get install -y mongodb-org=$MONGODB_VERSION mongodb-org-server=$MONGODB_VERSION mongodb-org-shell=$MONGODB_VERSION mongodb-org-mongos=$MONGODB_VERSION mongodb-org-tools=$MONGODB_VERSION --allow-unauthenticated && echo "mongodb-org hold" | dpkg --set-selections && echo "mongodb-org-server hold" | dpkg --set-selections && echo "mongodb-org-shell hold" | dpkg --set-selections && echo "mongodb-org-mongos hold" | dpkg --set-selections && echo "mongodb-org-tools hold" | dpkg --set-selections && rm -rf /var/lib/apt/lists/*
# Define mountable directories.
VOLUME ["/data/db"]
# Define working directory.
WORKDIR /
# Expose ports for each Mongo replica set instance
EXPOSE 27017
EXPOSE 27018
EXPOSE 27019
# Copy required files over to container
COPY conf/ /conf/
COPY start.sh /start.sh
# Run start shell when container launches
CMD ["sh", "start.sh"]
2.2根据github上传到dockerhub,具体见https://blog.csdn.net/networken/article/details/85215714
2.3.最后docker build自己的镜像,例如:
docker build -t="inlight/mongodb-replica-set" github.com/inlight-media/docker-mongodb-replica-set