elasticsearch 7.6 installation and deployment

Operating System Version: centos 7.6  

Version: elasticsearch 7.6.1

jdk version 11.0.6


server list:

192.168.0.31

192.168.0.32

192.168.0.33


1, the installation jdk 11

The specific steps will be omitted

2, installation elasticsearch

Official website to download elasticsearch-7.6.1-x86_64 rpm installation package

rpm -ivh elasticsearch-7.6.1-x86_64.rpm 


Modify the configuration file

#cat /etc/elasticsearch/elasticsearch.yml |grep -v "^#"

cluster.name: Hnbd# Cluster name

node.name: Es-31# Cluster node name

path.data: /var/lib/elasticsearch# Data file path

path.logs: /var/log/elasticsearch# Log file path

bootstrap.memory_lock: true# Locking physical memory address, prevent elasticsearch memory is swapped out, that is, to avoid the use of swap swap es

network.host: 0.0.0.0#ip address

http.port: 9200# Open port numbers

discovery.seed_hosts: ["192.168.0.31","192.168.0.32", "192.168.0.33"]# Set cluster nodes address

cluster.initial_master_nodes: ["Es-31"]# Specify the primary node list

http.cors.enabled: true# Enable cross-domain access, head plugins need to open these two configuration

http.cors.allow-origin: "*"


Add boot service starts

systemctl enable elasticsearch.service


Set JVM heap memory size, set according to the size of the server's memory, preferably not more than half of the total memory

#cat /etc/elasticsearch/jvm.options 

## JVM configuration

# Xms represents the initial size of total heap space

# Xmx represents the maximum size of total heap space

-Xms2g

-Xmx2g


Set the JAVA_HOME elasticsearch

#cat /etc/sysconfig/elasticsearch |grep "JAVA_HOME"

JAVA_HOME=/usr/java/jdk-11.0.6/


centos7 systemd need to modify the configuration, otherwise an error will start

/etc/systemd/system.conf

DefaultLimitNOFILE=65536

DefaultLimitNPROC=32000

DefaultLimitMEMLOCK=infinity


ERROR: bootstrap checks failed memory locking requested for elasticsearch process but memory is not locked

Official website Description:

elasticsearch official website recommended production environment requires setting bootstrap.memory_lock: true

Explained the official website 

They are: swapping occurs when system performance ES nodes will be very poor, will affect the stability of the node. So at all costs to avoid swapping. swapping cause deterioration Java GC cycle delay from milliseconds to minutes, is more serious or even cause a response delay from the cluster node. So the best locked elasticsearch occupation of memory, optional use less swap

centos7 systemd need to modify the configuration, centos6 not the same


3, mounting elasticsearch-head plug

elasticsearch 7.6 is the need to install a separate plug-in, plug-in that comes with the old version before

Installation dependencies

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc xmlto docbook2X gcc-c++ autoconf bzip2 -y

cd /usr/local/src/

Get the source package using git

git clone https://github.com/mobz/elasticsearch-head.git


Installation nodejs

curl -sL https://rpm.nodesource.com/setup_10.x | bash -

yum install -y nodejs

#node -v

v10.19.0

#npm -v

6.13.4


Installation grunt client program to control head plug

npm install -g grunt --registry=https://registry.npm.taobao.org

npm install -g grunt-cli --registry=https://registry.npm.taobao.org

npm install grunt-contrib-clean --registry=https://registry.npm.taobao.org

npm install grunt-contrib-concat --registry=https://registry.npm.taobao.org

npm install grunt-contrib-watch --registry=https://registry.npm.taobao.org

npm install grunt-contrib-connect --registry=https://registry.npm.taobao.org

npm install grunt-contrib-copy --registry=https://registry.npm.taobao.org

npm install grunt-contrib-jasmine --registry=https://registry.npm.taobao.org


Gruntfile.js modify the configuration file, add hostname field

                connect: {

                        server: {

                                options: {

                                        port: 9100,

                                        hostname: "*",

                                        base: '.',

                                        keepalive: true

                                }

                        }

                }

Modify /usr/local/elasticsearch-head/_site/app.js changed the default port number 9100 to 9200, this port is the http port head provided externally, to localhost instead of the machine to access the external address

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.0.31:9100";


Note: The front elasticsearch.yml configuration file must be open access cross-domain configuration file (http.cors.enabled: true http.cors.allow-origin: "*")


Start elasticsearch-head 

#cd /usr/local/elasticsearch-head

#nohup grunt server &


Browser opens elasticsearch-head   

http://192.168.0.31:9100/


QQ picture 20200324161813.png

Guess you like

Origin blog.51cto.com/wjlking/2481406