Customizing Elasticsearch, Hazelcast, and MongoDB services

You need to perform extra configuration for Product Master docker images to work with an Oracle Server.

Fix Pack 2 - GA

Prerequisites

  • Supported Elasticsearch versions:
    • GA - Elasticsearch 5.5.3
    • Fix Pack 1 and later - Elasticsearch 7.7.0
  • Supported Hazelcast Platform Versions:
    • GA and later - Hazelcast Platform 3.12.5
    • Fix Pack 3 and later - Hazelcast Platform 4.0

Customizing Hazelcast service

You need to customize the Hazelcast service with configuration parameters as required. Typically, this involves configuring the hazelcast.xml file. So, you need to create a new Docker image for Hazelcast with customized settings. Create a Docker file with following content:

hazelcast/hazelcast:<version_number> 
# Adding custom hazelcast.xml
ADD hazelcast.xml ${HZ_HOME} 
ENV JAVA_OPTS -Dhazelcast.config=${HZ_HOME}/hazelcast.xml
You can use the hazelcast.xml supplied with the Product Master build to customize the image.
  1. Create a customized Hazelcast image by using the following command:
    docker build -t mdm-hazelcast:<version_number>.
    The command creates a customized Hazelcast Docker image with the "mdm-hazelcast" name and <version_number> tag.
  2. Start the Hazelcast service by using the following command:
    docker run -itd -p 5702:5702 mdm-hazelcast:<version_number>
For more information, see Hazelcast Docker image.

Customizing Elasticsearch service

Elasticsearch by default is set up with authentication enabled. If you want to use the community edition capabilities of Elasticsearch, you need to disable authentication in the Elasticsearch.
 Elasticsearch 5.x.x 
  • To start Elasticsearch with authentication disabled, use the following command:
    docker run -itd --rm -p 9200:9200 -p 9300:9300 -e "http.host=0.0.0.0" -e 
    "transport.host=0.0.0.0" -e xpack.security.enabled=false --name=elasticserver docker.elastic.co/elasticsearch/elasticsearch:5.x.x
  • To start Elasticsearch with authentication enabled, use the following command:
    docker run -itd --rm -p 9200:9200 -p 9300:9300 -e "http.host=0.0.0.0" -e 
    "transport.host=0.0.0.0" --name=elasticserver docker.elastic.co/elasticsearch/elasticsearch:5.x.x
 Elasticsearch 7.7.x  ( IBM® Product Master Fix Pack 1 and later)
To start Elasticsearch, use the following command (emphasis on the  Elasticsearch 7.7.x  variables):
docker container run -t -d --rm -e discovery.type=single-node -e
cluster.name=docker-cluster -e http.host=0.0.0.0 -e transport.host=0.0.0.0 -e xpack.security.enabled=false -e
transport.compress=true -e xpack.ml.enabled=false -e indices.query.bool.max_clause_count=10000 -p
9200:9200 -p 9300:9300 --network=mdm-network --name=elasticsearch-container docker.elastic.co/elasticsearch/elasticsearch:7.7.x
To avoid data loss of Elasticsearch, mount the local volume on the following directories:
  • /usr/share/elasticsearch/data - Contains data
  • /usr/share/elasticsearch/logs - Contains logs
Note: For production usage, you might want to configure Elasticsearch with volume that is bound on the /usr/share/elasticsearch/data to persist data across container restarts. For more information, see the Production mode section in the Install Elasticsearch with Docker.

Customizing MongoDB service

Required MongoDB docker image Version is 3.4.
  1. Create the /mnt/dockervol/docker-entrypoint-initdb.d directory on the docker host.
  2. Copy the mongo-init.js file to /mnt/dockervol/docker-entrypoint-initdb.d directory.
  3. Edit the mongo-init.js file.
    db = db.getSiblingDB('<MONGODB_DATABASE>');
    db.createCollection("test");
    
  4. Start the MongoDB container by using the following command:
    docker container run -itd --rm -p 27017:27017 
    -v /mnt/dockervol1/mongo_init_file:/docker-entrypoint-initdb.d 
    -v /mnt/dockervol1/mongodb/log:/var/log/mongodb 
    -v /mnt/dockervol1/mongodb/data:/data/db -e MONGO_INITDB_ROOT_USERNAME=<MONGODB_USERNAME> 
    -e MONGO_INITDB_ROOT_PASSWORD=<MONGODB_PASSWORD> --network=mdm-network --name=mongodb-container mongo:3.4
  5. View the container by using the following command:
    # docker ps | grep mongo
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAME
    d62367f33879 mongo:3.4 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:27017->27017/tcp mongodb-container
The MongoDB data and logs are stored on the mounted volume so even if you restart or re-create containers the data remains persistent.