In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about the configuration of Elasticsearch, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Configuration details Cluster
Cluster name. Default is elasticsearch:
Cluster.name: elasticsearch
There are two situations for setting the number of concurrency of a node, one is during the initial recovery process:
Cluster.routing.allocation.node_initial_primaries_recoveries: 4
The other is when adding, deleting, and adjusting nodes:
Cluster.routing.allocation.node_concurrent_recoveries: 2
Node
Node name. The node name is automatically created when es starts, but you can also configure it:
Node.name: elasticsearch-01
Whether it is allowed to be the master node. The default value is true:
Node.master: true
Whether to store data, that is, index fragments. The default value is true:
Node.data: true
Note:
Configuring master and data at the same time can have some strange effects:
You can check the cluster status by connecting to http://localhost:9200/_cluster/health or http://localhost:9200/_cluster/nodes, or by using the plug-in http://github.com/lukas-vlcek/bigdesk or http://mobz.github.com/elasticsearch-head.
When master is false and data is true, there will be a heavy load on the node
When master is true and data is false, the node acts as a coordinator
When master is both false,data and false, the node becomes a load balancer.
Node custom attributes, which can be used for filtering when the cluster allocates fragments later:
Node.rack: rack-01
Index
Sets the number of fragments for an index. The default value is 5:
Index.number_of_shards: 5
Sets the number of indexes that can be replicated. The default value is 1:
Index.number_of_replicas: 1
When you do not need to be distributed, you can make the following settings:
Index.number_of_shards: 1index.number_of_replicas: 0
The settings of the above two attributes directly affect the execution of index and search operations in the cluster. Assuming that there are enough machines to hold fragments and copies, you can set these two values according to the following rules:
-having more fragmentation improves index execution and allows a large index to be distributed by machine
-having more replicas can improve search execution and clustering capabilities, but more replicas will reduce the efficiency of insert and delete operations.
-for an index, number_of_shards cannot be modified once set, while number_of_replicas can use index updates to set API to be added or decreased at any time
ElasticSearch focuses on load balancing, migration, slave node aggregation results, and so on. You can try a variety of designs to accomplish these functions, and you can connect to the http://localhost:9200/A/_status to detect the status of the index.
Paths
The location of the configuration file, that is, the location of elasticsearch.yml and logging.yml:
Path.conf: / path/to/conf
The location of the index data assigned to the current node:
Path.data: / path/to/data
You can optionally include more than one location so that the data spans locations at the file level, so that there are more free paths at creation time, such as:
Path.data: / path/to/data1,/path/to/data2
Temporary file location:
Path.work: / path/to/work
The location of the log file:
Path.logs: / path/to/logs
Plug-in installation location:
Path.plugins: / path/to/plugins
Plug-in hosting location. If one of the plug-ins in the list is not installed, the node cannot start:
Plugin.mandatory: mapper-attachments,lang-groovy
Memory
When JVM starts switching, ElasticSearch does not perform well: you need to ensure that JVM does not exchange, and you can set bootstrap.mlockall to true to disable switching:
Bootstrap.mlockall: true
Make sure that the values of ES_MIN_MEM and ES_MAX_MEM are the same, and that you can allocate enough internals for ElasticSearch and reserve enough memory for system operations. Network
By default, ElasticSearch uses an address of 0.0.0.0 and opens ports 9200-9300 for http transport and 9300-9400 for node-to-node communication, or you can set your own IP address:
Network.bind_host: 192.168.0.1
Publish_host sets the address for other nodes to connect to this node. If it is not set, the address of publish_host 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
You can customize the port on which this node interacts with other nodes:
Transport.tcp.port: 9300
When interacting between nodes, you can set whether to compress or not:
Transport.tcp.compress: true
You can customize ports for Http transport snooping:
Http.port: 9200
Set the maximum length of the content:
Http.max_content_length: 100mb
Disable HTTP:
Http.enabled: false
GateWay
The gateway is allowed to hold the cluster state after all clusters are restarted, and changes to the cluster state are saved. When the cluster is enabled for the first time, the status can be read from the gateway. The default gateway type (also recommended) is local:
Gateway.type: local
Allow the recovery process after N nodes are started:
Gateway.recover_after_nodes: 1
Set the timeout for initializing the recovery process:
Gateway.recover_after_time: 5m
Set the upper limit of nodes that can exist in the cluster:
Gateway.expected_nodes: 2
Indices
Set the throughput for recovery, which is unlimited by default:
Indices.recovery.max_size_per_sec: 0
Set the upper limit on the number of streams that can be opened when recovering a clip from a peer node:
Indices.recovery.concurrent_streams: 5
Discovery
Set the number of primary nodes in a cluster, which can be between 2 and 4 when there are more than three nodes:
Discovery.zen.minimum_master_nodes: 1
Set the timeout for other ping nodes, which can be increased when the network is slow:
Discovery.zen.ping.timeout: 3s
There are more settings about discovery on the.
The current node is prohibited from discovering multiple cluster nodes. The default value is true:
Discovery.zen.ping.multicast.enabled: false
Set the list of master nodes that can be found when the new node is started (mainly used for machine connections in different network segments):
Discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3 [portX-portY]"]
Various
Disable starting multiple nodes on one system:
Node.max_local_storage_nodes: 1
When you delete an index, you need to specify a name explicitly. If the value is false, you can delete it through regular or _ all:
Action.destructive_requires_name: true
The above is what the configuration of Elasticsearch is, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.