dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

temporal frontend unable to connect to elasticsearch visibilitystore #192

Open dhiaayachi opened 2 months ago

dhiaayachi commented 2 months ago

I have a temporal setup as following: defaultstore: postgres advancedVisibilityStore: es-visibility (the database behind es-visiblity is opensearch cluster) I ran some workflows and I see the data going into the opensearch. But the temporal UI does not show any data. Neither do I see any error logs from the temporal pods. The configmap for the temporal services look as following: (.venv) temporal prashanth$ kubectl get cm ft1-mm-temporal-frontend-config -o yaml apiVersion: v1 data: config_template.yaml: |- log: stdout: true level: "debug,info"

persistence:
  defaultStore: default
  advancedVisibilityStore: es-visibility
  numHistoryShards: 512
  datastores:
    default:
      sql:
        pluginName: "postgres12"
        driverName: "postgres12"
        databaseName: "temporal"
        connectAddr: "db-console-pg.ft1.dev.xxx.com:5432"
        connectProtocol: "tcp"
        user: temporal
        password: "{{ .Env.TEMPORAL_STORE_PASSWORD }}"
        maxConnLifetime: 1h
        maxConns: 20
        secretName: ""
    visibility:
      sql:
        pluginName: "postgres12"
        driverName: "postgres12"
        databaseName: "temporal"
        connectAddr: "db-console-pg.ft1.dev.xxx.com:5432"
        connectProtocol: "tcp"
        user: "temporal"
        password: "{{ .Env.TEMPORAL_VISIBILITY_STORE_PASSWORD }}"
        maxConnLifetime: 1h
        maxConns: 20
        secretName: ""
    es-visibility:
        elasticsearch:
            version: "v7"
            url:
                scheme: "https"
                host: "es.mgmt.dev.xxx.com:443"
            username: "temporal_visibility"
            password: "<placeholder>"
            logLevel: "error"
            indices:
                visibility: "temporal-visibility"

global:
  membership:
    name: temporal
    maxJoinDuration: 30s
    broadcastAddress: {{ default .Env.POD_IP "0.0.0.0" }}

  pprof:
    port: 7936

  metrics:
    tags:
      type: frontend
    prometheus:
      timerType: histogram
      listenAddress: "0.0.0.0:9090"

services:
  frontend:
    rpc:
      grpcPort: 7233
      membershipPort: 7933
      bindOnIP: "0.0.0.0"

  history:
    rpc:
      grpcPort: 7234
      membershipPort: 7934
      bindOnIP: "0.0.0.0"

  matching:
    rpc:
      grpcPort: 7235
      membershipPort: 7935
      bindOnIP: "0.0.0.0"

  worker:
    rpc:
      grpcPort: 7239
      membershipPort: 7939
      bindOnIP: "0.0.0.0"
clusterMetadata:
  enableGlobalDomain: false
  failoverVersionIncrement: 10
  masterClusterName: "active"
  currentClusterName: "active"
  clusterInformation:
    active:
      enabled: true
      initialFailoverVersion: 1
      rpcName: "temporal-frontend"
      rpcAddress: "127.0.0.1:7933"
dcRedirectionPolicy:
  policy: "noop"
  toDC: ""
archival:
  status: "disabled"

publicClient:
  hostPort: "ft1-mm-temporal-frontend:7233"

dynamicConfigClient:
  filepath: "/etc/temporal/dynamic_config/dynamic_config.yaml"
  pollInterval: "10s"

UI: Screenshot 2024-02-29 at 3 39 19 PM

dhiaayachi commented 1 month ago

The issue you're experiencing is likely due to a mismatch between the Temporal Server's configuration and the Elasticsearch cluster configuration. Here's a breakdown of the possible causes and how to troubleshoot:

1. Elasticsearch Connectivity

2. Elasticsearch Index and Mapping

3. Temporal Configuration and Compatibility

4. Temporal UI Configuration

