1.elasticsearch cluster deployment

1.limit changes

vim /etc/security/limits.conf

Specific content:

* Soft nofile 65536

* Hard nofile 65536

*  soft noproc 2048

*  hard noproc 4096

* - memlock unlimited

es  soft  memlock  unlimited

es  hard  memlock  unlimited

sysctl -p take effect

Do not do the above operation, the deployment might start es:

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

2. Kernel parameter optimization

vim /etc/sysctl.conf

vm.max_map_count = 262144 # define the most memory area to have a process, we need

net.core.somaxconn = 2048 # need to add

sysctl -p take effect

Do not do the above operation, the possible deployment es start:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

3. Install jdk

cd /data/app

Jdk tarball upload, download or yum own

tar -xzvf jdk-*****-linux-x64.tar.gz 

Configure the environment variables (root and user-created are added to the environment variable)

vim /etc/profile   或者  ~/.bush_profile

export JAVA_HOME=/data/app/jdk******

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$JAVA_HOME/bin:$PATH

Become effective

source /etc/profile或者 source ~/.bush_profile

Verify jdk

java -version

4. Installation es

cd /data/app

Upload es archive, and extract and decompress jdk command as above package can be replaced

Creating data and log directory:

mkdir -p /data/app/es/{data,logs}

 

Elasticsearch.yml modify the configuration file:

vim /data/app/elasticsearc**/config/elasticsearch.yml

# ---------------------------------- Cluster -----------------------------------

# Use a descriptive name for your cluster:

# If the application is exclusive, application name, use the name of es-

cluster.name: ********

# ------------------------------------ Node ------------------------------------

# The name can be their own definition, it is recommended node1, node2 to name

node.name: node1

# Specify whether the node is eligible to be elected as the node, the default is true, es is the default cluster first machine for the master, if this machine will be linked to the re-election of master.

node.master: true

# Specify whether the node storing the index data, the default is true.

node.data: true

# ----------------------------------- Paths ------------------------------------

path.data: /data/app/es/data

# Path to log files:

path.logs: /data/app/es/logs

# ----------------------------------- Memory -----------------------------------

# Server system swapping occurs when the ES node performance will be very poor, it will also affect the stability of the node.

# So at all costs to avoid swapping. swapping cause deterioration Java GC cycle delay from milliseconds to minutes,

# Will cause more serious response delay even left the cluster nodes.

# The purpose of this parameter is when you can not shut down the system when the swap, recommended that this parameter is set to true.

# Prevent when the memory is not enough, elasticsearch memory is swapped to the swap, resulting in performance plummeted.

#ES enabled by default locked memory address, in order to avoid swapping improve performance. But Centos6 does not support SecComp function, start being given, so it is necessary to set it to false

bootstrap.memory_lock: false

bootstrap.system_call_filter: false

# Network.host, if you do not restrict access to the host, and set bind_host and publish_host two parameters, then we just need the property is set to 0.0.0.0, then do not restrict access and interact with the host node  

network.host: 10 ** ** 72 // the other two 68,10 ** ** 10 ** ** 71........

# You can monitor custom Http port transmission

http.port: 9200

The interaction between the # configuration node port. The default port

transport.tcp.port: 9300

# Set whether to compress data when tcp transmission, default is false, no compression

transport.tcp.compress: true 

# Set the maximum capacity of the contents of the request, the default 100mb 

http.max_content_length: 100mb

#IP preferably three, note that the number of master nodes, typically three, data quantity is not limited, with node.master: true

discovery.zen.ping.unicast.hosts: ["10.**.**.72","10.**.**.68","10.**.**.71"]

# This parameter control is a node need to see a minimum number of nodes has a master's qualifications before you can do the operation in a cluster. The official recommended value is (N / 2) +1, where N is the number of nodes having a master qualification.

discovery.zen.minimum_master_nodes: 1

 

Modify elasticsearch *** / bin / elasticsearch profile

vim /data/app/elasticsearch**/bin/elasticsearch

export JAVA_HOME = / data / setup / jdk **** // increased environmental variables

Adjustment of memory, usually half of server memory

vim /data/app/elasticsearch**/config/jvm.options

-Xms10g

-Xmx10g

 

5. Start es

Creating User es

groupadd es

useradd -g es esl

 

Change the ownership of the appropriate directory:

chown -R ESL is / data / app / en 

chown -R esl:es /data/app/elasticsearch****

 

sudo -u esl /data/app/elasticsearch*****/bin/elasticsearch -d

 

Direct browser access to curl or about ip: 9200 can not look at

 

 

Elasticsearch.yml modify the configuration file: vi /data/app/app/elasticsearch/config/elasticsearch.yml# --------------------------- ------- Cluster ----------------------------------- # Use a descriptive name for your cluster: # If the application is exclusive, application name, use es- name cluster.name: es-arms # -------------------------- ---------- Node ------------------------------------ # name can own definition, it is recommended node1, node2 to name node.name: node1 # specify whether the node is eligible to be elected as the node, the default is true, es is the default cluster first machine for the master, if this machine hung up will be re-elected master. node.master: true # specify whether the node is stored in the index data, the default is true. node.data: true # ----------------------------------- Paths -------- ----------------------------path.data: / data / app / es / data # Path to log files: path.logs: / Data / app / es / logs # ----------------------------------- Memory ----- ------------------------------ # server system occurred when swapping the ES node performance will be very poor, it will also affect the node stability. # So at all costs to avoid swapping. swapping can lead to deterioration of Java GC cycle delay from milliseconds to minutes, and # more serious response delay will cause even left the cluster nodes. # The purpose of this parameter is when you can not shut down the system when the swap, recommended that this parameter is set to true. # Prevent when the memory is not enough, elasticsearch memory is swapped to the swap, resulting in performance plummeted. #ES enabled by default locked memory address, in order to avoid swapping improve performance. But Centos6 does not support SecComp function, start being given, so it is necessary to set it to falsebootstrap.memory_lock: falsebootstrap.system_call_filter: false # network.host, if you do not restrict access to the host, and set bind_host and publish_host two parameters, then we just need to this property is set to 0.0.0.0, then do not restrict access node and a host of interactive network.host: 10.20.12.72 // other two 10.20.44.68,10.20.12.71 # can listen to a custom port http.port Http transmission : 9200 # interaction between the default port configuration node port transport.tcp.port:. # 9300 the data set whether to compress tcp transmission, default is false, no compression transport.tcp.compress: setting the maximum capacity requested content true # default 100mb http.max_content_length: 100mb # IP preferably three, note that the number of master nodes, typically three, an unlimited number of Data, with node.master: truediscovery.zen.ping.unicast.hosts: [ "10.20.12.72", "10.20.44.68", "10.20.12.71"] # This parameter control is a node need to see a minimum number of nodes has a master's qualifications before you can do the operation in a cluster. The official recommended value is (N / 2) +1, where N is the number of nodes having a master qualification. discovery.zen.minimum_master_nodes: 1

Guess you like

Origin www.cnblogs.com/timor19/p/12134368.html