Installing elastic search in CentOS

Time:2020-4-19
  • Install Java environment (tar package mode)

    Download Java tar package: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
    Unzip: tar-zxvf jdk-8u60-linux-x64.tar.gz
    Create a soft link: Ln-S / usr / Java / jdk1.8.0_ // usr / JDK // / usr / Java / jdk1.8.0_isthe path of tar package decompression file
    Edit the configuration file and configure the environment variables:
       vim /etc/profile
       
       Add at the end:
           JAVA_HOME=/usr/jdk
           CLASSPATH=$JAVA_HOME/lib/
           PATH=$PATH:$JAVA_HOME/bin
           export PATH JAVA_HOME CLASSPATH
           
     Execute command validation environment variable configuration: source / etc / profile  
     View version: Java version
  • Install elastic search (Reference: https://www.elastic.co/guide/…)

    wget  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.1-linux-x86_64.tar.gz
    Tar - zxvf elasticsearch-7.1.1-linux-x86_. Tar. Gz // Note: ES can't run directly under root user. You need to create other users (chown - res: ES / usr / local / elasticsearch /)
    Sudo VI config / elasticsearch.yml // you need to modify the location where the comment is released
       Cluster. Name: my application // cluster name
       Node. Name: node-1 // node name
       Network. Host: 0.0.0.0 // network
       Http.port: 9200 // port number
       Cluster. Initial master nodes: ["node-1"] // initial master node
    
    Modify configuration:
       1.vim  /etc/security/limits.conf
           *               soft    nofile          65536
           *               hard    nofile          65536
           *               soft    nproc           4096
           *               hard    nproc           4096
          
       View the configuration validation command (Note: you need to restart the server for validation)
           ulimit -Hu
           ulimit -Su
       
       2.vim /etc/sysctl.conf
           vm.max_map_count=262144
         Sysctl - P // execute the command sysctl - P to take effect
       
    
       #Host port correlation (if the host only listens to the local: 127.0.0.1, the default port is 9200)
       xpack.ml.enabled: false
       network.host: 0.0.0.0
       http.port: 9201
       
       RAM memory
       bootstrap.memory_lock: false
       bootstrap.system_call_filter: false
       
       #Allow cross domain
       http.cors.enabled: true
       http.cors.allow-origin: "*"
       
       #Clusters and nodes
       cluster.name: test-cluster
       node.name: master
       node.master: true