Cluster Admin Flashcards

1
Q

How do you check the status of the nodes?

A

GET _cat/nodes?v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you check the status of indices?

A

GET _cat/indices/v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you see on which nodes the shards of an index is allocated?

A

GET _cat/shards/< index >?v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does elastic determine in which nodes to put shards?

A

Elastic will make its best judment based on the settings of the index, unless you do allocation filtering.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you specify the number of replicas and shards of an index?

A

In the index settings:

PUTS < index >
{
   settings: {
      number_of_replicas: X,
      number_of_shards: Y.
   }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s a shortcut to modify only the index settings?

A

PUT < index >/_settings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to override index routing allocation (filtering)?

A

IN the index settings:

# To exclude a node
{
  "index.routing.allocation.exclude._name": "< node name >, ...."
}
# To revert the exclusion:
{
  "index.routing.allocation.exclude._name":  null
}

TODO: Check the api doc to other variables and use cases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are some fail safe measurement elastic has in place for shard allocation?

A

Elastic will only reallocate the shards if the index will remain in a green state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to do cluster routing allocation?

A

PUT _cluster/settings
{
“transient”: {
“cluster.routing.allocation.exclude._name”: “< node name >, …”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is transient and persistent cluster settings?

A

Transient won’t survive a cluster restart.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is routing allocation in elastic and what are some of the use cases?

A

Allows you to manually create rules that dictate where shards are allocated.

A common use case is taking a node down from the cluster, so you can filter that single node, wait for the cluster to rebalance and then shut it down.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you see the node attributes?

A

GET _cat/nodeattrs?v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is cluster routing allocation awareness and what are some of the use cases?

A

Allows to create some allocation rules for where to put primaries/replicas.

A tipical use case is avoiding putting all data into a single zone. So you can create “zone” custom attribute and use that in the allocation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the 2 ways to setup rounting allocation affinity?

A

Either put in the config.yml or use the API.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you setup cluster routing awareness?

A
PUT _cluster/settings
{
   "persistent": {
       "cluster.routing.allocation.awareness.attributes": "< attr name >"
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is force awareness and what is it used for and how do you set it up?

A

In a situation where you might not have enough space to re-allocate of the shards when a whole zone goes down, you might want to prevent those shards being re-allocated in case a whole zone goes down.

PUT _cluster/settings
{
   "persistent": {
       "cluster.routing.allocation.awareness.force.< attr name >.values: " < list of all possible values for the attribute > "
}
17
Q

What is the cluster allocation API?

A

Explains why your cluster is allocated a certain way.

GET _cluster/allocation/explain

18
Q

How do you setup filesystem based backup on elastic?

A
  • Whitelist the repository where the backup is gonna be saved

In config/elasticsearch.yml:

path. repo: /home/elastic/snaphosts
- Make sure the directory exists
- Restart elastic

19
Q

How do you create a Filesystem snapshot repository with the API?

A
PUT _snapshot/< repo name >
{
   type: "fs",
   settings: {
       location: "/home/elastic/snapshots",
}

PS: This doesn’t save the data, just creates a “repository”.

20
Q

How do you create a backup of an index?

A
  • With the repository previously created:

PUT _snapshot/< repo name>/< snapshot name >
{
indices: “< index name >”
}

21
Q

How do I wait for an API call to finish for async calls?

A

Add “?wait_for_completion=true” to the call.

22
Q

How do you restore a backup snapshot?

A

POST _snapshot/< repo name >/< snapshot name >/_restore
{
indices: “< the index to restore >”
}

23
Q

How do you backup all indices that start with a certain pattern?

A

You can use wildcards in the index name for the snapshot API.

24
Q

How do rename indices when restoring a backup?

A

Use the “rename_pattern” option with a regular expression.

{
rename_pattern: “(.+)”,
rename_replacement: “$1_restored”
}

25
Q

How do you create a tiered architecture (hot/warm/cold) in elastic?

A
  • Create a custom attribute named, for example “temp” in the config files.
  • In the index settings, configure the routing allocation (index.routing.allocation.require.temp: “hot/warm”).
26
Q

How do you configure a remote cluster to your cluster?

A

In the cluster settings:

PUT _cluster/settings
{
   "persistent": {
       "cluster": {
           "remote": {
                 "< cluster name >": {
                    seeds: ["< ip >:9300"]
}

Make sure to use the transport port (9300).

27
Q

What protocol/port is used for search in between clusters?

A

The elastic “transport” protocol (port 9300).

28
Q

How do you search on a remote cluster?

A

GET < remote name >: < index name >/_search