Lab 8.1: Multi cluster operations

Objective:

In this lab, you will set up a remote cluster for cross-cluster search. You will also configure cross-cluster replication.

  1. Click the Kibana 2 button in Strigo to open Kibana, which is connected to a one-node cluster named cluster2 that is already up and running. This node is accessible at the address node5:9304. Log in using training as the username and nonprodpwd for the password.

  2. Using Console, run a match_all query on the blogs index on cluster2. You will see that there are seven blogs, and notice they were published over three days: April 27-29, 2021.

    GET blogs/_search
    

  3. Go back to Kibana 1 and register cluster2 as a remote cluster to cluster1.

    Solution

    Go to Stack Management, then select Remote Clusters. Add a new remote cluster with the following properties:

    • Name: cluster2
    • Seed nodes: node5:9304
    • Node connections: 1

    Click Save and make sure that the cluster is connected.

  4. Write a query in Console of Kibana 1 that returns the seven blogs on cluster2.

    Solution

    A simple match_all query will do the trick - just make sure the index name is cluster2:blogs:

    GET cluster2:blogs/_search
    

  5. Write a query that searches the blogs indices on cluster1 and cluster2. Get the blogs containing the phrase "kibana query language" in the content field. You should get 24 hits.

    Solution
    GET blogs,cluster2:blogs/_search
    {
      "query": {
        "match_phrase": {
          "content": "kibana query language"
        }
      }
    }
    
  6. Next, you will configure cluster1 to replicate the blogs index from cluster2 (which currently only has seven documents). From Kibana1, go to the Cross-Cluster Replication page in Stack Management and select Create a follower index.

  7. Configure CCR so that the blogs index on cluster2 is replicated to cluster1 in a new index named replicated_blogs.

    Solution

    "Setup CCR" You can also complete this task by running the following command in Console of Kibana1:

    PUT /replicated_blogs/_ccr/follow
    {
      "remote_cluster": "cluster2",
      "leader_index": "blogs"
    }
    

  8. Your new follower index is paused initially. Start the replication process now.

    Solution

    You can start replication either by clicking the Manage button in the bottom-right corner of the screen you are viewing. If you already closed that window, the same options appear by clicking the three dots under Actions on the Cross-Cluster Replication UI page.

  9. Run the following query in Console of cluster1. You should get seven hits:

    GET /replicated_blogs/_count
    

  10. Let's change the leader index and see what happens. From Console of cluster2 (which is the Kibana 2 button in Strigo), run the following query - which adds a new field to each document in the blogs index:

    POST blogs/_update_by_query
    {
      "script": {
        "source": "ctx._source.version = 2",
        "lang": "painless"
      }
    }
    

  11. Go back to Console of cluster1 and view the documents in replicated_blogs. They should each have a new field named version that was added on cluster2:

    GET replicated_blogs/_search
    

Summary:

In this lab, you wrote a search across indices on multiple clusters. You implemented cross-cluster replication by replicating the blogs index of cluster2 to a new index on cluster1 named replicated_blogs.