0

my cluster state was green and after restart of service one shard remains UNASSIGNED and status goes to yellow. I have 2 machines with 5 shard and 1 replica set settings. I am using default config with multicast off and uni cast enabled.I did rerouting using

for shard in $(curl -XGET http://localhost:9201/_cat/shards | grep UNASSIGNED | awk '{print $2}'); do
    echo "processing $shard"
    curl -XPOST 'localhost:9201/_cluster/reroute' -d '{
        "commands" : [ {
              "allocate" : {
                  "index" : "wall", 
                  "shard" : '$shard', 
                  "node" : "node1", 
                  "allow_primary" : false
              }
            }
        ]
    }'
    sleep 5
done

Which gives following output

{
"acknowledged":true,
"state":{
  "version":48,
  "master_node":"Ar7UpWUQSpSlYcje-u6bgA",
  "blocks":{

  },
  "nodes":{
     "EtQ9mOrLQbiUbHGqeQgMvQ":{
        "name":"node2",
        "transport_address":"inet[/XXX.XXX.XX.XXX:9300]",
        "attributes":{

        }
     },
     "Ar7UpWUQSpSlYcje-u6bgA":{
        "name":"node1",
        "transport_address":"inet[/XXX.XXX.XX.XXX:9301]",
        "attributes":{

        }
     }
  },
  "routing_table":{
     "indices":{
        "wall":{
           "shards":{
              "2":[
                 {
                    "state":"STARTED",
                    "primary":false,
                    "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
                    "relocating_node":null,
                    "shard":2,
                    "index":"wall"
                 },
                 {
                    "state":"STARTED",
                    "primary":true,
                    "node":"Ar7UpWUQSpSlYcje-u6bgA",
                    "relocating_node":null,
                    "shard":2,
                    "index":"wall"
                 }
              ],
              "0":[
                 {
                    "state":"STARTED",
                    "primary":true,
                    "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
                    "relocating_node":null,
                    "shard":0,
                    "index":"wall"
                 },
                 {
                    "state":"INITIALIZING",
                    "primary":false,
                    "node":"Ar7UpWUQSpSlYcje-u6bgA",
                    "relocating_node":null,
                    "shard":0,
                    "index":"wall"
                 }
              ],
              "3":[
                 {
                    "state":"STARTED",
                    "primary":false,
                    "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
                    "relocating_node":null,
                    "shard":3,
                    "index":"wall"
                 },
                 {
                    "state":"STARTED",
                    "primary":true,
                    "node":"Ar7UpWUQSpSlYcje-u6bgA",
                    "relocating_node":null,
                    "shard":3,
                    "index":"wall"
                 }
              ],
              "1":[
                 {
                    "state":"STARTED",
                    "primary":false,
                    "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
                    "relocating_node":null,
                    "shard":1,
                    "index":"wall"
                 },
                 {
                    "state":"STARTED",
                    "primary":true,
                    "node":"Ar7UpWUQSpSlYcje-u6bgA",
                    "relocating_node":null,
                    "shard":1,
                    "index":"wall"
                 }
              ],
              "4":[
                 {
                    "state":"STARTED",
                    "primary":false,
                    "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
                    "relocating_node":null,
                    "shard":4,
                    "index":"wall"
                 },
                 {
                    "state":"STARTED",
                    "primary":true,
                    "node":"Ar7UpWUQSpSlYcje-u6bgA",
                    "relocating_node":null,
                    "shard":4,
                    "index":"wall"
                 }
              ]
           }
        }
     }
  },
  "routing_nodes":{
     "unassigned":[

     ],
     "nodes":{
        "EtQ9mOrLQbiUbHGqeQgMvQ":[
           {
              "state":"STARTED",
              "primary":false,
              "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
              "relocating_node":null,
              "shard":2,
              "index":"wall"
           },
           {
              "state":"STARTED",
              "primary":true,
              "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
              "relocating_node":null,
              "shard":0,
              "index":"wall"
           },
           {
              "state":"STARTED",
              "primary":false,
              "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
              "relocating_node":null,
              "shard":3,
              "index":"wall"
           },
           {
              "state":"STARTED",
              "primary":false,
              "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
              "relocating_node":null,
              "shard":1,
              "index":"wall"
           },
           {
              "state":"STARTED",
              "primary":false,
              "node":"EtQ9mOrLQbiUbHGqeQgMvQ",
              "relocating_node":null,
              "shard":4,
              "index":"wall"
           }
        ],
        "Ar7UpWUQSpSlYcje-u6bgA":[
           {
              "state":"STARTED",
              "primary":true,
              "node":"Ar7UpWUQSpSlYcje-u6bgA",
              "relocating_node":null,
              "shard":2,
              "index":"wall"
           },
           {
              "state":"INITIALIZING",
              "primary":false,
              "node":"Ar7UpWUQSpSlYcje-u6bgA",
              "relocating_node":null,
              "shard":0,
              "index":"wall"
           },
           {
              "state":"STARTED",
              "primary":true,
              "node":"Ar7UpWUQSpSlYcje-u6bgA",
              "relocating_node":null,
              "shard":3,
              "index":"wall"
           },
           {
              "state":"STARTED",
              "primary":true,
              "node":"Ar7UpWUQSpSlYcje-u6bgA",
              "relocating_node":null,
              "shard":1,
              "index":"wall"
           },
           {
              "state":"STARTED",
              "primary":true,
              "node":"Ar7UpWUQSpSlYcje-u6bgA",
              "relocating_node":null,
              "shard":4,
              "index":"wall"
           }
        ]
     }
  },
  "allocations":[]
  }
}

But 0th shard is still unassigned and status is yellow.

Thanks

GregL
  • 9,370
  • 2
  • 25
  • 36
coder
  • 29
  • 3
  • 11
  • 1
    You ES_HEAP_SIZE is rather large for the amount of RAM you have. It's generally recommended to leave half of the RAM for the FS cache in the ES guides. You might also like to install kopf plugin – Cameron Kerr May 14 '15 at 09:24
  • Yes i have elastic search head plugin installed to see elastic clusture. – coder May 14 '15 at 13:15

1 Answers1

0

If you have a look at the logs you may notice a problem, such as a lack of disk space.

You can reduce the replica count to 0 for that index and then back to 1.

Another great thing to do is to adjust the replication speed, as by default it is quite slow.

Cameron Kerr
  • 4,069
  • 19
  • 25