Google PubSub is a fully managed message publish/subscription service that enables you to decouple and scale microservices, distributed systems, and serverless applications.
ChaosSearch provides the ability for live indexing with the integration for Google Pub/Sub. With the Pub/Sub Integration configured, ChaosSearch can identify new files that have been put into the queue for discovery and indexing.
With Live Indexing enabled for an object group, ChaosSearch monitors your Google storage bucket for object creation events via user-specified Pub/Sub subscriptions and index the new objects, making the data available for querying as it becomes available.
GCP Service account
Please note that the Google Cloud Platform Service account configured for the ChaosSearch account must also be configured with appropriate access to the Pub/Sub subscription.
- In the GCP Management Console, navigate to Pub/Sub.
- Click Create Topic. The Create a topic window appears.
- In the Topic ID field, type a name for the topic.
- De-select (uncheck) Add a default subscription. Do not create the topic with this option selected.
- Click Create Topic. The topic is added; next you will create a subscription to associate with the topic.
- Click Subscriptions in the left menu.
- Click Create Subscription. The Create subscription window appears.
- In the Subscription ID field, type a name for the subscription and use the same name as your topic name.
- In the Select a Cloud Pub/Sub topic, select the topic that you created in the previous steps.
- Scroll down to the Acknowledgement deadline section, and increase the time to 600 seconds:
- Scroll to the bottom of the page and click Create to add the subscription.
NOTE: As an alternative to the UI steps above, you can create the topic and subscription using the gcloud utility commands. Some sample commands follow with test that you must substitute for your account and buckets:
gcloud --project YOUR-PROJECT-ID pubsub topics create YOUR-TOPIC-NAME gcloud --project YOUR-PROJECT-ID pubsub subscriptions create YOUR-SUBSCRIPTION-NAME --topic=YOUR-TOPIC-NAME --ack-deadline 600
You must associate your Pub/Sub Project ID and Subscription ID with the object group that you create to index the related Google Cloud Storage bucket.
- Create your object group following the steps described in Creating Object Groups.
- In the Create Object Group window, as in the following example, select the Live Indexing option, and paste the GCP Pub/Sub Project ID and the GCP Pub/Sub Subscription ID values into the two fields. A sample follows.
- Specify the retention values that you want to use for the index lifecycle.
- Click Create. The object group is created.
- Navigate to the object group Group Contents tab, and you should see that Live Indexing is configured. A sample window follows.
- Click Start Indexing when you are ready to index the related objects in the Cloud Storage bucket.
Make sure that you connect the Google Cloud Storage bucket to the Pub/Sub queue using Google’s gsutil command. A sample command format follows; you must replace the substitution strings with the values for your GCP configuration.
gsutil notification create -f json -p YOUR-LOGS-PREFIX -e OBJECT_FINALIZE -t YOUR-TOPIC-NAME gs://YOUR-BUCKET-NAME
Updated about 1 month ago