elasticsearch中文件系统上索引的大小

时间:2013-07-31 09:23:06

标签: elasticsearch

我有一个非常简单的设置,包括一个在Ubuntu 13.04 64位系统中运行的elasticsearch 0.90.2。

使用_status,这是我的一个索引的信息:

 "edge":{
         "index":{
            "primary_size":"63.6kb",
            "primary_size_in_bytes":65127,
            "size":"63.6kb",
            "size_in_bytes":65127
         },
         "translog":{
            "operations":0
         },
         "docs":{
            "num_docs":43,
            "max_doc":63,
            "deleted_docs":20
         },
         "merges":{
            "current":0,
            "current_docs":0,
            "current_size":"0b",
            "current_size_in_bytes":0,
            "total":0,
            "total_time":"0s",
            "total_time_in_millis":0,
            "total_docs":0,
            "total_size":"0b",
            "total_size_in_bytes":0
         },
         "refresh":{
            "total":20,
            "total_time":"241ms",
            "total_time_in_millis":241
         },
         "flush":{
            "total":20,
            "total_time":"47ms",
            "total_time_in_millis":47
         },
         "shards":{
            "0":[
               {
                  "routing":{
                     "state":"STARTED",
                     "primary":true,
                     "node":"bn6ndqXtQKGVDg5eWjo78Q",
                     "relocating_node":null,
                     "shard":0,
                     "index":"edge"
                  },
                  "state":"STARTED",
                  "index":{
                     "size":"9.6kb",
                     "size_in_bytes":9887
                  },
                  "translog":{
                     "id":1375245630892,
                     "operations":0
                  },
                  "docs":{
                     "num_docs":8,
                     "max_doc":12,
                     "deleted_docs":4
                  },
                  "merges":{
                     "current":0,
                     "current_docs":0,
                     "current_size":"0b",
                     "current_size_in_bytes":0,
                     "total":0,
                     "total_time":"0s",
                     "total_time_in_millis":0,
                     "total_docs":0,
                     "total_size":"0b",
                     "total_size_in_bytes":0
                  },
                  "refresh":{
                     "total":3,
                     "total_time":"65ms",
                     "total_time_in_millis":65
                  },
                  "flush":{
                     "total":4,
                     "total_time":"11ms",
                     "total_time_in_millis":11
                  }
               }
            ],
            "1":[
               {
                  "routing":{
                     "state":"STARTED",
                     "primary":true,
                     "node":"bn6ndqXtQKGVDg5eWjo78Q",
                     "relocating_node":null,
                     "shard":1,
                     "index":"edge"
                  },
                  "state":"STARTED",
                  "index":{
                     "size":"9kb",
                     "size_in_bytes":9284
                  },
                  "translog":{
                     "id":1375245630912,
                     "operations":0
                  },
                  "docs":{
                     "num_docs":6,
                     "max_doc":9,
                     "deleted_docs":3
                  },
                  "merges":{
                     "current":0,
                     "current_docs":0,
                     "current_size":"0b",
                     "current_size_in_bytes":0,
                     "total":0,
                     "total_time":"0s",
                     "total_time_in_millis":0,
                     "total_docs":0,
                     "total_size":"0b",
                     "total_size_in_bytes":0
                  },
                  "refresh":{
                     "total":3,
                     "total_time":"32ms",
                     "total_time_in_millis":32
                  },
                  "flush":{
                     "total":4,
                     "total_time":"7ms",
                     "total_time_in_millis":7
                  }
               }
            ],
            "2":[
               {
                  "routing":{
                     "state":"STARTED",
                     "primary":true,
                     "node":"bn6ndqXtQKGVDg5eWjo78Q",
                     "relocating_node":null,
                     "shard":2,
                     "index":"edge"
                  },
                  "state":"STARTED",
                  "index":{
                     "size":"19kb",
                     "size_in_bytes":19539
                  },
                  "translog":{
                     "id":1375245630990,
                     "operations":0
                  },
                  "docs":{
                     "num_docs":11,
                     "max_doc":16,
                     "deleted_docs":5
                  },
                  "merges":{
                     "current":0,
                     "current_docs":0,
                     "current_size":"0b",
                     "current_size_in_bytes":0,
                     "total":0,
                     "total_time":"0s",
                     "total_time_in_millis":0,
                     "total_docs":0,
                     "total_size":"0b",
                     "total_size_in_bytes":0
                  },
                  "refresh":{
                     "total":6,
                     "total_time":"74ms",
                     "total_time_in_millis":74
                  },
                  "flush":{
                     "total":4,
                     "total_time":"12ms",
                     "total_time_in_millis":12
                  }
               }
            ],
            "3":[
               {
                  "routing":{
                     "state":"STARTED",
                     "primary":true,
                     "node":"bn6ndqXtQKGVDg5eWjo78Q",
                     "relocating_node":null,
                     "shard":3,
                     "index":"edge"
                  },
                  "state":"STARTED",
                  "index":{
                     "size":"15.6kb",
                     "size_in_bytes":16049
                  },
                  "translog":{
                     "id":1375245631046,
                     "operations":0
                  },
                  "docs":{
                     "num_docs":9,
                     "max_doc":13,
                     "deleted_docs":4
                  },
                  "merges":{
                     "current":0,
                     "current_docs":0,
                     "current_size":"0b",
                     "current_size_in_bytes":0,
                     "total":0,
                     "total_time":"0s",
                     "total_time_in_millis":0,
                     "total_docs":0,
                     "total_size":"0b",
                     "total_size_in_bytes":0
                  },
                  "refresh":{
                     "total":5,
                     "total_time":"43ms",
                     "total_time_in_millis":43
                  },
                  "flush":{
                     "total":4,
                     "total_time":"10ms",
                     "total_time_in_millis":10
                  }
               }
            ],
            "4":[
               {
                  "routing":{
                     "state":"STARTED",
                     "primary":true,
                     "node":"bn6ndqXtQKGVDg5eWjo78Q",
                     "relocating_node":null,
                     "shard":4,
                     "index":"edge"
                  },
                  "state":"STARTED",
                  "index":{
                     "size":"10.1kb",
                     "size_in_bytes":10368
                  },
                  "translog":{
                     "id":1375245631130,
                     "operations":0
                  },
                  "docs":{
                     "num_docs":9,
                     "max_doc":13,
                     "deleted_docs":4
                  },
                  "merges":{
                     "current":0,
                     "current_docs":0,
                     "current_size":"0b",
                     "current_size_in_bytes":0,
                     "total":0,
                     "total_time":"0s",
                     "total_time_in_millis":0,
                     "total_docs":0,
                     "total_size":"0b",
                     "total_size_in_bytes":0
                  },
                  "refresh":{
                     "total":3,
                     "total_time":"27ms",
                     "total_time_in_millis":27
                  },
                  "flush":{
                     "total":4,
                     "total_time":"7ms",
                     "total_time_in_millis":7
                  }
               }
            ]
         }
      }

索引的总大小应为响应中的63.6kb

但是,如果我使用nautilus检查/var/lib/elasticsearch/elasticsearch/nodes/0/indices/edge,则会将尺寸报告为153.1kb

为什么会有这么大的差异? elasticsearch如何计算尺寸?

1 个答案:

答案 0 :(得分:2)

${data}/nodes/0/indices/edge中有几个文件不是索引文件,例如群集状态和事务日志。您应该能够通过运行wc -c /var/lib/elasticsearch/elasticsearch/nodes/0/indices/edge/*/index/*获得与Elasticsearch报告的数字相同的数字。