Troubleshooting Steps

  1. Check Logs: Review the logs from your Temporal Server pods for any errors related to Elasticsearch.
  2. Test Connectivity: Use tools like curl or wget to test connectivity between the Temporal Server pods and the OpenSearch cluster.
  3. Validate OpenSearch: Use the OpenSearch console or API to verify the index mapping and schema.
  4. Try a Simple Workflow: Create a simple Workflow that writes data to the OpenSearch index using a custom Search Attribute and observe if it appears in the UI. This will help isolate if the issue is with your application code or the Temporal Service/OpenSearch integration.
  5. Restart Services: Try restarting the Temporal Server pods and the OpenSearch cluster to clear any temporary errors.

Additional Tips

Once you've thoroughly verified the connection, mapping, and configuration, and the issue persists, you should consult the Temporal community for additional guidance.

Key Resources

Remember: Providing specific details about your setup and the errors you encounter will help troubleshoot the issue more effectively.

dhiaayachi commented 1 month ago

Thanks for reporting this issue.

It looks like you're not seeing the data in the Temporal UI even though you're seeing data going into OpenSearch. You mentioned that there are no errors in the Temporal logs.

Could you please confirm:

  1. What version of Temporal are you using?
  2. Have you made sure that your OpenSearch cluster is correctly configured as the advanced visibility store?
  3. Can you provide more context about the workflows you're running? What is the workflow type?

To assist you further, I'll need more information to help you troubleshoot this issue. Please provide details as requested above.

dhiaayachi commented 1 month ago

Thanks for reporting this issue. The Temporal UI does not show data when using an Elasticsearch visibility store. This is because the visibility data in Elasticsearch needs to be refreshed.

You can work around this by triggering a refresh of the visibility data in Elasticsearch. There are two ways to do this:

  1. Use the temporal operator search-attribute list command. This command will refresh the visibility data in Elasticsearch.

  2. Use the temporal workflow list command with the --query option. This option can be used to filter the Workflow Executions to be affected by the Batch Job.

You can also refer to the documentation for Advanced Visibility for more information on how to use Elasticsearch as a visibility store.

dhiaayachi commented 1 month ago

Thank you for reporting this issue.

I see that you are using OpenSearch for your advanced visibility store, but the Temporal UI is not showing any data.

To help me determine what might be causing this, could you please provide the following information:

The documentation for advanced visibility and OpenSearch can be found here: https://docs.temporal.io/visibility#advanced-visibility

If you provide this information, I should be able to suggest a potential solution.

dhiaayachi commented 1 month ago

Thanks for reporting this! It looks like you're experiencing a known issue where the Temporal UI doesn't display data when using an OpenSearch cluster for the advanced visibility store. This is due to a mismatch in indexing configurations between the default and advanced visibility stores.

Here are the steps to fix the issue:

  1. Ensure proper setup: Double-check that your OpenSearch cluster is correctly configured and accessible by your Temporal services.
  2. Update index configuration: Ensure that the index configuration in your OpenSearch visibility store matches the configuration used by the default store. The index name, mapping, and schema should align.
  3. Verify data indexing: After making the necessary changes, confirm that data is being indexed in the OpenSearch cluster. Check your OpenSearch logs for any errors.
  4. Restart Temporal services: Restart the Temporal services (Frontend, History, and Matching) to allow them to read data from the updated OpenSearch index.

For more information about configuring advanced visibility in Temporal, you can refer to the documentation:

Please feel free to ask further questions if you need more assistance.

dhiaayachi commented 1 month ago

Thanks for reporting this issue!

I see that you are using Opensearch as your visibility store. The Temporal UI only supports Elasticsearch v7 or v8 for advanced visibility features. If you are using an older version of Elasticsearch, you may need to upgrade your cluster.

Can you share the version of Opensearch you are using?

Here is a link to the documentation for advanced visibility features: https://docs.temporal.io/visibility