$ mkdir -p /data/agis/db-bil/agis-elastic-db-bil/db $ sudo useradd -r -u 1000 -U elasticsearch $ sudo chown elasticsearch:root /data/agis/db-bil/agis-elastic-db-bil/db $ cd /data/agis/db-bil/ $ cat agis-db-bil.yml version: '2.4' services: agis-mongo-db-bil: image: "mongo:4.4" container_name: agis-mongo-db-bil volumes: - ./agis-mongo-db-bil/db:/data/db ports: - "40504:27017" restart: on-failure cpus: 2 mem_limit: 10gb healthcheck: test: echo 'db.stats().ok' | mongo localhost:27017/just4testNur --quiet interval: 5s timeout: 5s retries: 12 agis-elastic-db-bil: image: "docker.elastic.co/elasticsearch/elasticsearch:5.6.4" container_name: agis-elastic-db-bil volumes: - ./agis-elastic-db-bil/db:/usr/share/elasticsearch/data ports: - "40505:9200" - "40506:9300" environment: - discovery.type=single-node - xpack.security.enabled=false restart: on-failure cpus: 2 mem_limit: 10gb healthcheck: test: curl -s http://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi interval: 30s timeout: 10s retries: 5 agis-redis-db-bil: image: "redis" container_name: agis-redis-db-bil volumes: - ./agis-redis-db-bil/data:/var/lib/redis - ./agis-redis-db-bil/redis.conf:/usr/local/etc/redis/redis.conf ports: - "40507:6379" networks: default: external: name: agis-netImport data from existing Elasticsearch. Необхоимо установить Tools to backup and restore ElasticSearch indices
$ cd ~/.local/bin $ elasticbackup localhost:9209 abonents-physical $ elasticbackup localhost:9209 abonents-jur $ elasticbackup localhost:9209 address $ ls -1 abonents-jur-documents-20210102.json abonents-jur-mappings-20210102.json abonents-physical-documents-20210102.json abonents-physical-mappings-20210102.json address-documents-20210102.json address-mappings-20210102.json $ docker ps | grep agis-elastic-db-bil agis-elastic-db-bil Up 21 minutes (healthy) 0.0.0.0:40505->9200/tcp, 0.0.0.0:40506->9300/tcp $ elasticrestore -d abonents-jur-documents-20210102.json -m abonents-jur-mappings-20210102.json localhost:40505 abonents-jur $ elasticrestore -d abonents-physical-documents-20210102.json -m abonents-physical-mappings-20210102.json localhost:40505 abonents-physical $ elasticrestore -d address-documents-20210102.json -m address-mappings-20210102.json localhost:40505 addressДополнительно
$ docker exec -it agis-mongo-db-bil bash root@0bdc744c407f:/# mongodump --archive --db=billing-extra | mongorestore --archive --nsFrom='billing-extra.*' --nsTo='agisbil.*' root@0bdc744c407f:/# mongodump --archive --db=billing-prod-srvkzowc-kzowc | mongorestore --archive --nsFrom='billing-prod-srvkzowc-kzowc.*' --nsTo='agisbil.*'