1.配置文件詳解 elasticsearch.yml文件:html
# ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # ------集羣的名稱(集羣中該節點必須徹底一致)------ cluster.name: my-application # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: ------節點名稱(集羣中節點名稱必須惟一)---- node.name: node-1 # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # ------ES的數據存儲目錄------ path.data: /path/to/data # # Path to log files: # -----ES的日誌存儲目錄------- path.logs: /path/to/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # -----鎖定物理內存地址,防止ElasticSearch內存被交換出去,避免使用swap交換分區----- bootstrap.memory_lock: true -------確保ES_HEAP_SIZE參數爲系統內存通常左右------- # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. ------當系統進行內存交換的時候,ES的性能不好------ # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # ------ES的ip綁定------ network.host: 192.168.15.38 # # Set a custom port for HTTP: # ----ES所佔用的端口----- http.port: 9200 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when new node is started: ------組建集羣時的節點列表------ ["192.168.1.10","192.168.1.11","192.168.1.12"] # The default list of hosts is ["127.0.0.1", "[::1]"] --------集羣中主節點列表------- discovery.zen.ping.unicast.hosts: ["host1", "host2"] # # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): # -----經過該參數來防止集羣腦裂現象(節點總數/2)+1-------(節點總數/2)+1 discovery.zen.minimum_master_nodes: 3 # # For more information, consult the zen discovery module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # -----一個集羣中N個節點啓動後才能進行數據恢復處理------- gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # 在一臺服務器上禁止啓動多個es服務 # Disable starting multiple nodes on a single system: # # node.max_local_storage_nodes: 1 # # Require explicit names when deleting indices: # #action.destructive_requires_name: true # -----head插件所須要的配置跨域---- http.cors.enabled: true http.cors.allow-origin: "*"