I’m having trouble retrieving data on the UI even though I have a separate mysql instance, when the temporal server restarts the workflow data on the UI is gone, I’m I missing something here? like volume mounting on elastic?
Hi @Yuen_Yalung
I think is you map the directory where mysql persis the data to the host machine the data should be persisted.
There is an example here Docker-Compose persistent data MySQL - Stack Overflow
Let us know how it goes.
Antonio
I tried to persist the temporal data by MySQL with elasticsearch and applied volume mounting to backup and recover the data in case there something happens on the docker containers. However, when we stop and remove the temporal containers(server, ui, admin-tools and elasticsearch) and then start those containers again, the data that persisted with MySQL-Elasticsearch are missing in both UI and tctl.
I did the same scenario when the elasticsearch is disabled and used MySQL alone, and we are able to recover the data.
Any advise on how am I going to proceed with MySQL-Elasticsearch persistence? What are the disadvantages of removing elasticsearch form temporal?
Please find the attached files for the docker compose with and w/o elasticsearch configuration.
docker-compose-es
version: "3.5"
services:
elasticsearch:
container_name: temporal-elasticsearch
environment:
- cluster.routing.allocation.disk.threshold_enabled=true
- cluster.routing.allocation.disk.watermark.low=512mb
- cluster.routing.allocation.disk.watermark.high=256mb
- cluster.routing.allocation.disk.watermark.flood_stage=128mb
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms256m -Xmx256m
- xpack.security.enabled=false
image: elasticsearch:${ELASTICSEARCH_VERSION}
networks:
- temporal-network
ports:
- 9200:9200
volumes:
- ./dynamicconfig/elasticsearch/data:/var/lib/elasticsearch/data
temporal:
container_name: temporal
external_links:
- temporal-mysql:mysql
depends_on:
- elasticsearch
environment:
- DB=mysql
- MYSQL_USER=root
- MYSQL_PWD=June@2023
- MYSQL_SEEDS=mysql
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
- ENABLE_ES=true
- ES_SEEDS=elasticsearch
- ES_VERSION=v7
image: temporalio/auto-setup:${TEMPORAL_VERSION}
networks:
- temporal-network
ports:
- 7233:7233
volumes:
- ./dynamicconfig:/etc/temporal/config/dynamicconfig
labels:
kompose.volume.type: configMap
temporal-admin-tools:
container_name: temporal-admin-tools
depends_on:
- temporal
environment:
- TEMPORAL_CLI_ADDRESS=temporal:7233
image: temporalio/admin-tools:${TEMPORAL_VERSION}
networks:
- temporal-network
stdin_open: true
tty: true
temporal-ui:
container_name: temporal-ui
depends_on:
- temporal
environment:
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
- TEMPORAL_UI_PORT=5180
image: temporalio/ui:${TEMPORAL_UI_VERSION}
networks:
- temporal-network
ports:
- 5180:5180
networks:
temporal-network:
external: true
docker-compose
version: "3.5"
services:
temporal:
container_name: temporal
external_links:
- temporal-mysql:mysql
environment:
- DB=mysql
- MYSQL_USER=root
- MYSQL_PWD=June@2023
- MYSQL_SEEDS=mysql
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
image: temporalio/auto-setup:${TEMPORAL_VERSION}
networks:
- temporal-network
ports:
- 7233:7233
volumes:
- ./dynamicconfig:/etc/temporal/config/dynamicconfig
labels:
kompose.volume.type: configMap
temporal-admin-tools:
container_name: temporal-admin-tools
depends_on:
- temporal
environment:
- TEMPORAL_CLI_ADDRESS=temporal:7233
image: temporalio/admin-tools:${TEMPORAL_VERSION}
networks:
- temporal-network
stdin_open: true
tty: true
temporal-ui:
container_name: temporal-ui
depends_on:
- temporal
environment:
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
- TEMPORAL_UI_PORT=5180
image: temporalio/ui:${TEMPORAL_UI_VERSION}
networks:
- temporal-network
ports:
- 5180:5180
networks:
temporal-network:
external: true
Whats ES version used? Have you tried binding your volume to /usr/share/elasticsearch/data
instead so something like
- esdata01:/usr/share/elasticsearch/data
Also would help to externalize your ES and db into separate docker-compose files so you dont restart them each time you want to restart temporal services.
What are the disadvantages of removing elasticsearch form temporal?
Since service release 1.20.0 you can configure advanced visibility on sql persistence, just note for prod deployments ES is still recommended.
I had similar issue, resolved using