OpenSearch doesn’t work sometimes

I’ve got an error in OpenSearch using them in our setup where sometimes OpenSearch does not work and gives the below errors.
Error calling HTTP request to http://localhost:9200/prod_mantle_party java.net.ConnectException: Connection refused Connection refused

I’m wondering if anyone has encountered this before and if they have any ideas on how to fix it.
Our compose file is below -
My setup Yml file is :-
version: “2”
services:
moqui-server2:
image: moquitest
container_name: moqui-server2
command: conf=conf/MoquiDevConf.xml
restart: always
ports:
- 8081:xx
links:
- moqui-search
volumes:
- /home/TestXolve/runtime:/opt/moqui/runtime/test
environment:
# - “JAVA_TOOL_OPTIONS=-Xms1024m -Xmx1024m”
- instance_purpose=dev
- entity_ds_db_conf=postgres
- entity_ds_host=xxxxxx
- entity_ds_port=xxxxx
- entity_ds_database=xxxx
- entity_ds_user=xxxxx
- entity_ds_password=xxxxxx
- entity_ds_crypt_pass=‘DEFAULT_CHANGE_ME!!!’
- elasticsearch_url=http://localhost:9200
- elasticsearch_index_prefix=test_
- VIRTUAL_HOST=test.xolvegroup.com
- webapp_allow_origins=*
- webapp_http_host=test.xolvegroup.com
- webapp_http_port=80
- webapp_https_port=443
- webapp_https_enabled=true
- default_locale=en_US
- default_time_zone=US/Pacific

moqui-server3:
image: moquidemo
container_name: moqui-server3
command: conf=conf/MoquiDevConf.xml
restart: always
ports:
- 8082:xx
links:
- moqui-database
- moqui-search
volumes:
- /home/DemoXolve/runtime:/opt/moqui/runtime/demo
environment:
# - “JAVA_TOOL_OPTIONS=-Xms1024m -Xmx1024m”
- instance_purpose=dev
- entity_ds_db_conf=postgres
- entity_ds_host=moqui-database
- entity_ds_schema=public
- entity_ds_port=xxxx
- entity_ds_database=xxxxx
- entity_ds_user=xxxx
- entity_ds_password=xxxxx
- entity_ds_crypt_pass=‘DEFAULT_CHANGE_ME!!!’
- elasticsearch_url=http://localhost:9200
- elasticsearch_index_prefix=demo_
- VIRTUAL_HOST=demo.xolvegroup.com
- webapp_allow_origins=*
- webapp_http_host=demo.xolvegroup.com
- webapp_http_port=80
- webapp_https_port=443
- webapp_https_enabled=true
- default_locale=en_US
- default_time_zone=US/Pacific

moqui-database:
image: postgres:12.1
container_name: moqui-database
restart: always
ports:
# change this as needed to bind to any address or even comment to not expose port outside containers
- 127.0.0.1:5432:5432
volumes:
# edit these as needed to map configuration and data storage
- /home/DemoXolve/docker/db/postgres/data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=xxxx
- POSTGRES_DB_SCHEMA=public
- POSTGRES_USER=xxxx
- POSTGRES_PASSWORD=xxxx
# PGDATA, POSTGRES_INITDB_ARGS

moqui-search:
image: opensearchproject/opensearch:2.4.0
container_name: moqui-search
restart: always
ports:
# change this as needed to bind to any address or even comment to not expose port outside containers
- 9200:9200
- 9300:9300
volumes:
- ./opensearch/data:/usr/share/opensearch/data
environment:
- “OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m”
- discovery.type=single-node
- bootstrap.memory_lock=true
- “DISABLE_INSTALL_DEMO_CONFIG=true”
- “DISABLE_SECURITY_PLUGIN=true”
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536

Just to clarify something that may be obvious from the yml file… we are running three instances of moqui and using the same opensearch installation with prefixes for each moqui instance.
The problem we are running into is that it will work for a while, then we start getting the connection error. On the server there are “zombie” processes and once we kill those it works again.

1 Like

I would check the logs from OpenSearch first. Also make sure the machine has enough memory & disk space to handle all these containers.

2 Likes