php+nginx+elasticsearch+redis集群配置

php+nginx+elasticsearch+redis集群配置

version: "3"
services:
  nginx:
    container_name: web-nginx
    image: nginx:latest
    restart: always
    ports:
      - 80:80
    volumes:
      - ./webserver:/webserver
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/conf.d:/etc/nginx/conf.d

  php7.2:
    container_name: php7.2
    image: php:7.2-fpm
    restart: always
    expose:
      - "9000"
    volumes:
      - ./php/php.ini:/etc/php/php.ini
      - ./php/php-fpm.conf:/etc/php/php-fpm.conf
      - ./log/php/:/var/log/php
      - ./webserver:/webserver
  es1:
    image: nshou/elasticsearch-kibana
    container_name: es1
    environment:
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    volumes:
      - /home/gaobo/docker-compose/elasticsearch/es1/data:/home/gaobo/elasticsearch/data
      - /home/gaobo/docker-compose/elasticsearch/es1/elasticsearch.yml:/home/gaobo/elasticsearch/config/elasticsearch.yml
    ports:
      - 9201:9200
    #networks:
      #- docker-compose_default
  es2:
    image: nshou/elasticsearch-kibana
    container_name: es2
    environment:
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    volumes:
      - /home/gaobo/docker-compose/elasticsearch/es2/data:/home/gaobo/elasticsearch/data
      - /home/gaobo/docker-compose/elasticsearch/es2/elasticsearch.yml:/home/gaobo/elasticsearch/config/elasticsearch.yml
    ports:
      - 9202:9200
    links:
      - es1
  redis-node1:
    image: redis:5.0.5
    container_name: redis-node1
    restart: always
    ports:
      - 6061:6061
      - 16061:16061
    volumes:
      - /home/gaobo/docker-compose/redis/slave1:/data
      - /home/gaobo/docker-compose/redis/config/slave1/redis.conf:/etc/redis/redis.conf/redis.conf
    command:
      redis-server /etc/redis/redis.conf/redis.conf   
  redis-node2:
    image: redis:5.0.5
    container_name: redis-node2
    restart: always
    ports:
      - 6062:6062
      - 16062:16062
    volumes:
      - /home/gaobo/docker-compose/redis/slave2:/data
      - /home/gaobo/docker-compose/redis/config/slave2/redis.conf:/etc/redis/redis.conf/redis.conf
    command:  
      redis-server /etc/redis/redis.conf/redis.conf
  redis-node3:
    image: redis:5.0.5
    container_name: redis-node3
    restart: always
    ports:
      - 6063:6063
      - 16063:16063
    volumes:
      - /home/gaobo/docker-compose/redis/slave3:/data
      - /home/gaobo/docker-compose/redis/config/slave3/redis.conf:/etc/redis/redis.conf/redis.conf
    command:
      redis-server /etc/redis/redis.conf/redis.conf

VOLUMES 宿主机建立相应目录即可

你可能感兴趣的:(php+nginx+elasticsearch+redis集群配置)