Elasticsearch systematic study (three) - The Basics

A, document data format

Data structure (1) is an object-oriented application systems, complex
(2) the object data stored in the database, only to dismantle, becomes flat multiple tables, each time have to revert back to the query object format, is rather cumbersome
(. 3) ES is a document for the data structure stored in the document, and the object-oriented data structure is the same, data structures, ES complex can be provided based on this document indexing, full-text search, and polymer etc.
(. 4) Document ES json data format used to express

{
    "email":      "[email protected]",
    "first_name": "san",
    "last_name": "zhang",
    "info": {
        "bio":         "curious and modest",
        "age":         30,
        "interests": [ "bike", "climb" ]
    },
    "join_date": "2017/01/01"
}

Second, a simple cluster management

The health of 2.1, a quick check of the cluster

es provides a set of api, called the cat api, es can be viewed in a variety of data, using GET / _cat / health? v View cluster status,? v add header

GET /_cat/health?v

epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1567342207 20:50:07  elasticsearch yellow          1         1      1   1    0    0        1             0                  -                 50.0%

Clusters of health status :

green: each index Shard primary and replica shard active state are
yellow: index primary Shard each state is active, but not the active replica shard portion, in the unavailable state
red: Not all of the primary index shard is the active state, part of the index data is lost

Why now in a yellow state?

We are now on a laptop, it started a process es, the equivalent of only one node. Es now have a index, it is kibana own built index established. Since the default configuration is assigned primary shard 5 and 5 for each replica shard index, and primary shard and replica shard can not be on the same machine (for fault tolerance). Now kibana index to establish their own is a primary shard and a replica shard. Currently on a node, so only one primary shard is assigned and activated, but not a replica shard to start the second machine.

Experimental tests :

Then just start the second process es, there will be two node in the cluster es, and that a replica shard is automatically allocated in the past, and then cluster status becomes green state.

epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1567342754 20:59:14  elasticsearch green           2         2      2   1    0    0        0             0                  -                100.0%

Guess you like

Origin www.cnblogs.com/hujinzhong/p/11443611.html