The configuration file is located in the%es_home%/config/elasticsearch.yml file, and you can configure it by opening it with EditPlus.
All configurations can use environment variables, for example:
Node.rack: ${rack_env_var}
Represents an Rack_env_var variable in an environment variable.
The following is a list of Elasticsearch configurable items:
1. Cluster name, default is Elasticsearch:
Cluster.name:elasticsearch
2. Node name, the node name is created automatically when ES starts, but you can also configure:
Node.name: "Franz Kafka"
3. Whether as the primary node, each node can be configured as the primary node, and the default value is true:
Node.master:true
4. Whether the data is stored, that is, the index fragment is stored, the default value is true:
Node.data:true
The simultaneous configuration of master and data produces some bizarre effects:
1) When Master is false and data is true, the node is severely overloaded;
2) When Master is true and data is false, the node acts as a coordinator;
3) When Master is False,data also false, the node becomes a load balancer.
You can connect http://localhost:9200/_cluster/health or http://localhost:9200/_cluster/nodes, or use plugins http://github.com/ Lukas-vlcek/bigdesk or Http://mobz.github.com/elasticsearch-head to view the cluster status.
5. Each node can define some common properties associated with it for filtering when a post-cluster is fragmented:
node.rack:rack314
6. By default, multiple nodes can be started on the same installation path, if you want your ES to start only one node, you can set the following:
Node.max_local_storage_nodes:1
7. Set the number of fragments for an index, the default value is 5:
Index.number_of_shards:5
8. Set the number of copies that an index can be copied, and the default value is 1:
Index.number_of_replicas:1
When you want to disable an advertisement, you can set the following:
Index.number_of_shards:1
index.number_of_replicas:0
The settings of these two properties directly affect the execution of indexes and search operations in the cluster. Assuming you have enough machines to hold fragments and replicas, you can set these two values as follows:
1) Having more fragments can improve the index execution capability and allow a large index to be distributed through the machine;
2) Having more replicators can improve the ability of search execution and clustering.
For an index, number_of_shards can only be set once, and Number_of_replicas may be incremented or reduced at any time using the index Update Settings API.
Elasticsearch focuses on load balancing, migration, clustering results from nodes, and more. You can try a variety of designs to accomplish these functions.
You can connect Http://localhost:9200/A/_status to detect the status of an index.
9. Where the configuration files are located, i.e. where Elasticsearch.yml and Logging.yml are located:
Path.conf:/path/to/conf
10. Where the index data is assigned to the current node:
Path.data:/path/to/data
You can optionally include more than one location so that the data spans the file level so that there are more free paths at the time of creation, such as:
Path.data:/path/to/data1,/path/to/data2
11. Temporary File Location:
Path.work:/path/to/work
12. log file Location:
Path.logs:/path/to/logs
13. Plug-in installation location:
Path.plugins:/path/to/plugins
14. Plugin hosting location, if one of the plugins in the list is not installed, the node will not start:
Plugin.mandatory:mapper-attachments,lang-groovy
When the JVM starts swapping, Elasticsearch does not perform well: you need to protect the JVM from swapping, and you can set Bootstrap.mlockall to true to disallow swapping:
Bootstrap.mlockall:true
Make sure that the values for the Es_min_mem and Es_max_mem are the same, and that you can allocate enough intrinsic to the elasticsearch and leave enough memory for the system operation.
16. By default, Elasticsearch uses an 0.0.0.0 address and opens port 9200-9300 for HTTP transmission, 9300-9400 ports for node-to-node communication, and an IP address for self-provisioning:
network.bind_host:192.168.0.1
Publish_host set the address of the other node to connect to this node, and if not set, the Publish_host address must be the real address:
network.publish_host:192.168.0.1
Bind_host and Publish_host can be set together:
network.host:192.168.0.1
19. You can customize the port on which the node interacts with other nodes:
transport.tcp.port:9300
20. When interacting between nodes, you can set whether or not to compress and convert to No compression:
Transport.tcp.compress:true
21. Custom ports can be monitored for HTTP transport:
http.port:9200
22. Set the maximum length of the content:
http.max_content_length:100mb
2 3. Prohibit HTTP
Http.enabled:false
2 4. The gateway allows the cluster state to be held after all cluster restarts, changes to the cluster state are preserved, and when the cluster is first enabled, it can be read from the gateway to the State, and the default gateway type (also recommended) is Local:
Gateway.type:local
2 5. Allow recovery process after n nodes are started:
Gateway.recover_after_nodes:1
2 6. To set the time-out for initializing the recovery process:
Gateway.recover_after_time:5m
2 7. Set the maximum node that can exist in the cluster:
Gateway.expected_nodes:2
2 8. There are two scenarios for setting the concurrent number of a node in the initial recovery process:
Cluster.routing.allocation.node_initial_primaries_recoveries:4
The other is when you add, remove nodes, and adjust:
Cluster.routing.allocation.node_concurrent_recoveries:2
2 9. Set the throughput at recovery, which is unlimited by default:
indices.recovery.max_size_per_sec:0
30. Set the maximum number of streams opened when recovering a fragment from a peer node:
Indices.recovery.concurrent_streams:5
3 1. Set the number of primary nodes in a cluster, which can be between 2-4 when there are more than three nodes:
Discovery.zen.minimum_master_nodes:1
3 2. Set the time-out when pinging other nodes, which can be larger when the network is slow:
Discovery.zen.ping.timeout:3s
There are more settings on http://elasticsearch.org/guide/reference/modules/discovery/zen.html on the discovery.
3 3. Prevents the current node from discovering multiple cluster nodes, the default value is true:
Discovery.zen.ping.multicast.enabled:false
3 4. Set up a list of master nodes that can be discovered when a new node is started (mainly for different network segment machine connections):
Discovery.zen.ping.unicast.hosts: ["host1", "Host2:port", "Host3[portx-porty]"]
35. Set whether the index can be deleted or closed via regular or _all
Action.destructive_requires_name default false allows setting true to not allow
A detailed description of the distributed search Elasticsearch configuration file