Elasticsearch Learning 7_elasticsearch Configuration __elasticsearch

Source: Internet
Author: User
Tags flush time interval logstash java throws

0x01 Memory Tuning

There are several ways to adjust ES memory allocations, and it is recommended that you adjust the settings in/etc/sysconfig/elasticsearch (you can also modify the startup script under bin directly).

# Directory where the elasticsearch binary distribution resides Es_home=/usr/share/elasticsearch # Heap Size (defaults to 256m min, 1g max) # Modify this to es_heap_size the-XMS and-xmx setting for JVM parameters es_heap_size=32g # HEAP New Generation # represents the-xmn setting for JVM parameters # Es_heap_newsize= # Max Direct Memory # represents the JVM's-xx:maxdirectmemorysize settings #ES_DIRECT_SIZE = # Additional Java OPTS #ES_JAVA_ opts= # Maximum Number of open files max_open_files=65535 # Maximum amount of locked memory #MAX_LOCKED_MEMORY = # Maxim Um number of VMA (Virtual Memory Areas) a process can own max_map_count=262144 # elasticsearch log directory Log_dir=/var /log/elasticsearch # Elasticsearch Data Directory Data_dir=/var/lib/elasticsearch # elasticsearch work directory WORK_DI R=/tmp/elasticsearch # Elasticsearch conf directory conf_dir=/etc/elasticsearch # elasticsearch configuration file (elas TICSEARCH.YML) CONF_FILE=/ETC/ELASTICSEARCH/ELASTICSEARCH.YML # User to run as, change this to a specific elasticsearch u Ser if possible # Also mAke sure, this user can be write into the "Log directories in case" You are them # This setting only works for the Init SCRI PT, but has to is configured separately for SYSTEMD startup Es_user=elasticsearch # Configure restart on package upgrade
 (True, every other setting'll leads to not restarting) #RESTART_ON_UPGRADE =true

Note: You only need to modify the Es_heap_size settings, others remain the default. Unless you are proficient in the tuning of the JVM. The JVM tuning for ES can be viewed below. 0x02 cluster Settings

Modify the configuration/etc/elasticsearch/elasticsearch.yml the following fields are parsed in comments.

##################### elasticsearch Configuration Example ##################### # I'm just picking up some important configuration options to comment on, In fact, there are already very meticulous English notes. Where there is an understanding deviation please use the English original explanation as the subject. ################################### Cluster ##############################
##### # represents a cluster with multiple nodes in the cluster, one of which is a primary node, which can be elected, and the master-slave node is for the cluster.
A concept of the ES is to be centered, which is literally an unstructured node, which is for the outside of the cluster, because from the outside, the ES cluster is logically a whole, and your communication with any one node and the entire ES cluster is equivalent.
# cluster.name can determine your cluster name, and when your elasticsearch cluster is in the same segment Elasticsearch will automatically find Elasticsearch service with the same cluster.name.

# So when the same network segment has multiple elasticsearch clusters, Cluster.name becomes the identity of the same cluster. #cluster. Name:elasticsearch #################################### Node ##################################### #
The node name is the same, can be automatically generated or manually configured.
#node. Name: "Franz Kafka" # Allows a node to be a master node, and ES is the first machine in the default cluster to master, and if the machine stops, it will be returned to master. #node. Master:true # allows the node to store data (by default) #node. Data:true # configuration file gives three modes of configuring a High-performance cluster topology, as follows: # 1. If you want the node to never elect a primary node and use it only to store data, it can be used as a load # node.master:false # node.data:true # # 2. If you want the node to be the master node and do not store any data, and hold the idle resources, you can act as coordinator # node.master:true # Node.data:false
# # 3. If you want the node to be neither a master node nor a data node, then you can use it as a searcher, fetch data from nodes, generate search results, and so on # node.master:false # node.data:false # Monitor cluster status There are Plug-ins and APIs that can be used: # using T He Cluster Health API [Http://localhost:9200/_cluster/health], the # Node Info API [Http://localhost:9200/_nodes] or GUI t Ools # such as  
0x03 Template Use 

Template is a planning of index internal storage, reasonable control store and analyze, setting mapping is an important part of cluster optimization to improve performance. Can be passed through Curl-xget ' http://localhost:9200/twitter/ _mapping/tweet to view the mapping of an index.

There are several ways to template settings. The simplest is to post on the same way as storing data. The long-term approach is to write JSON files in the configuration path/etc/elasticsearch/templates. Do not need to restart ES, when you build a template, Each time a new index is created, the name of the index in the template that is in effect is automatically loaded, and the mapping is in effect.

If you use Logstash to write data to ES, in fact, Logstash has supported the use of templates. eg

Elasticsearch {
    template => ... # A valid filesystem path (optional) template_name =>
    ... # string (optional ), Default: "Logstash"
    template_overwrite => ... # boolean (optional), Default:false
  }

Logstash If you do not set the above settings, a default template is automatically specified. Default template in: Logstash_1.4.2/lib/logstash/outputs/elasticsearch/elasticsearch-template.json Related connection: http://logstash.net/ Docs/1.4.2/outputs/elasticsearch#template http://tinytub.github.io/elasticsearch-configs.html# http:// Www.yubingzhe.com/?p=137-See more at:http://bigbo.github.io/pages/2015/04/10/elasticsearch_config/?utm_source= Tuicool&utm_medium=referral#sthash.lcqvgcat.dpuf


Original from: Http://bigbo.github.io/pages/2015/04/10/elasticsearch_config/?utm_source=tuicool&utm_medium=referral

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.