我目前正在尝试使用在每台集群机器上分别生成一个Redis的容器实例。我目前正在使用4台机器作为示例。使用关联标签,目的是确保两个redis实例不会被调度到同一台机器上。
首先,下面的方法起作用了。
redis:
image: redis
environment:
AFFINITY: com.myself.name!=redis
labels:
- "com.myself.name=redis"但是,在强制一些容器停下来模拟崩溃、将它们推回去、关闭所有容器,然后使用docker-compose scale redis=4从一开始就再次运行所有的东西之后,我发现redis在同一台机器上运行了两个容器,尽管集群中有4个可用的容器。
我到底做错了什么?谢谢。
发布于 2015-12-02 15:42:55
你应该试试这个:
redis:
image: redis
environment:
- "affinity:container!=*redis*"
labels:
- "com.myself.name=redis"这应该管用!
拜托,让我知道
发布于 2015-12-01 22:47:36
尝试这个码头组合文件
redis:
image: redis
environment:
- affinity:com.myself.name!=redis
labels:
- "com.myself.name=redis"https://stackoverflow.com/questions/34026578
复制相似问题